forked from firka/flutter
Add test where white text on white background fails contrast. (#110217)
This commit is contained in:
@@ -43,6 +43,40 @@ void main() {
|
||||
handle.dispose();
|
||||
});
|
||||
|
||||
testWidgets('White text on white background fails contrast test',
|
||||
(WidgetTester tester) async {
|
||||
final SemanticsHandle handle = tester.ensureSemantics();
|
||||
await tester.pumpWidget(
|
||||
_boilerplate(
|
||||
Container(
|
||||
width: 200.0,
|
||||
height: 300.0,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: const <Widget>[
|
||||
Text(
|
||||
'this is a white text',
|
||||
style: TextStyle(fontSize: 14.0, color: Colors.white),
|
||||
),
|
||||
SizedBox(height: 50),
|
||||
Text(
|
||||
'this is a black text test1',
|
||||
style: TextStyle(fontSize: 14.0, color: Colors.black),
|
||||
),
|
||||
SizedBox(height: 50),
|
||||
Text(
|
||||
'this is a black text test2',
|
||||
style: TextStyle(fontSize: 14.0, color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await expectLater(tester, doesNotMeetGuideline(textContrastGuideline));
|
||||
handle.dispose();
|
||||
});
|
||||
|
||||
const Color surface = Color(0xFFF0F0F0);
|
||||
|
||||
/// Shades of blue with contrast ratio of 2.9, 4.4, 4.5 from [surface].
|
||||
|
||||
Reference in New Issue
Block a user