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
5f7ef896
Unverified
Commit
5f7ef896
authored
Dec 07, 2017
by
Yegor
Committed by
GitHub
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more setTextEntryEmulation docs; isRegistered check (#13420)
parent
ed54868c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+13
-2
extension.dart
packages/flutter_driver/lib/src/extension/extension.dart
+4
-0
test_text_input.dart
packages/flutter_test/lib/src/test_text_input.dart
+8
-0
No files found.
packages/flutter_driver/lib/src/driver/driver.dart
View file @
5f7ef896
...
...
@@ -435,6 +435,9 @@ class FlutterDriver {
/// calling this method. Typically, a test would activate a widget, e.g. using
/// [tap], then call this method.
///
/// For this method to work, text emulation must be enabled (see
/// [setTextEntryEmulation]). Text emulation is enabled by default.
///
/// Example:
///
/// ```dart
...
...
@@ -452,9 +455,17 @@ class FlutterDriver {
}
/// If `enabled` is true, enables text entry emulation via [enterText]. If
/// `enabled` is false, disables it.
/// `enabled` is false, disables it. By default text entry emulation is
/// enabled.
///
/// When disabled, [enterText] will fail with a [DriverError]. When an
/// [EditableText] is focused, the operating system's configured keyboard
/// method is invoked, such as an on-screen keyboard on a phone or a tablet.
///
/// By default text entry emulation is enabled.
/// When enabled, the operating system's configured keyboard will not be
/// invoked when the widget is focused, as the [SystemChannels.textInput]
/// channel will be mocked out. In disabled mode [enterText] can be used to
/// emulate text entry.
Future
<
Null
>
setTextEntryEmulation
({
@required
bool
enabled
,
Duration
timeout
})
async
{
assert
(
enabled
!=
null
);
await
_sendCommand
(
new
SetTextEntryEmulation
(
enabled
,
timeout:
timeout
));
...
...
packages/flutter_driver/lib/src/extension/extension.dart
View file @
5f7ef896
...
...
@@ -345,6 +345,10 @@ class FlutterDriverExtension {
}
Future
<
EnterTextResult
>
_enterText
(
Command
command
)
async
{
if
(!
_testTextInput
.
isRegistered
)
{
throw
'Unable to fulfill `FlutterDriver.enterText`. Text emulation is '
'disabled. You can enable it using `FlutterDriver.setTextEntryEmulation`.'
;
}
final
EnterText
enterTextCommand
=
command
;
_testTextInput
.
enterText
(
enterTextCommand
.
text
);
return
new
EnterTextResult
();
...
...
packages/flutter_test/lib/src/test_text_input.dart
View file @
5f7ef896
...
...
@@ -22,6 +22,7 @@ class TestTextInput {
/// Installs this object as a mock handler for [SystemChannels.textInput].
void
register
()
{
SystemChannels
.
textInput
.
setMockMethodCallHandler
(
_handleTextInputCall
);
_isRegistered
=
true
;
}
/// Removes this object as a mock handler for [SystemChannels.textInput].
...
...
@@ -31,8 +32,15 @@ class TestTextInput {
/// on-screen keyboard provided by the operating system.
void
unregister
()
{
SystemChannels
.
textInput
.
setMockMethodCallHandler
(
null
);
_isRegistered
=
false
;
}
/// Whether this [TestTextInput] is registered with [SystemChannels.textInput].
///
/// Use [register] and [unregister] methods to control this value.
bool
get
isRegistered
=>
_isRegistered
;
bool
_isRegistered
=
false
;
int
_client
=
0
;
/// Arguments supplied to the TextInput.setClient method call.
...
...
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