From 3e034fce057c950fd791abfbd8feaee254428c35 Mon Sep 17 00:00:00 2001 From: Ashok Narayan Date: Fri, 6 Feb 2026 02:52:24 +0530 Subject: [PATCH] Improve accessibility contrast for pre-test message (#180469) Fixes https://github.com/flutter/flutter/issues/179181 The pre-test message "Test starting..." previously had a contrast ratio of 2.99:1 against the background, which is below the recommended 3:1 minimum for accessibility. This PR slightly adjusts the text color from 0xFF917FFF to 0xFF8F7FFF to meet the minimum contrast requirement while preserving the visual appearance. --- packages/flutter_test/lib/src/binding.dart | 2 +- .../test/pre_test_message_accessibility_test.dart | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 packages/flutter_test/test/pre_test_message_accessibility_test.dart diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index d2544ef060c..8ec53720b7a 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -1505,7 +1505,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase return announcements; } - static const TextStyle _messageStyle = TextStyle(color: Color(0xFF917FFF), fontSize: 40.0); + static const TextStyle _messageStyle = TextStyle(color: Color(0xFF8F7FFF), fontSize: 40.0); static const Widget _preTestMessage = Center( child: Text('Test starting...', style: _messageStyle, textDirection: TextDirection.ltr), diff --git a/packages/flutter_test/test/pre_test_message_accessibility_test.dart b/packages/flutter_test/test/pre_test_message_accessibility_test.dart new file mode 100644 index 00000000000..f757ed9a09d --- /dev/null +++ b/packages/flutter_test/test/pre_test_message_accessibility_test.dart @@ -0,0 +1,15 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + /// Verifies that the pre-test message shown by flutter_test + /// meets the minimum WCAG text contrast accessibility guideline. + testWidgets('pre-test message meets text contrast guideline', (WidgetTester tester) async { + // The pre-test message is already attached to the render tree by the + // TestWidgetsFlutterBinding before this test runs, so no pumpWidget is needed. + await expectLater(tester, meetsGuideline(textContrastGuideline)); + }); +}