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
ce248e87
Unverified
Commit
ce248e87
authored
Jun 13, 2023
by
Hans Muller
Committed by
GitHub
Jun 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update misc tests for Material3 (#128712)
parent
09b7e561
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
27 deletions
+65
-27
app_lifecycle_listener.1.dart
...gets/app_lifecycle_listener/app_lifecycle_listener.1.dart
+23
-24
accessibility_test.dart
packages/flutter_test/test/accessibility_test.dart
+42
-3
No files found.
examples/api/lib/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart
View file @
ce248e87
...
...
@@ -78,30 +78,29 @@ class _ApplicationExitControlState extends State<ApplicationExitControl> {
return
Center
(
child:
SizedBox
(
width:
300
,
child:
IntrinsicHeight
(
child:
Column
(
children:
<
Widget
>[
RadioListTile
<
bool
>(
title:
const
Text
(
'Do Not Allow Exit'
),
groupValue:
_shouldExit
,
value:
false
,
onChanged:
_radioChanged
,
),
RadioListTile
<
bool
>(
title:
const
Text
(
'Allow Exit'
),
groupValue:
_shouldExit
,
value:
true
,
onChanged:
_radioChanged
,
),
const
SizedBox
(
height:
30
),
ElevatedButton
(
onPressed:
_quit
,
child:
const
Text
(
'Quit'
),
),
const
SizedBox
(
height:
30
),
Text
(
'Exit Request:
$_lastExitResponse
'
),
],
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
RadioListTile
<
bool
>(
title:
const
Text
(
'Do Not Allow Exit'
),
groupValue:
_shouldExit
,
value:
false
,
onChanged:
_radioChanged
,
),
RadioListTile
<
bool
>(
title:
const
Text
(
'Allow Exit'
),
groupValue:
_shouldExit
,
value:
true
,
onChanged:
_radioChanged
,
),
const
SizedBox
(
height:
30
),
ElevatedButton
(
onPressed:
_quit
,
child:
const
Text
(
'Quit'
),
),
const
SizedBox
(
height:
30
),
Text
(
'Exit Request:
$_lastExitResponse
'
),
],
),
),
);
...
...
packages/flutter_test/test/accessibility_test.dart
View file @
ce248e87
...
...
@@ -275,11 +275,12 @@ void main() {
handle
.
dispose
();
});
testWidgets
(
'yellow text on yellow background fails with correct message'
,
testWidgets
(
'
Material2:
yellow text on yellow background fails with correct message'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
_boilerplate
(
useMaterial3:
false
,
Container
(
width:
200.0
,
height:
200.0
,
...
...
@@ -306,6 +307,38 @@ void main() {
handle
.
dispose
();
});
testWidgets
(
'Material3: yellow text on yellow background fails with correct message'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
_boilerplate
(
useMaterial3:
true
,
Container
(
width:
200.0
,
height:
200.0
,
color:
Colors
.
yellow
,
child:
const
Text
(
'this is a test'
,
style:
TextStyle
(
fontSize:
14.0
,
color:
Colors
.
yellowAccent
),
),
),
),
);
final
Evaluation
result
=
await
textContrastGuideline
.
evaluate
(
tester
);
expect
(
result
.
passed
,
false
);
expect
(
result
.
reason
,
'SemanticsNode#4(Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), '
'label: "this is a test", textDirection: ltr):
\n
'
'Expected contrast ratio of at least 4.5 but found 1.19 for a font '
'size of 14.0.
\n
'
'The computed colors was:
\n
'
'light - Color(0xfffffbfe), dark - Color(0xffffeb3b)
\n
'
'See also: https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html'
,
);
handle
.
dispose
();
});
testWidgets
(
'label without corresponding text is skipped'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
...
...
@@ -937,5 +970,11 @@ void main() {
});
}
Widget
_boilerplate
(
Widget
child
)
=>
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
child
)));
Widget
_boilerplate
(
Widget
child
,
{
bool
?
useMaterial3
})
{
return
MaterialApp
(
theme:
ThemeData
(
useMaterial3:
useMaterial3
),
home:
Scaffold
(
body:
Center
(
child:
child
),
),
);
}
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