-
Notifications
You must be signed in to change notification settings - Fork 246
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
Demonstrate issue where SuperTextFieldInspector.findScrollOffset()
value is incorrect
#2256
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,6 +272,7 @@ void main() { | |
var textTop = tester.getTopRight(find.byType(SuperTextField)).dy; | ||
var viewportTop = tester.getTopRight(find.byType(SuperText)).dy; | ||
expect(textTop, moreOrLessEquals(viewportTop)); | ||
expect(SuperTextFieldInspector.findScrollOffset(), 0.0); | ||
|
||
// Scroll down to reveal the last line of text. | ||
await tester.drag(find.byType(SuperTextField), const Offset(0, -1000.0)); | ||
|
@@ -281,6 +282,10 @@ void main() { | |
var textBottom = tester.getBottomRight(find.byType(SuperTextField)).dy; | ||
var viewportBottom = tester.getBottomRight(find.byType(SuperText)).dy; | ||
expect(textBottom, moreOrLessEquals(viewportBottom)); | ||
// Since the scrollable content is taller than the viewport, and since | ||
// the bottom of the text field is aligned with the bottom of the | ||
// viewport, the scroll offset should be greater than 0. | ||
expect(SuperTextFieldInspector.findScrollOffset(), greaterThan(0.0)); | ||
|
||
// Scroll back up to the top of the text field. | ||
await tester.drag(find.byType(SuperTextField), const Offset(0, 1000.0)); | ||
|
@@ -290,6 +295,7 @@ void main() { | |
textTop = tester.getTopRight(find.byType(SuperTextField)).dy; | ||
viewportTop = tester.getTopRight(find.byType(SuperText)).dy; | ||
expect(textTop, moreOrLessEquals(viewportTop)); | ||
expect(SuperTextFieldInspector.findScrollOffset(), 0.0); | ||
}); | ||
|
||
testWidgetsOnDesktop("multi-line is vertically scrollable when text spans more lines than maxLines", (tester) async { | ||
|
@@ -314,6 +320,7 @@ void main() { | |
var textTop = tester.getTopRight(find.byType(SuperTextField)).dy; | ||
var viewportTop = tester.getTopRight(find.byType(SuperText)).dy; | ||
expect(textTop, moreOrLessEquals(viewportTop)); | ||
expect(SuperTextFieldInspector.findScrollOffset(), 0.0); | ||
|
||
// Scroll down to reveal the last line of text. | ||
await tester.drag( | ||
|
@@ -327,6 +334,10 @@ void main() { | |
var textBottom = tester.getBottomRight(find.byType(SuperTextField)).dy; | ||
var viewportBottom = tester.getBottomRight(find.byType(SuperText)).dy; | ||
expect(textBottom, moreOrLessEquals(viewportBottom)); | ||
// Issue is not present on desktop, further leading me to think that the | ||
// issue is somehow related to that comment about the scroll offsets | ||
// being out of sync in the mobile scroll view. | ||
expect(SuperTextFieldInspector.findScrollOffset(), greaterThan(0.0)); | ||
Comment on lines
+337
to
+340
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Desktop equivalents pass (so the value is > 0) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Printed the actual value here as 20, which makes sense considering we have a scrollable of height 40 with content of height 60 |
||
|
||
// Scroll back up to the top of the text field. | ||
await tester.drag( | ||
|
@@ -340,6 +351,7 @@ void main() { | |
textTop = tester.getTopRight(find.byType(SuperTextField)).dy; | ||
viewportTop = tester.getTopRight(find.byType(SuperText)).dy; | ||
expect(textTop, moreOrLessEquals(viewportTop)); | ||
expect(SuperTextFieldInspector.findScrollOffset(), 0.0); | ||
}); | ||
}); | ||
} | ||
|
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.
Part of the test:
And for both Android and iOS, the test fails because the value for
SuperTextFieldInspector.findScrollOffset()
is 0