Skip to content

Conversation

@liyuqian
Copy link
Contributor

@liyuqian liyuqian commented Apr 15, 2019

Description

As we've introduced offset to the Opacity layer, we have to override
applyTransform to make Leader/FollowerLayer work correctly.

Related Issues

Fixes #30587

Together with flutter/engine#8585,
this test will also exercise test against
#30586.

Tests

I added the following tests:

  • text field selection toolbar renders correctly inside opacity

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@liyuqian
Copy link
Contributor Author

WIP, the test won't pass until

  1. We fixed TextField inside Opacity has wrong selection Leader/Follower transformation #30587
  2. We uploaded the golden file.

@liyuqian liyuqian force-pushed the opacity_text_field_test branch from fe5f3ba to c8f09e9 Compare April 16, 2019 20:35
@liyuqian liyuqian changed the title [wip] Opacity text field test Fix text field selection toolbar under Opacity Apr 16, 2019
@liyuqian liyuqian force-pushed the opacity_text_field_test branch from c8f09e9 to 031a85c Compare April 16, 2019 21:53
@liyuqian liyuqian requested a review from Hixie April 16, 2019 21:59
@Hixie Hixie added the framework flutter/packages/flutter repository. See also f: labels. label Apr 16, 2019
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a Matrix4.translate method, which would make this more efficient

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

it's more efficient to just pump once with the required amount of time to skip the animation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed all the previous pumps. However, I couldn't change this pumpAndSettle to even pump(Duration(seconds: 100)) to pass the test. It'll pass with await tester.pump(); await tester.pump(Duration(seconds: 1)); though. Is this a bug or an expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've also added the first pump back in the newest patch. Otherwise, the "COPY/CUT/PASTE" will appear in a different order which causes a golden image mismatch (see attached images). Is this also an expected behavior?
text_field_opacity_test 0 0
text_field_opacity_test 0 0 original

Copy link
Contributor

Choose a reason for hiding this comment

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

No idea why the order would change...

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you still have pumpAndSettle?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's significantly preferred to use pump than pumpAndSettle, because pumpAndSettle will mask regressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to pump.

Copy link
Contributor

Choose a reason for hiding this comment

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

One suggestion is to capture the return value of pumpAndSettle and expect the result of it (or expect that it's less than some sane value).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess the regression that @Hixie mentioned is about the regression in seconds (e.g., the animation should finish in 1 second but a regression made it 10 seconds). I'm not sure if the return value of pumpAndSettle would catch that. What's your thought, @Hixie ?

Copy link
Contributor

Choose a reason for hiding this comment

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

The return value would catch it but it's more likely that someone fixing it will just change the number and it's more likely that a reviewer will fail to notice that.

liyuqian added a commit to flutter/engine that referenced this pull request Apr 17, 2019
To catch issues like flutter/flutter#30586

flutter/flutter#31097 will trigger this CHECK
if #8467 were reverted and the
transform_ were not initialized in this PR.
@liyuqian
Copy link
Contributor Author

Ping...

As we've introduced offset to the Opacity layer, we have to override
`applyTransform` to make Leader/FollowerLayer work correctly.

Fixes flutter#30587

Together with flutter/engine#8585,
this test will also exercise test against
flutter#30586.
Otherwise, the order of "COPY/CUT/PASTE" will be somehow different and
it'll cause a golden image mismatch.
@liyuqian liyuqian force-pushed the opacity_text_field_test branch from 324c26a to e94307c Compare April 18, 2019 17:24
assert(transform != null);
transform.translate(offset.dx, offset.dy);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@liyuqian liyuqian requested review from dnfield and goderbauer April 23, 2019 23:53
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

find.byType(Overlay),
matchesGoldenFile('text_field_opacity_test.0.0.png'),
);
}, skip: !Platform.isLinux);
Copy link
Member

Choose a reason for hiding this comment

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

Do you really want to skip the entire test on all non-linux platforms? Or just the golden check? In the later, I'd recommend putting the skip on "expectLater". (It looks like everything else should also work on other platforms?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Fixed.

@liyuqian liyuqian merged commit e427c2d into flutter:master Apr 29, 2019
@jonahwilliams
Copy link
Contributor

This is breaking several devicelab tasks, and failing a golden check. Do these need to be updated, or were they unexpected? cc @liyuqian

jonahwilliams pushed a commit that referenced this pull request Apr 29, 2019
liyuqian added a commit to liyuqian/flutter that referenced this pull request Apr 29, 2019
liyuqian added a commit that referenced this pull request Apr 30, 2019
@liyuqian liyuqian deleted the opacity_text_field_test branch May 1, 2019 22:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextField inside Opacity has wrong selection Leader/Follower transformation

6 participants