Skip to content

test: the image-drag pixel test waits for the page raster (flaky on windows-latest) - #3077

Open
mtlcl410 wants to merge 1 commit into
storytold:mainfrom
mtlcl410:test/wait-for-raster-before-image-drag
Open

mtlcl410 wants to merge 1 commit into
storytold:mainfrom
mtlcl410:test/wait-for-raster-before-image-drag

Conversation

@mtlcl410

Copy link
Copy Markdown
Contributor

What this changes

image_pixels_follow_the_frame_while_a_corner_is_dragged (crates/ui-egui/tests/editing.rs, from #1677) fails intermittently on test (windows-latest) with:

the picture is drawn in the frame [[704.0 245.2] - [828.8 322.0]], not only at []

Two recent examples:

So it isn't the PRs.

Cause. The drag preview draws the picture from the page raster, which arrives asynchronously. The test drags four frames after opening the document and never waits for that raster. On a slow runner it isn't there yet, so the preview draws no picture at all, hence the empty list.

Fix (test only). Before selecting and dragging, wait until render_pending() is false (up to 2 s), as other tests in this file do. Then assert that the raster arrived. No product code changes.

How you verified it

  • Reproduced the failure. I added a 300 ms sleep to every page render (a local change, not committed) to stand in for a slow runner. main's test then fails with the CI message (not only at []), and with this change it passes.
  • Without the delay, it passes as before.
  • cargo fmt --all -- --check, cargo clippy -p pdfcraft-ui-egui --tests -- -D warnings

🤖 Generated with Claude Code

https://claude.ai/code/session_01RUNQSPVXx3dDBabRZHAnjz

image_pixels_follow_the_frame_while_a_corner_is_dragged drags before the
asynchronous page raster has arrived on a slow runner, and the preview
(drawn from that raster) then draws no picture: 'not only at []' on
windows-latest for storytold#3070 and storytold#3071 (a deny.toml-only change). With a
300 ms render delay added locally, main's test fails the same way and
this one passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RUNQSPVXx3dDBabRZHAnjz
@skylartaylor

Copy link
Copy Markdown
Contributor

Thanks for tracking this down and reproducing the timing issue. Sorry I missed your earlier PR before opening #3129. I compared both with current main, and #2812 has already landed a wait before each drag that checks for the visible page raster as well as completed rendering. That covers the extra settling in mine too, so I’m closing #3129 rather than adding redundant waits. I appreciate the work you put into this.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff. It adds a bounded wait (up to 400 steps of 5 ms, one step per pass) for the page raster before the drag, then asserts it arrived, so a slow runner now fails with a clear message instead of an empty drag preview. That addresses the cause you describe and touches only the test. CI is green at this head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants