forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and test SemanticsController.simulatedAccessibilityTraversal (#14…
…3386) Fixes flutter/flutter#143173 The `start` and `end` parameters of `SemanticsController.simulatedAccessibilityTraversal` were deprecated in flutter/flutter#112413, but no tests were added that verified the new API. ð��³ This change - fixes a typo in an error message - fixes the new `startNode` and `endNode` not being accounted for in setting the traversal range - adds dart fixes for the deprecations - adds tests for the new API that is meant to replace the deprecated one. - Filed flutter/flutter#143405 to follow up on the new API not working in multiple views.
- Loading branch information
Showing
5 changed files
with
270 additions
and
28 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
packages/flutter_test/lib/fix_data/fix_flutter_test/fix_semantics_controller.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Copyright 2014 The Flutter Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# For details regarding the *Flutter Fix* feature, see | ||
# https://flutter.dev/docs/development/tools/flutter-fix | ||
|
||
# Please add new fixes to the top of the file, separated by one blank line | ||
# from other fixes. In a comment, include a link to the PR where the change | ||
# requiring the fix was made. | ||
|
||
# Every fix must be tested. See the | ||
# flutter/packages/flutter_test/test_fixes/README.md file for instructions | ||
# on testing these data driven fixes. | ||
|
||
# For documentation about this file format, see | ||
# https://dart.dev/go/data-driven-fixes. | ||
|
||
# * Fixes in this file are for the flutter_test/controller.dart file. * | ||
|
||
version: 1 | ||
transforms: | ||
# Changes made in TBD | ||
- title: "Migrate to startNode and endNode." | ||
date: 2024-02-13 | ||
element: | ||
uris: [ 'flutter_test.dart' ] | ||
method: simulatedAccessibilityTraversal | ||
inClass: SemanticsController | ||
oneOf: | ||
- if: "start != '' && end != ''" | ||
changes: | ||
- kind: 'addParameter' | ||
index: 2 | ||
name: 'startNode' | ||
style: optional_named | ||
argumentValue: | ||
expression: '{% start %}' | ||
requiredIf: "start != '' && end != ''" | ||
- kind: 'addParameter' | ||
index: 3 | ||
name: 'endNode' | ||
style: optional_named | ||
argumentValue: | ||
expression: '{% end %}' | ||
requiredIf: "start != '' && end != ''" | ||
- kind: 'removeParameter' | ||
name: 'start' | ||
- kind: 'removeParameter' | ||
name: 'end' | ||
- if: "start != '' && end == ''" | ||
changes: | ||
- kind: 'addParameter' | ||
index: 2 | ||
name: 'startNode' | ||
style: optional_named | ||
argumentValue: | ||
expression: '{% start %}' | ||
requiredIf: "start != '' && end == ''" | ||
- kind: 'removeParameter' | ||
name: 'start' | ||
- if: "start == '' && end != ''" | ||
changes: | ||
- kind: 'addParameter' | ||
index: 2 | ||
name: 'endNode' | ||
style: optional_named | ||
argumentValue: | ||
expression: '{% end %}' | ||
requiredIf: "start == '' && end != ''" | ||
- kind: 'removeParameter' | ||
name: 'end' | ||
variables: | ||
start: | ||
kind: 'fragment' | ||
value: 'arguments[start]' | ||
end: | ||
kind: 'fragment' | ||
value: 'arguments[end]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/flutter_test/test_fixes/flutter_test/semantics_controller.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
// Generic reference variables. | ||
finders.FinderBase<Element> theStart; | ||
finders.FinderBase<Element> theEnd; | ||
|
||
testWidgets('simulatedAccessibilityTraversal', (WidgetTester tester) async { | ||
// Changes made in https://github.com/flutter/flutter/pull/143386 | ||
tester.semantics.simulatedAccessibilityTraversal(); | ||
tester.semantics.simulatedAccessibilityTraversal(start: theStart); | ||
tester.semantics.simulatedAccessibilityTraversal(end: theEnd); | ||
tester.semantics.simulatedAccessibilityTraversal(start: theStart, end: theEnd); | ||
}); | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/flutter_test/test_fixes/flutter_test/semantics_controller.dart.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
// Generic reference variables. | ||
finders.FinderBase<Element> theStart; | ||
finders.FinderBase<Element> theEnd; | ||
|
||
testWidgets('simulatedAccessibilityTraversal', (WidgetTester tester) async { | ||
// Changes made in https://github.com/flutter/flutter/pull/143386 | ||
tester.semantics.simulatedAccessibilityTraversal(); | ||
tester.semantics.simulatedAccessibilityTraversal(startNode: theStart); | ||
tester.semantics.simulatedAccessibilityTraversal(endNode: theEnd); | ||
tester.semantics.simulatedAccessibilityTraversal(startNode: theStart, endNode: theEnd); | ||
}); | ||
} |