Skip to content

[integration_test] Wrap pumped widgets with a RepaintBoundary - #70368

Merged
fluttergithubbot merged 1 commit into
flutter:masterfrom
jiahaog:repaint-boundary
Dec 10, 2020
Merged

fluttergithubbot merged 1 commit into
flutter:masterfrom
jiahaog:repaint-boundary

Conversation

@jiahaog

@jiahaog jiahaog commented Nov 12, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@dnfield

dnfield commented Dec 9, 2020

Copy link
Copy Markdown
Contributor

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

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

LGTM. An actual gold test would be good, but let's not block the functionality in the meantime.

@jiahaog

jiahaog commented Dec 10, 2020

Copy link
Copy Markdown
Member Author

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