Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rfw] Increase tolerance for material widget tests #7148

Merged
merged 4 commits into from
Oct 7, 2024

Conversation

victoreronmosele
Copy link
Contributor

@victoreronmosele victoreronmosele commented Jul 17, 2024

This PR introduces a tolerance for rfw material widget tests to fix the golden test error in flutter/flutter#151611.

Part of a fix for flutter/flutter#151659.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the p: rfw Remote Flutter Widgets label Jul 17, 2024
@victoreronmosele victoreronmosele force-pushed the fix-rfw-tests branch 4 times, most recently from 3781e87 to 1935f04 Compare July 18, 2024 05:44
@victoreronmosele victoreronmosele marked this pull request as ready for review July 18, 2024 06:08
@victoreronmosele victoreronmosele requested a review from Hixie as a code owner July 18, 2024 06:08
@@ -23,6 +25,9 @@ void main() {
}

testWidgets('Material widgets', (WidgetTester tester) async {
setUpTolerantComparator(
testPath: 'test/material_widget_test.dart', precisionTolerance: 0.01);
Copy link
Contributor

Choose a reason for hiding this comment

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

how much is 0.01?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0.01 is 4800px out of the 480000px in the material_test.scaffold.png file.

The actual diff from the failing test is 4px so a more precise value for the tolerance is 0.00000833333.

Copy link
Contributor

Choose a reason for hiding this comment

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

Meaning there are four pixels that have a non-identical match to the control?

Copy link
Contributor

Choose a reason for hiding this comment

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

I worry that allowing four pixels to be just flat out wrong means that if we start incorrectly rendering a dot somewhere, we won't notice it. "Tolerance" makes it sound like we'd accept it if the four pixels happened to be slightly off in color (e.g. if 0xFFFEFEFE became 0xFFAFAFA or something), not that we'd accept wildly wrong renderings (e.g. 0xFF00FF00 becoming 0xFFFF0000).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. What would be a better fix for the issue? Updating the control images?

Also, I implemented the tolerance based on this comment in the original issue: flutter/flutter#151611 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

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

Updating the control images is a short-term fix, it doesn't really address the underlying issue (which is that skia and impeller don't guarantee pixel-identical rendering across versions for things like antialiasing and blurs, but the test is assuming they do).

I don't have a good solution. Setting the tolerance to something like 0.00002 (so if I understood correctly, allowing about 10 pixels to drift from the control) might be ok I guess? In the absence of any better ideas...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, 10px away from the control.

I'll update the tolerance.

Copy link
Contributor Author

@victoreronmosele victoreronmosele Aug 8, 2024

Choose a reason for hiding this comment

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

Updated now in 3306ea0.

@Hixie
Copy link
Contributor

Hixie commented Jul 27, 2024

Do we understand what kinds of changes are causing failures here? Is it anti-aliasing? Blurs? Something else?

@victoreronmosele victoreronmosele marked this pull request as draft August 2, 2024 18:31
@victoreronmosele
Copy link
Contributor Author

victoreronmosele commented Aug 3, 2024

Do we understand what kinds of changes are causing failures here? Is it anti-aliasing? Blurs? Something else?

I can't tell which one it is, but I generated the test failure artifacts in a GitHub Actions workflow run here.


Also, I pushed an update to the PR to set up the tolerant comparator for all the tests in the file since the failure was occurring in multiple tests.

@victoreronmosele victoreronmosele marked this pull request as ready for review August 3, 2024 14:35
@Hixie
Copy link
Contributor

Hixie commented Aug 3, 2024

I see nothing different in those diffs at all. :-/

@victoreronmosele
Copy link
Contributor Author

Cropping and zooming in on the images show some changes in the diffs.

See for material_test.overflow_bar_resembles_button_bar_masterImage.png:

Isolated Diff Masked Diff
Isolated Diff Masked Diff
Master Image Test Image
Master Image Test Image

Original material_test.overflow_bar_resembles_button_bar_masterImage.png:

material_test overflow_bar_resembles_button_bar_masterImage

@victoreronmosele victoreronmosele force-pushed the fix-rfw-tests branch 3 times, most recently from f00c494 to 15baa90 Compare August 9, 2024 03:12
@stuartmorgan
Copy link
Contributor

The referenced issue is closed; is this obsolete, or is changing the allowed diff still something we want to do?

@victoreronmosele
Copy link
Contributor Author

victoreronmosele commented Aug 27, 2024

@stuartmorgan, the main issue is flutter/flutter#151659. It is still open.

flutter/flutter#151659 says to fix and enable the rfw tests.

This PR is doing the fix.

If this gets merged, another PR should be raised to enable the actual tests in the flutter/tests repo.

@stuartmorgan
Copy link
Contributor

From triage: @Hixie, what is the next step here from a reviewer standpoint?

Copy link
Contributor

@Hixie Hixie left a comment

Choose a reason for hiding this comment

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

Sorry, this fell of my radar.

I guess LGTM, but I'm a bit skeptical of this approach. I would prefer to find ways to make Flutter not change rendering across versions (e.g. the way we do for shadows, where in golden tests the shadows become big black rectangles).

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2024
@auto-submit auto-submit bot merged commit 3890cee into flutter:main Oct 7, 2024
76 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 7, 2024
flutter/packages@05bf1d4...bb00d34

2024-10-07 [email protected] [google_sign_in] Update Pigeon for non-nullable generics (flutter/packages#7785)
2024-10-07 [email protected] [path_provider] Update Android Pigeon for non-nullable generics  (flutter/packages#7783)
2024-10-07 [email protected] [rfw] Increase tolerance for material widget tests (flutter/packages#7148)
2024-10-05 [email protected] [various] Update Java compatibility version to 11 (flutter/packages#7795)
2024-10-04 [email protected] [video_player] Update Pigeon for non-nullable generics (flutter/packages#7790)
2024-10-04 [email protected] [go_router] Added missing implementation for the routerNeglect parameter in GoRouter (flutter/packages#7752)
2024-10-04 [email protected] [google_maps_flutter_platform_interface] Convert `BitmapDescriptor` to typesafe subclasses (flutter/packages#7699)
2024-10-04 [email protected] [google_maps_flutter_platform_interface] Convert `PatternItem` and `Cap` to typesafe structures. (flutter/packages#7703)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@victoreronmosele victoreronmosele deleted the fix-rfw-tests branch October 11, 2024 21:12
victoreronmosele added a commit to victoreronmosele/tests that referenced this pull request Oct 11, 2024
victoreronmosele added a commit to victoreronmosele/tests that referenced this pull request Nov 19, 2024
victoreronmosele added a commit to victoreronmosele/tests that referenced this pull request Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: rfw Remote Flutter Widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants