Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Safari desktop have different scroll max values for different versions
  • Loading branch information
nturgut committed Nov 23, 2020
commit 3c3b8d26f8058ec5ee2aa7d71e92b7d92b78e4a7
17 changes: 9 additions & 8 deletions lib/web_ui/test/engine/semantics/semantics_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -523,27 +523,28 @@ void _testVerticalScrolling() {
// When there's more content than the available size the neutral scrollTop
// is greater than 0 with a maximum of 10 or 9.
int browserMaxScrollDiff = 0;
// The max scroll value is `9` for Safari Desktop and `10` for other
// The max scroll value varies between `9` and `10` for Safari desktop
// browsers.
if (browserEngine == BrowserEngine.webkit &&
operatingSystem == OperatingSystem.macOs) {
browserMaxScrollDiff = 1;
}

expect(scrollable.scrollTop, 10 - browserMaxScrollDiff);
expect(scrollable.scrollTop >= (10 - browserMaxScrollDiff), isTrue);

scrollable.scrollTop = 20;
expect(scrollable.scrollTop, 20);
expect(await idLog.first, 0);
expect(await actionLog.first, ui.SemanticsAction.scrollUp);
// Engine semantics returns scroll top back to neutral.
expect(scrollable.scrollTop, 10 - browserMaxScrollDiff);
expect(scrollable.scrollTop >= (10 - browserMaxScrollDiff), isTrue);

scrollable.scrollTop = 5;
expect(scrollable.scrollTop, 5 - browserMaxScrollDiff);
expect(scrollable.scrollTop >= (5 - browserMaxScrollDiff), isTrue);
expect(await idLog.first, 0);
expect(await actionLog.first, ui.SemanticsAction.scrollDown);
// Engine semantics returns scroll top back to neutral.
expect(scrollable.scrollTop >= (10 - browserMaxScrollDiff), isTrue);

semantics().semanticsEnabled = false;
},
Expand Down Expand Up @@ -661,7 +662,7 @@ void _testHorizontalScrolling() {
// When there's more content than the available size the neutral scrollTop
// is greater than 0 with a maximum of 10.
int browserMaxScrollDiff = 0;
// The max scroll value is `9` for Safari Desktop and `10` for other
// The max scroll value varies between `9` and `10` for Safari desktop
// browsers.
if (browserEngine == BrowserEngine.webkit &&
operatingSystem == OperatingSystem.macOs) {
Expand All @@ -674,14 +675,14 @@ void _testHorizontalScrolling() {
expect(await logger.idLog.first, 0);
expect(await logger.actionLog.first, ui.SemanticsAction.scrollLeft);
// Engine semantics returns scroll position back to neutral.
expect(scrollable.scrollLeft, 10 - browserMaxScrollDiff);
expect(scrollable.scrollLeft >= (10 - browserMaxScrollDiff), isTrue);

scrollable.scrollLeft = 5;
expect(scrollable.scrollLeft, 5 - browserMaxScrollDiff);
expect(scrollable.scrollLeft >= (5 - browserMaxScrollDiff), isTrue);
expect(await logger.idLog.first, 0);
expect(await logger.actionLog.first, ui.SemanticsAction.scrollRight);
// Engine semantics returns scroll top back to neutral.
expect(scrollable.scrollLeft, 10 - browserMaxScrollDiff);
expect(scrollable.scrollLeft >= (10 - browserMaxScrollDiff), isTrue);

semantics().semanticsEnabled = false;
},
Expand Down