-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Specify widget height in EditableText shortcuts tests #98607
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@@ -69,6 +69,7 @@ void main() { | |||
child: SizedBox( |
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.
unrelated to this PR, but maybe you can fix it nonetheless: I just notices that this fail is named incorrectly. It should end in _test.dart
instead of _tests.dart
. Could you maybe rename 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.
(I wonder if that naming problem actually means that this test doesn't run as part of our CI)
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.
Right, this would explain why this wasn't caught before. As far as I can tell this should have started failing after #97446 (before that TextPainter's line metrics cache wasn't cleared and as a result vertical runs could be jumping to incorrect offsets).
It appears to be the only file with "_tests" instead of "_test" in the name:
% find . -name "*_tests.dart"
./test/widgets/editable_text_shortcuts_tests.dart
Let me change it and update the PR.
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.
Another interesting fact is that since vertical runs rely on the line metrics cache which will get emptied on each getMin/MaxIntrinsic*()
call, they won't work in EditableText
widgets that don't have fixed width+height (each vertical run will be invalidated on widget update right after the caret moves). That is to say, the cursor will move up/down but perhaps not to the horizontal location we'd expect.
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.
RSLGTM. But the web test failures seem legit, could you take a look?
@LongCatIsLooong I believe these should be skipped altogether on web, just like the common shortcuts tests. I've added "skip: kIsWeb". |
@@ -1796,5 +1797,5 @@ void main() { | |||
affinity: TextAffinity.upstream, | |||
)); | |||
}, variant: macOSOnly); | |||
}); | |||
}, skip: kIsWeb); // [intended] |
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.
this needs a comment saying why it is ok to skip these on web. (see other examples of this in the repository)
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.
Updated this one and other comments on "skip: kIsWeb" in the file.
EDIT: ok, just found #99036 @goderbauer
Tree issue or renaming the test file somehow triggered this? |
@goderbauer Had to merge + kick the tests with empty amend commits a few times due to some other unrelated tests failing but this should be good to go now. |
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
Fixes test issue #98592 by specifying widget height.
When manually running EditableText tests, some shortcuts tests were failing.
This was because vertical runs on up/down arrow keys were stopped due to the following:
Pre-launch Checklist
///
).