Unverified Commit f38244f0 authored by Matan Lurey's avatar Matan Lurey Committed by GitHub

Relaxed a test on `Paint.toString()` to ignore `dither: ...`. (#136302)

Work towards https://github.com/flutter/flutter/issues/112498.

Behaviorally the same, except doesn't care if `dither: ...` shows up, or
not (it won't when https://github.com/flutter/flutter/issues/112498 is
fixed).
parent a7edafe7
...@@ -450,13 +450,6 @@ void main() { ...@@ -450,13 +450,6 @@ void main() {
}); });
test('backgroundColor', () { 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(); const TextStyle s1 = TextStyle();
expect(s1.backgroundColor, isNull); expect(s1.backgroundColor, isNull);
expect(s1.toString(), 'TextStyle(<all styles inherited>)'); expect(s1.toString(), 'TextStyle(<all styles inherited>)');
...@@ -467,15 +460,14 @@ void main() { ...@@ -467,15 +460,14 @@ void main() {
final ui.TextStyle ts2 = s2.getTextStyle(); final ui.TextStyle ts2 = s2.getTextStyle();
// TODO(matanlurey): Remove when https://github.com/flutter/flutter/issues/133698 is resolved. // TODO(matanlurey): Remove when https://github.com/flutter/flutter/issues/112498 is resolved.
// There are 5+ implementations of Paint, so we should either align the toString() or stop // The web implementation never includes "dither: ..." as a property, and after #112498 neither
// testing it, IMO. // does non-web (as there will no longer be a user-visible "dither" property). So, relax the
if (kIsWeb) { // test to just check for the color by using a regular expression.
// The web implementation never includes "dither: ..." as a property. expect(
expect(ts2.toString(), contains('background: Paint(Color(0xff00ff00))')); ts2.toString(),
} else { matches(RegExp(r'background: Paint\(Color\(0xff00ff00\).*\)')),
expect(ts2.toString(), contains('background: Paint(Color(0xff00ff00); dither: true)')); );
}
}); });
test('TextStyle background and backgroundColor combos', () { test('TextStyle background and backgroundColor combos', () {
......
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