Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a80ad0e1
Unverified
Commit
a80ad0e1
authored
Nov 19, 2021
by
chunhtai
Committed by
GitHub
Nov 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force the a11y focus on textfield in android semantics integration test (#93876)
parent
fb3f1237
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
+45
-2
MainActivity.java
...ava/com/yourcompany/platforminteraction/MainActivity.java
+20
-0
main.dart
...integration_tests/android_semantics_testing/lib/main.dart
+15
-0
main_test.dart
...ests/android_semantics_testing/test_driver/main_test.dart
+10
-2
No files found.
dev/integration_tests/android_semantics_testing/android/app/src/main/java/com/yourcompany/platforminteraction/MainActivity.java
View file @
a80ad0e1
...
...
@@ -27,6 +27,7 @@ import io.flutter.plugin.common.MethodChannel;
import
io.flutter.plugin.common.MethodChannel.MethodCallHandler
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
import
android.view.accessibility.AccessibilityEvent
;
import
android.view.accessibility.AccessibilityManager
;
import
android.view.accessibility.AccessibilityNodeProvider
;
import
android.view.accessibility.AccessibilityNodeInfo
;
...
...
@@ -66,6 +67,25 @@ public class MainActivity extends FlutterActivity {
result
.
success
(
convertSemantics
(
node
,
id
));
return
;
}
if
(
methodCall
.
method
.
equals
(
"sendSemanticsFocus"
))
{
Map
<
String
,
Object
>
data
=
methodCall
.
arguments
();
@SuppressWarnings
(
"unchecked"
)
Integer
id
=
(
Integer
)
data
.
get
(
"id"
);
if
(
id
==
null
)
{
result
.
error
(
"No ID provided"
,
""
,
null
);
return
;
}
if
(
provider
==
null
)
{
result
.
error
(
"Semantics not enabled"
,
""
,
null
);
return
;
}
AccessibilityEvent
event
=
AccessibilityEvent
.
obtain
(
AccessibilityEvent
.
TYPE_VIEW_FOCUSED
);
event
.
setPackageName
(
flutterView
.
getContext
().
getPackageName
());
event
.
setSource
(
flutterView
,
id
);
flutterView
.
getParent
().
requestSendAccessibilityEvent
(
flutterView
,
event
);
result
.
success
(
null
);
return
;
}
result
.
notImplemented
();
}
...
...
dev/integration_tests/android_semantics_testing/lib/main.dart
View file @
a80ad0e1
...
...
@@ -39,6 +39,21 @@ Future<String> dataHandler(String message) async {
completeSemantics
();
return
completer
.
future
;
}
if
(
message
.
contains
(
'sendSemanticsFocus'
))
{
final
Completer
<
String
>
completer
=
Completer
<
String
>();
final
int
id
=
int
.
tryParse
(
message
.
split
(
'#'
)[
1
])
??
0
;
Future
<
void
>
completeSemantics
([
Object
_
])
async
{
final
dynamic
result
=
await
kSemanticsChannel
.
invokeMethod
<
dynamic
>(
'sendSemanticsFocus'
,
<
String
,
dynamic
>{
'id'
:
id
,
});
completer
.
complete
(
json
.
encode
(
result
));
}
if
(
SchedulerBinding
.
instance
.
hasScheduledFrame
)
SchedulerBinding
.
instance
.
addPostFrameCallback
(
completeSemantics
);
else
completeSemantics
();
return
completer
.
future
;
}
throw
UnimplementedError
();
}
...
...
dev/integration_tests/android_semantics_testing/test_driver/main_test.dart
View file @
a80ad0e1
...
...
@@ -29,6 +29,11 @@ void main() {
return
AndroidSemanticsNode
.
deserialize
(
data
);
}
Future
<
void
>
sendSemanticsFocus
(
SerializableFinder
finder
)
async
{
final
int
id
=
await
driver
.
getSemanticsId
(
finder
);
await
driver
.
requestData
(
'sendSemanticsFocus#
$id
'
);
}
// The version of TalkBack running on the device.
Version
talkbackVersion
;
...
...
@@ -148,6 +153,10 @@ void main() {
matching:
find
.
byType
(
'Semantics'
),
firstMatchOnly:
true
,
);
// Make sure the focus is on the back button.
await
sendSemanticsFocus
(
find
.
byValueKey
(
backButtonKeyValue
));
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
500
));
expect
(
await
getSemantics
(
normalTextField
),
hasAndroidSemantics
(
...
...
@@ -157,8 +166,7 @@ void main() {
isFocused:
false
,
isPassword:
false
,
actions:
<
AndroidSemanticsAction
>[
if
(
talkbackVersion
<
fixedTalkback
)
AndroidSemanticsAction
.
accessibilityFocus
,
if
(
talkbackVersion
>=
fixedTalkback
)
AndroidSemanticsAction
.
clearAccessibilityFocus
,
AndroidSemanticsAction
.
accessibilityFocus
,
AndroidSemanticsAction
.
click
,
],
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment