Unverified Commit 98650398 authored by Ankur Jain's avatar Ankur Jain Committed by GitHub

Add test where white text on white background fails contrast. (#110217)

parent 171ddeb0
......@@ -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].
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment