Repository navigation
Screenshot taken with LiveTestWidgetsFlutterBinding is truncated #66006
Description
Activity
- addeda: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our tests
on Sep 17, 2020 - addedframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
on Sep 17, 2020 - addedcustomer: googleVarious Google teamsVarious Google teamsP1High-priority issues at the top of the work listHigh-priority issues at the top of the work list
on Sep 17, 2020 /cc @Piinks
What if we just have the binding throw a repaint boundary around the whole view?
- added a commit that references this issue
on Nov 12, 2020 That's a great idea for a workaround! Sending #70368
The problem here is that
TestViewConfigurationdoes not override the setting ofdevicePixelRatio, so it gets set to 1.0 no matter what.This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Sep 7, 2021 - unlocked this conversation
on Jul 4, 2022 This is roughly what happened for reference:
- Fix DPR in test view configuration #88609 is supposed to fix the issue and remove the workaround of adding a repaint boundary in flutter_test
- Failure for the above pr detected b/197699775#comment3. I don't remember the complete details but cl/392929256 was suggested as the fix but it seemed like a deeper issue with the framework so it wasn't submitted
- Fix DPR in test view configuration #88609 was reverted in Revert "Fix DPR in test view configuration" #88889
- Sometime later Does not replace the root layer unnecessarily #101748 was submitted which contains Fix DPR in test view configuration #88609 partially, but does not include the removal of the repaint boundary workaround
- Remove workaround since #66006 is fixed #106913 was sent to remove the workaround.
- This is causing an internal test documented in b/168776765 to have inconsistent screenshots.
- Note that the failure in step (2) does not appear now.
The next step would be for a Googler to debug this test and figure out why it the screenshots are inconsistent without the repaint boundary.
- addedteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
on Jul 8, 2023 - removedtriaged-frameworkTriaged by Framework teamTriaged by Framework team
on Dec 3, 2023 This issue is marked P1 but has had no recent status updates.
The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.
Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!
- addedP2Important issues not at the top of the work listImportant issues not at the top of the work listand removedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work list
on Dec 4, 2023 - added a commit that references this issue
on Nov 21, 2024 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Dec 5, 2024
Internal: b/168776765
When using
LiveTestWidgetsFlutterBinding, screenshots of top level widgets are truncated.Context: We're trying to support screenshot testing in g3 with
package:integration_test, where the widgets binding inherits fromLiveTestWidgetsFlutterBinding. The following is a minimal repro with justflutter test.Steps to Reproduce
Run
flutter testwith the following test file:Expected behavior: Screenshot covers the full
MaterialApp.Similar to this image from AutomatedTestWidgetsFlutterBinding (with L5 commented out)
Actual Image (which looks truncated)
When I added some instrumentation to the
renderObjectused for taking a screenshot atflutter/packages/flutter_test/lib/src/_matchers_io.dart
Line 32 in fa64633
The
renderObjectis aLiveTestRenderView:_LiveTestRenderView#c6f40.Adding a
RepaintBoundaryaroundMaterialApp(the last second line of the snippet) fixes the issue.LiveTestWidgetsFlutterBinding with RepaintBoundary Image
#12994 looks like it could be related. It is pretty unexpected that a
RepaintBoundaryis needed just forLiveTestWidgetsFlutterBinding, but not for the defaultAutomatedTestWidgetsFlutterBinding, so this could be a bug. WithAutomatedTestWidgetsFlutterBinding, therenderObjectused for the screenshot isRenderRepaintBoundary#1d14f.Another thing I noticed is that if the following
flutter/packages/flutter_test/lib/src/binding.dart
Line 1674 in fa64633
the correct bounds are used for the image, though this probably isn't the correct fix.
Doctor Output