Skip to content

[Visual Regression Tests] Stabilize screenshot capture for animated controls#571

Merged
Anna Malchow-Perryman (apman) merged 1 commit into
masterfrom
agents/investigate-toggle-switch-regression-issues
Jun 30, 2026
Merged

[Visual Regression Tests] Stabilize screenshot capture for animated controls#571
Anna Malchow-Perryman (apman) merged 1 commit into
masterfrom
agents/investigate-toggle-switch-regression-issues

Conversation

@apman

@apman Anna Malchow-Perryman (apman) commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Fix flakey tests due to animated transitions still in progress at the time of the screenshots. This problem has so far only affected the ToggleSwitch, but as the new WinUI theme will contain more transitions, it was time to fix it before it gets too annoying.

…ontrols

Use adaptive frame settling in CaptureAndCompare to wait until two consecutive frames are identical (with a bounded timeout) before saving screenshots. This preserves control transitions while reducing nondeterministic visual diffs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI 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.

Pull request overview

This PR improves the determinism of Avalonia headless visual regression tests by adding a “frame settling” capture strategy that waits (up to a bounded timeout) for two consecutive rendered frames to match before saving/comparing screenshots. This helps reduce flaky baselines caused by transient transitions/animations at capture time.

Changes:

  • Add a stabilized screenshot capture path that compares consecutive frames in-memory until stable (bounded by timeout).
  • Introduce capture stabilization timeout/interval constants and supporting pixel-copy helper.
  • Route visual test capture through the new stabilization method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@apman Anna Malchow-Perryman (apman) merged commit 401f7f6 into master Jun 30, 2026
1 check passed
@apman Anna Malchow-Perryman (apman) deleted the agents/investigate-toggle-switch-regression-issues branch June 30, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants