-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[integration_test] Wrap pumped widgets with a RepaintBoundary #70368
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
Conversation
// TODO(jiahaog): Remove when https://github.com/flutter/flutter/issues/66006 is fixed. | ||
testWidgets('root widgets are wrapped with a RepaintBoundary', (WidgetTester tester) async { | ||
await tester.pumpWidget(const Placeholder()); | ||
|
||
expect(find.byType(RepaintBoundary), findsOneWidget); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than this test, can we just add a golden test for this?
Just pump a simple/hello world app, use the screenshot method, and use the Skia gold comparison logic to compare it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can do that. Wouldn't it be clearer that we're specifically asserting for the RepaintBoundary
by doing it in code here though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but I think the idea is that we care if the screen shot works, and we don't particularly care where a repaint boundary is :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I couldn't quite figure out how to get matchesGoldenFile
to work with Skia gold though (following https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package%3Aflutter). cc @Piinks - is the Skia golden integration supported for non-package:flutter
packages like this? If not I can just check in the png into the tests/
directory alongside this test, but not sure if that's the best practice for this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Skia Gold integration does not currently work outside of the flutter package, no. It is set up with the flutter_test_config.dart in flutter/test. Maybe we can expand it? Not sure if there will be more integration tests requiring Skia support.
(PR triage) Are there still plans for this PR? |
Let's land this as is for now and have a bug to track getting golden image support for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. An actual gold test would be good, but let's not block the functionality in the meantime.
Sorry, I wasn't able to find time to figure out the Skia Gold integration, filed #72045 for that, thanks! |
Description
Workaround for #66006, where screenshots have incorrect bounds. Let me know if otherwise, but adding it here instead of
LiveTestWidgetsFlutterBinding
since taking screenshots doesn't seem like a common use case for that.Tests
I added the following tests:
Test that widgets are wrapped by the
RepaintBoundary
Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.