Repository navigation
test(ui-egui): wait for the page raster before dragging an image corner - #3129
Closed
skylartaylor wants to merge 1 commit into
Closed
skylartaylor wants to merge 1 commit into
skylartaylor wants to merge 1 commit into
Conversation
image_pixels_follow_the_frame_while_a_corner_is_dragged checks that the live drag preview stretches the page raster into the blue frame. That raster comes from the render workers asynchronously, but the test only ran a fixed number of frames (about 50 ms of wall time) before dragging. On a loaded Windows runner the raster had not arrived yet, no preview mesh was drawn, and the assertion failed with "not only at []". Wait, bounded, until no render is pending after the zoom change and after each undo, as the other GUI tests do. What the test checks is unchanged.
Contributor
|
For coordination: #3077 (opened 2026-10-17) fixes the same flaky test the same way. It waits on This PR does one thing #3077 doesn't: it also settles after each undo inside the loop, which covers later iterations whose raster is re-rendered after the undo. Only one of the two needs to land, so I'm happy to defer to whichever the maintainers prefer. If it's this one, I'll close #3077. |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
image_pixels_follow_the_frame_while_a_corner_is_draggedfails intermittently ontest (windows-latest), and passes on rerun:I found 17 failures between 2026-10-15 and 2026-10-17 on unrelated PR branches. All were Windows and all were first attempts. Linux had none. The test has been flaky since it landed in #1677.
Cause. The live drag preview stretches the whole-page raster (
DocView::page_raster) into the dragged frame, and draws nothing until that texture exists. The render pool's worker threads produce that raster asynchronously. The test only ran a fixed number of frames before dragging, about 50 ms of wall time for the whole test. When a busy Windows runner hadn't parsed and rendered the page by then, no picture mesh was drawn. The frame is drawn from geometry alone, so it was still correct. That's why the message shows a right frame and an empty list.Fix. This is a test-only change. It adds a bounded wait (up to 10 s, until
render_pending()is false, then asserts) after the zoom change and after each undo, the same settle patternui.rs,view.rsandcomments.rsuse. The assertions are unchanged. With no raster yet, the app shows the frame without pixels. That's the intended fallback, so the product code stays as it is.How you verified it
cargo fmt --check-D warningson the crates I changed (cargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings)cargo test -p pdfcraft-ui-egui --test editing: 129 passed)To show the test fails before the fix, I added a temporary sleep before the render worker's first parse, gated on an env var and not committed:
editingfile with 100, 300 and 700 ms delays, and with none: all 129 passThese runs were on Linux. I didn't rerun on Windows, because the delay reproduces the Windows failure deterministically.
Anything a reviewer should look at first
The second wait, after each undo, isn't needed for this failure: an undo keeps the stale raster on screen until the new one arrives. I kept it so the second drag starts from the same settled state as the first.