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
d1e918fa
Unverified
Commit
d1e918fa
authored
Dec 07, 2017
by
Yegor
Committed by
GitHub
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support disabling text entry emulation (#13410)
parent
bf4409f1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
0 deletions
+67
-0
keyboard_resize_test.dart
...ntegration_tests/ui/test_driver/keyboard_resize_test.dart
+1
-0
text.dart
packages/flutter_driver/lib/src/common/text.dart
+36
-0
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+9
-0
extension.dart
packages/flutter_driver/lib/src/extension/extension.dart
+12
-0
test_text_input.dart
packages/flutter_test/lib/src/test_text_input.dart
+9
-0
No files found.
dev/integration_tests/ui/test_driver/keyboard_resize_test.dart
View file @
d1e918fa
...
@@ -21,6 +21,7 @@ void main() {
...
@@ -21,6 +21,7 @@ void main() {
});
});
test
(
'Ensure keyboard dismissal resizes the view to original size'
,
()
async
{
test
(
'Ensure keyboard dismissal resizes the view to original size'
,
()
async
{
await
driver
.
setTextEntryEmulation
(
enabled:
false
);
final
SerializableFinder
heightText
=
find
.
byValueKey
(
keys
.
kHeightText
);
final
SerializableFinder
heightText
=
find
.
byValueKey
(
keys
.
kHeightText
);
await
driver
.
waitFor
(
heightText
);
await
driver
.
waitFor
(
heightText
);
...
...
packages/flutter_driver/lib/src/common/text.dart
View file @
d1e918fa
...
@@ -71,3 +71,39 @@ class EnterTextResult extends Result {
...
@@ -71,3 +71,39 @@ class EnterTextResult extends Result {
@override
@override
Map
<
String
,
dynamic
>
toJson
()
=>
const
<
String
,
String
>{};
Map
<
String
,
dynamic
>
toJson
()
=>
const
<
String
,
String
>{};
}
}
/// A Flutter Driver command that enables and disables text entry emulation.
class
SetTextEntryEmulation
extends
Command
{
/// Creates a command that enables and disables text entry emulation.
SetTextEntryEmulation
(
this
.
enabled
,
{
Duration
timeout
})
:
super
(
timeout:
timeout
);
/// Whether text entry emulation should be enabled.
final
bool
enabled
;
/// Deserializes this command from the value generated by [serialize].
SetTextEntryEmulation
.
deserialize
(
Map
<
String
,
dynamic
>
json
)
:
enabled
=
json
[
'enabled'
]
==
'true'
,
super
.
deserialize
(
json
);
@override
final
String
kind
=
'set_text_entry_emulation'
;
@override
Map
<
String
,
String
>
serialize
()
=>
super
.
serialize
()..
addAll
(<
String
,
String
>{
'enabled'
:
'
$enabled
'
,
});
}
/// The result of the [SetTextEntryEmulation] command.
class
SetTextEntryEmulationResult
extends
Result
{
/// Creates a successful result.
SetTextEntryEmulationResult
();
/// Deserializes the result from JSON.
static
SetTextEntryEmulationResult
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
new
SetTextEntryEmulationResult
();
}
@override
Map
<
String
,
dynamic
>
toJson
()
=>
const
<
String
,
String
>{};
}
packages/flutter_driver/lib/src/driver/driver.dart
View file @
d1e918fa
...
@@ -451,6 +451,15 @@ class FlutterDriver {
...
@@ -451,6 +451,15 @@ class FlutterDriver {
await
_sendCommand
(
new
EnterText
(
text
,
timeout:
timeout
));
await
_sendCommand
(
new
EnterText
(
text
,
timeout:
timeout
));
}
}
/// If `enabled` is true, enables text entry emulation via [enterText]. If
/// `enabled` is false, disables it.
///
/// By default text entry emulation is enabled.
Future
<
Null
>
setTextEntryEmulation
({
@required
bool
enabled
,
Duration
timeout
})
async
{
assert
(
enabled
!=
null
);
await
_sendCommand
(
new
SetTextEntryEmulation
(
enabled
,
timeout:
timeout
));
}
/// Sends a string and returns a string.
/// Sends a string and returns a string.
///
///
/// This enables generic communication between the driver and the application.
/// This enables generic communication between the driver and the application.
...
...
packages/flutter_driver/lib/src/extension/extension.dart
View file @
d1e918fa
...
@@ -100,6 +100,7 @@ class FlutterDriverExtension {
...
@@ -100,6 +100,7 @@ class FlutterDriverExtension {
'scrollIntoView'
:
_scrollIntoView
,
'scrollIntoView'
:
_scrollIntoView
,
'set_frame_sync'
:
_setFrameSync
,
'set_frame_sync'
:
_setFrameSync
,
'set_semantics'
:
_setSemantics
,
'set_semantics'
:
_setSemantics
,
'set_text_entry_emulation'
:
_setTextEntryEmulation
,
'tap'
:
_tap
,
'tap'
:
_tap
,
'waitFor'
:
_waitFor
,
'waitFor'
:
_waitFor
,
'waitForAbsent'
:
_waitForAbsent
,
'waitForAbsent'
:
_waitForAbsent
,
...
@@ -116,6 +117,7 @@ class FlutterDriverExtension {
...
@@ -116,6 +117,7 @@ class FlutterDriverExtension {
'scrollIntoView'
:
(
Map
<
String
,
String
>
params
)
=>
new
ScrollIntoView
.
deserialize
(
params
),
'scrollIntoView'
:
(
Map
<
String
,
String
>
params
)
=>
new
ScrollIntoView
.
deserialize
(
params
),
'set_frame_sync'
:
(
Map
<
String
,
String
>
params
)
=>
new
SetFrameSync
.
deserialize
(
params
),
'set_frame_sync'
:
(
Map
<
String
,
String
>
params
)
=>
new
SetFrameSync
.
deserialize
(
params
),
'set_semantics'
:
(
Map
<
String
,
String
>
params
)
=>
new
SetSemantics
.
deserialize
(
params
),
'set_semantics'
:
(
Map
<
String
,
String
>
params
)
=>
new
SetSemantics
.
deserialize
(
params
),
'set_text_entry_emulation'
:
(
Map
<
String
,
String
>
params
)
=>
new
SetTextEntryEmulation
.
deserialize
(
params
),
'tap'
:
(
Map
<
String
,
String
>
params
)
=>
new
Tap
.
deserialize
(
params
),
'tap'
:
(
Map
<
String
,
String
>
params
)
=>
new
Tap
.
deserialize
(
params
),
'waitFor'
:
(
Map
<
String
,
String
>
params
)
=>
new
WaitFor
.
deserialize
(
params
),
'waitFor'
:
(
Map
<
String
,
String
>
params
)
=>
new
WaitFor
.
deserialize
(
params
),
'waitForAbsent'
:
(
Map
<
String
,
String
>
params
)
=>
new
WaitForAbsent
.
deserialize
(
params
),
'waitForAbsent'
:
(
Map
<
String
,
String
>
params
)
=>
new
WaitForAbsent
.
deserialize
(
params
),
...
@@ -332,6 +334,16 @@ class FlutterDriverExtension {
...
@@ -332,6 +334,16 @@ class FlutterDriverExtension {
return
new
GetTextResult
(
text
.
data
);
return
new
GetTextResult
(
text
.
data
);
}
}
Future
<
SetTextEntryEmulationResult
>
_setTextEntryEmulation
(
Command
command
)
async
{
final
SetTextEntryEmulation
setTextEntryEmulationCommand
=
command
;
if
(
setTextEntryEmulationCommand
.
enabled
)
{
_testTextInput
.
register
();
}
else
{
_testTextInput
.
unregister
();
}
return
new
SetTextEntryEmulationResult
();
}
Future
<
EnterTextResult
>
_enterText
(
Command
command
)
async
{
Future
<
EnterTextResult
>
_enterText
(
Command
command
)
async
{
final
EnterText
enterTextCommand
=
command
;
final
EnterText
enterTextCommand
=
command
;
_testTextInput
.
enterText
(
enterTextCommand
.
text
);
_testTextInput
.
enterText
(
enterTextCommand
.
text
);
...
...
packages/flutter_test/lib/src/test_text_input.dart
View file @
d1e918fa
...
@@ -24,6 +24,15 @@ class TestTextInput {
...
@@ -24,6 +24,15 @@ class TestTextInput {
SystemChannels
.
textInput
.
setMockMethodCallHandler
(
_handleTextInputCall
);
SystemChannels
.
textInput
.
setMockMethodCallHandler
(
_handleTextInputCall
);
}
}
/// Removes this object as a mock handler for [SystemChannels.textInput].
///
/// After calling this method, the channel will exchange messages with the
/// Flutter engine. Use this with [FlutterDriver] tests that need to display
/// on-screen keyboard provided by the operating system.
void
unregister
()
{
SystemChannels
.
textInput
.
setMockMethodCallHandler
(
null
);
}
int
_client
=
0
;
int
_client
=
0
;
/// Arguments supplied to the TextInput.setClient method call.
/// 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