From 31600c829e8dc821a72e19e001651b75f2970d35 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 30 Aug 2023 15:29:05 -0700 Subject: [PATCH] Forward-fix a test that will break with an engine roll. (#133619) See https://github.com/flutter/engine/pull/44705 where it fails a framework smoke test. Partial work towards https://github.com/flutter/flutter/issues/112498. --- .../flutter/test/painting/text_style_test.dart | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index 1658eb59137e..6480a7f82264 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart @@ -450,6 +450,13 @@ void main() { }); test('backgroundColor', () { + // TODO(matanlurey): Remove when https://github.com/flutter/engine/pull/44705 rolls into the framework. + // Currently, dithering is disabled by default, but it's about to be flipped (enabled by default), + // and deprecated. This avoids #44705 causing a breakage in this test. + // + // ignore: deprecated_member_use + Paint.enableDithering = true; + const TextStyle s1 = TextStyle(); expect(s1.backgroundColor, isNull); expect(s1.toString(), 'TextStyle()'); @@ -459,7 +466,16 @@ void main() { expect(s2.toString(), 'TextStyle(inherit: true, backgroundColor: Color(0xff00ff00))'); final ui.TextStyle ts2 = s2.getTextStyle(); - expect(ts2.toString(), contains('background: Paint(Color(0xff00ff00))')); + + // TODO(matanlurey): Remove when https://github.com/flutter/flutter/issues/133698 is resolved. + // There are 5+ implementations of Paint, so we should either align the toString() or stop + // testing it, IMO. + if (kIsWeb) { + // The web implementation never includes "dither: ..." as a property. + expect(ts2.toString(), contains('background: Paint(Color(0xff00ff00))')); + } else { + expect(ts2.toString(), contains('background: Paint(Color(0xff00ff00); dither: true)')); + } }); test('TextStyle background and backgroundColor combos', () {