Unverified Commit 9d81c67a authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Pass correct physics instance to Scrollable semantics (#24416)

parent c793d43e
...@@ -527,7 +527,7 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin ...@@ -527,7 +527,7 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin
key: _scrollSemanticsKey, key: _scrollSemanticsKey,
child: result, child: result,
position: position, position: position,
allowImplicitScrolling: widget?.physics?.allowImplicitScrolling ?? false, allowImplicitScrolling: widget?.physics?.allowImplicitScrolling ?? _physics.allowImplicitScrolling,
semanticChildCount: widget.semanticChildCount, semanticChildCount: widget.semanticChildCount,
); );
} }
......
...@@ -873,6 +873,9 @@ void main() { ...@@ -873,6 +873,9 @@ void main() {
label: 'Alert', label: 'Alert',
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
label: 'The title', label: 'The title',
...@@ -883,6 +886,9 @@ void main() { ...@@ -883,6 +886,9 @@ void main() {
], ],
), ),
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[ flags: <SemanticsFlag>[
......
...@@ -92,12 +92,18 @@ void main() { ...@@ -92,12 +92,18 @@ void main() {
label: 'Alert', label: 'Alert',
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics(label: 'The Title'), TestSemantics(label: 'The Title'),
TestSemantics(label: 'Content'), TestSemantics(label: 'Content'),
], ],
), ),
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[SemanticsFlag.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
......
...@@ -788,6 +788,9 @@ void main() { ...@@ -788,6 +788,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
label: 'one', label: 'one',
......
...@@ -509,6 +509,9 @@ void main() { ...@@ -509,6 +509,9 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
......
...@@ -1465,6 +1465,7 @@ void main() { ...@@ -1465,6 +1465,7 @@ void main() {
TestSemantics( TestSemantics(
id: 3, id: 3,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 4, id: 4,
...@@ -1728,6 +1729,7 @@ void main() { ...@@ -1728,6 +1729,7 @@ void main() {
TestSemantics( TestSemantics(
id: 3, id: 3,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 4, id: 4,
......
...@@ -1990,6 +1990,7 @@ void main() { ...@@ -1990,6 +1990,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 8, id: 8,
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
actions: <SemanticsAction>[SemanticsAction.scrollLeft], actions: <SemanticsAction>[SemanticsAction.scrollLeft],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
...@@ -2050,6 +2051,7 @@ void main() { ...@@ -2050,6 +2051,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 8, id: 8,
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 4, id: 4,
......
...@@ -500,4 +500,37 @@ void main() { ...@@ -500,4 +500,37 @@ void main() {
expect(find.byType(Viewport), isNot(paints..clipRect())); expect(find.byType(Viewport), isNot(paints..clipRect()));
}); });
testWidgets('ListView.horizontal has implicit scrolling by default', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
height: 200.0,
child: ListView(
scrollDirection: Axis.horizontal,
itemExtent: 100.0,
children: <Widget>[
Container(
height: 100.0,
),
],
),
),
),
),
);
expect(tester.getSemantics(find.byType(Scrollable)), matchesSemantics(
children: <Matcher>[
matchesSemantics(
children: <Matcher>[
matchesSemantics(hasImplicitScrolling: true)
],
),
],
));
handle.dispose();
});
} }
...@@ -65,6 +65,9 @@ void main() { ...@@ -65,6 +65,9 @@ void main() {
TestSemantics( TestSemantics(
scrollIndex: 15, scrollIndex: 15,
scrollChildren: 30, scrollChildren: 30,
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -234,6 +237,9 @@ void main() { ...@@ -234,6 +237,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -360,8 +366,13 @@ void main() { ...@@ -360,8 +366,13 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
actions: <SemanticsAction>[SemanticsAction.scrollUp, flags: <SemanticsFlag>[
SemanticsAction.scrollDown], SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[
SemanticsAction.scrollUp,
SemanticsAction.scrollDown,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[SemanticsFlag.isHidden], flags: <SemanticsFlag>[SemanticsFlag.isHidden],
...@@ -492,6 +503,9 @@ void main() { ...@@ -492,6 +503,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -624,6 +638,9 @@ void main() { ...@@ -624,6 +638,9 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -760,6 +777,9 @@ void main() { ...@@ -760,6 +777,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
......
...@@ -201,6 +201,9 @@ void main() { ...@@ -201,6 +201,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
], ],
...@@ -244,6 +247,9 @@ void main() { ...@@ -244,6 +247,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -303,6 +309,9 @@ void main() { ...@@ -303,6 +309,9 @@ void main() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
], ],
......
...@@ -79,6 +79,9 @@ void _tests() { ...@@ -79,6 +79,9 @@ void _tests() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 9, id: 9,
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[SemanticsAction.scrollUp], actions: <SemanticsAction>[SemanticsAction.scrollUp],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
...@@ -222,6 +225,9 @@ void _tests() { ...@@ -222,6 +225,9 @@ void _tests() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
id: 9, id: 9,
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -327,6 +333,9 @@ void _tests() { ...@@ -327,6 +333,9 @@ void _tests() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -715,6 +724,9 @@ void _tests() { ...@@ -715,6 +724,9 @@ void _tests() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
...@@ -825,8 +837,13 @@ void _tests() { ...@@ -825,8 +837,13 @@ void _tests() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
actions: <SemanticsAction>[SemanticsAction.scrollUp, flags: <SemanticsFlag>[
SemanticsAction.scrollDown], SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[
SemanticsAction.scrollUp,
SemanticsAction.scrollDown,
],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[SemanticsFlag.isHidden], flags: <SemanticsFlag>[SemanticsFlag.isHidden],
...@@ -1031,6 +1048,9 @@ void _tests() { ...@@ -1031,6 +1048,9 @@ void _tests() {
TestSemantics( TestSemantics(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.hasImplicitScrolling,
],
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.scrollUp, SemanticsAction.scrollUp,
SemanticsAction.scrollDown, SemanticsAction.scrollDown,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment