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
e9163a1a
Unverified
Commit
e9163a1a
authored
Feb 14, 2018
by
Michael Goderbauer
Committed by
GitHub
Feb 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wire up didGainA11yFocus, didLoseA11yFocus for CustomPainter (#14711)
parent
9b48f0d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
+89
-0
custom_paint.dart
packages/flutter/lib/src/rendering/custom_paint.dart
+6
-0
custom_painter_test.dart
packages/flutter/test/widgets/custom_painter_test.dart
+83
-0
No files found.
packages/flutter/lib/src/rendering/custom_paint.dart
View file @
e9163a1a
...
...
@@ -877,6 +877,12 @@ class RenderCustomPaint extends RenderProxyBox {
if
(
properties
.
onSetSelection
!=
null
)
{
config
.
onSetSelection
=
properties
.
onSetSelection
;
}
if
(
properties
.
onDidGainAccessibilityFocus
!=
null
)
{
config
.
onDidGainAccessibilityFocus
=
properties
.
onDidGainAccessibilityFocus
;
}
if
(
properties
.
onDidLoseAccessibilityFocus
!=
null
)
{
config
.
onDidLoseAccessibilityFocus
=
properties
.
onDidLoseAccessibilityFocus
;
}
newChild
.
updateWith
(
config:
config
,
...
...
packages/flutter/test/widgets/custom_painter_test.dart
View file @
e9163a1a
...
...
@@ -316,6 +316,89 @@ void _defineTests() {
semantics
.
dispose
();
});
testWidgets
(
'Supports all actions'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
final
List
<
SemanticsAction
>
performedActions
=
<
SemanticsAction
>[];
await
tester
.
pumpWidget
(
new
CustomPaint
(
painter:
new
_PainterWithSemantics
(
semantics:
new
CustomPainterSemantics
(
key:
const
ValueKey
<
int
>(
1
),
rect:
new
Rect
.
fromLTRB
(
1.0
,
2.0
,
3.0
,
4.0
),
properties:
new
SemanticsProperties
(
onTap:
()
=>
performedActions
.
add
(
SemanticsAction
.
tap
),
onLongPress:
()
=>
performedActions
.
add
(
SemanticsAction
.
longPress
),
onScrollLeft:
()
=>
performedActions
.
add
(
SemanticsAction
.
scrollLeft
),
onScrollRight:
()
=>
performedActions
.
add
(
SemanticsAction
.
scrollRight
),
onScrollUp:
()
=>
performedActions
.
add
(
SemanticsAction
.
scrollUp
),
onScrollDown:
()
=>
performedActions
.
add
(
SemanticsAction
.
scrollDown
),
onIncrease:
()
=>
performedActions
.
add
(
SemanticsAction
.
increase
),
onDecrease:
()
=>
performedActions
.
add
(
SemanticsAction
.
decrease
),
onCopy:
()
=>
performedActions
.
add
(
SemanticsAction
.
copy
),
onCut:
()
=>
performedActions
.
add
(
SemanticsAction
.
cut
),
onPaste:
()
=>
performedActions
.
add
(
SemanticsAction
.
paste
),
onMoveCursorForwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorForwardByCharacter
),
onMoveCursorBackwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorBackwardByCharacter
),
onSetSelection:
(
TextSelection
_
)
=>
performedActions
.
add
(
SemanticsAction
.
setSelection
),
onDidGainAccessibilityFocus:
()
=>
performedActions
.
add
(
SemanticsAction
.
didGainAccessibilityFocus
),
onDidLoseAccessibilityFocus:
()
=>
performedActions
.
add
(
SemanticsAction
.
didLoseAccessibilityFocus
),
),
),
),
));
debugDumpSemanticsTree
(
DebugSemanticsDumpOrder
.
inverseHitTest
);
final
Set
<
SemanticsAction
>
allActions
=
SemanticsAction
.
values
.
values
.
toSet
()
..
remove
(
SemanticsAction
.
showOnScreen
);
// showOnScreen is non user-exposed.
const
int
expectedId
=
2
;
final
TestSemantics
expectedSemantics
=
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
new
TestSemantics
.
rootChild
(
id:
1
,
previousNodeId:
-
1
,
nextNodeId:
expectedId
,
children:
<
TestSemantics
>[
new
TestSemantics
.
rootChild
(
id:
expectedId
,
rect:
TestSemantics
.
fullScreen
,
actions:
allActions
.
fold
(
0
,
(
int
previous
,
SemanticsAction
action
)
=>
previous
|
action
.
index
),
previousNodeId:
1
,
nextNodeId:
-
1
,
),
]
),
],
);
expect
(
semantics
,
hasSemantics
(
expectedSemantics
,
ignoreRect:
true
,
ignoreTransform:
true
));
// Do the actions work?
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
;
int
expectedLength
=
1
;
for
(
SemanticsAction
action
in
allActions
)
{
switch
(
action
)
{
case
SemanticsAction
.
moveCursorBackwardByCharacter
:
case
SemanticsAction
.
moveCursorForwardByCharacter
:
semanticsOwner
.
performAction
(
expectedId
,
action
,
true
);
break
;
case
SemanticsAction
.
setSelection
:
semanticsOwner
.
performAction
(
expectedId
,
action
,
<
String
,
int
>{
'base'
:
4
,
'extent'
:
5
,
});
break
;
default
:
semanticsOwner
.
performAction
(
expectedId
,
action
);
}
expect
(
performedActions
.
length
,
expectedLength
);
expect
(
performedActions
.
last
,
action
);
expectedLength
+=
1
;
}
semantics
.
dispose
();
});
group
(
'diffing'
,
()
{
testWidgets
(
'complains about duplicate keys'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
...
...
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