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
a832a720
Unverified
Commit
a832a720
authored
Oct 19, 2022
by
Justin McCandless
Committed by
GitHub
Oct 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle privatecommand messages that pass no data (#112590)
Fixes an error in some text editors.
parent
8815f60a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
text_input.dart
packages/flutter/lib/src/services/text_input.dart
+3
-1
text_input_test.dart
packages/flutter/test/services/text_input_test.dart
+29
-1
No files found.
packages/flutter/lib/src/services/text_input.dart
View file @
a832a720
...
...
@@ -1877,7 +1877,9 @@ class TextInput {
final
Map
<
String
,
dynamic
>
firstArg
=
args
[
1
]
as
Map
<
String
,
dynamic
>;
_currentConnection
!.
_client
.
performPrivateCommand
(
firstArg
[
'action'
]
as
String
,
firstArg
[
'data'
]
as
Map
<
String
,
dynamic
>,
firstArg
[
'data'
]
==
null
?
<
String
,
dynamic
>{}
:
firstArg
[
'data'
]
as
Map
<
String
,
dynamic
>,
);
break
;
case
'TextInputClient.updateFloatingCursor'
:
...
...
packages/flutter/test/services/text_input_test.dart
View file @
a832a720
...
...
@@ -562,6 +562,32 @@ void main() {
expect
(
client
.
latestMethodCall
,
'performPrivateCommand'
);
});
test
(
'TextInputClient performPrivateCommand method is called with no data at all'
,
()
async
{
// Assemble a TextInputConnection so we can verify its change in state.
final
FakeTextInputClient
client
=
FakeTextInputClient
(
TextEditingValue
.
empty
);
const
TextInputConfiguration
configuration
=
TextInputConfiguration
();
TextInput
.
attach
(
client
,
configuration
);
expect
(
client
.
latestMethodCall
,
isEmpty
);
// Send performPrivateCommand message.
final
ByteData
?
messageBytes
=
const
JSONMessageCodec
().
encodeMessage
(<
String
,
dynamic
>{
'args'
:
<
dynamic
>[
1
,
jsonDecode
(
'{"action": "actionCommand"}'
),
// No `data` parameter.
],
'method'
:
'TextInputClient.performPrivateCommand'
,
});
await
ServicesBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
'flutter/textinput'
,
messageBytes
,
(
ByteData
?
_
)
{},
);
expect
(
client
.
latestMethodCall
,
'performPrivateCommand'
);
expect
(
client
.
latestPrivateCommandData
,
<
String
,
dynamic
>{});
});
test
(
'TextInputClient showAutocorrectionPromptRect method is called'
,
()
async
{
// Assemble a TextInputConnection so we can verify its change in state.
final
FakeTextInputClient
client
=
FakeTextInputClient
(
TextEditingValue
.
empty
);
...
...
@@ -933,6 +959,7 @@ class FakeTextInputClient with TextInputClient {
String
latestMethodCall
=
''
;
final
List
<
String
>
performedSelectors
=
<
String
>[];
late
Map
<
String
,
dynamic
>?
latestPrivateCommandData
;
@override
TextEditingValue
currentTextEditingValue
;
...
...
@@ -946,8 +973,9 @@ class FakeTextInputClient with TextInputClient {
}
@override
void
performPrivateCommand
(
String
action
,
Map
<
String
,
dynamic
>
data
)
{
void
performPrivateCommand
(
String
action
,
Map
<
String
,
dynamic
>
?
data
)
{
latestMethodCall
=
'performPrivateCommand'
;
latestPrivateCommandData
=
data
;
}
@override
...
...
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