Unverified Commit bac4d839 authored by Yegor's avatar Yegor Committed by GitHub

[web] prepare for https://github.com/flutter/engine/pull/49786 (#141700)

Skip incorrect expectations in preparation for https://github.com/flutter/engine/pull/49786.

Bonus: improved error message when text style test fails
parent 8286f499
...@@ -329,8 +329,10 @@ void main() { ...@@ -329,8 +329,10 @@ void main() {
expect(paint.color, const Color(0x7F000000)); // 0.5 opacity expect(paint.color, const Color(0x7F000000)); // 0.5 opacity
expect(paint.filterQuality, FilterQuality.high); expect(paint.filterQuality, FilterQuality.high);
expect(paint.isAntiAlias, true); expect(paint.isAntiAlias, true);
// TODO(craiglabenz): change to true when https://github.com/flutter/flutter/issues/88909 is fixed // TODO(yjbanov): remove kIsWeb when https://github.com/flutter/engine/pull/49786 rolls in
expect(paint.invertColors, !kIsWeb || isCanvasKit); if (!kIsWeb) {
expect(paint.invertColors, isTrue);
}
}); });
test('DecorationImage.toString', () async { test('DecorationImage.toString', () async {
......
...@@ -30,8 +30,7 @@ class _DartUiTextStyleToStringMatcher extends Matcher { ...@@ -30,8 +30,7 @@ class _DartUiTextStyleToStringMatcher extends Matcher {
_propertyToString('letterSpacing', textStyle.letterSpacing), _propertyToString('letterSpacing', textStyle.letterSpacing),
_propertyToString('wordSpacing', textStyle.wordSpacing), _propertyToString('wordSpacing', textStyle.wordSpacing),
_propertyToString('height', textStyle.height), _propertyToString('height', textStyle.height),
// TODO(LongCatIsLooong): web support for // TODO(yjbanov): remove kIsWeb when https://github.com/flutter/engine/pull/49786 rolls in
// https://github.com/flutter/flutter/issues/72521
if (!kIsWeb) _propertyToString('leadingDistribution', textStyle.leadingDistribution), if (!kIsWeb) _propertyToString('leadingDistribution', textStyle.leadingDistribution),
_propertyToString('locale', textStyle.locale), _propertyToString('locale', textStyle.locale),
_propertyToString('background', textStyle.background), _propertyToString('background', textStyle.background),
...@@ -74,12 +73,15 @@ class _DartUiTextStyleToStringMatcher extends Matcher { ...@@ -74,12 +73,15 @@ class _DartUiTextStyleToStringMatcher extends Matcher {
@override @override
Description describeMismatch(dynamic item, Description mismatchDescription, Map<dynamic, dynamic> matchState, bool verbose) { Description describeMismatch(dynamic item, Description mismatchDescription, Map<dynamic, dynamic> matchState, bool verbose) {
final Description description = super.describeMismatch(item, mismatchDescription, matchState, verbose); final Description description = super.describeMismatch(item, mismatchDescription, matchState, verbose);
final String itemAsString = item.toString();
final String? property = matchState['missingProperty'] as String?; final String? property = matchState['missingProperty'] as String?;
if (property != null) { if (property != null) {
description.add("expect property: '$property'"); description.add("expect property: '$property'");
final int propertyIndex = propertiesInOrder.indexOf(property); final int propertyIndex = propertiesInOrder.indexOf(property);
if (propertyIndex > 0) { if (propertyIndex > 0) {
description.add(" after: '${propertiesInOrder[propertyIndex - 1]}'"); final String lastProperty = propertiesInOrder[propertyIndex - 1];
description.add(" after: '$lastProperty'\n");
description.add('but found: ${itemAsString.substring(itemAsString.indexOf(lastProperty))}');
} }
description.add('\n'); description.add('\n');
} }
......
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