Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

jiahaog
Copy link
Member

@jiahaog jiahaog commented Nov 12, 2020

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.

  • No, no existing tests failed, so this is not a breaking change.

Comment on lines +104 to +109
// 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);
});
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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 :)

Copy link
Member Author

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.

Copy link
Contributor

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.

@goderbauer goderbauer added the framework flutter/packages/flutter repository. See also f: labels. label Nov 12, 2020
@goderbauer
Copy link
Member

(PR triage) Are there still plans for this PR?

@dnfield
Copy link
Contributor

dnfield commented Dec 9, 2020

Let's land this as is for now and have a bug to track getting golden image support for it.

Copy link
Contributor

@dnfield dnfield left a 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.

@jiahaog
Copy link
Member Author

jiahaog commented Dec 10, 2020

Sorry, I wasn't able to find time to figure out the Skia Gold integration, filed #72045 for that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants