Unverified Commit 8a01c9b7 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Use toStringAsFixed in DecorationImage.toString (#131026)

This makes the output less sensitive on JS int vs double shenanigans.
parent c53cfc55
...@@ -236,8 +236,8 @@ class DecorationImage { ...@@ -236,8 +236,8 @@ class DecorationImage {
'$repeat', '$repeat',
if (matchTextDirection) if (matchTextDirection)
'match text direction', 'match text direction',
'scale $scale', 'scale ${scale.toStringAsFixed(1)}',
'opacity $opacity', 'opacity ${opacity.toStringAsFixed(1)}',
'$filterQuality', '$filterQuality',
if (invertColors) if (invertColors)
'invert colors', 'invert colors',
......
...@@ -333,6 +333,19 @@ void main() { ...@@ -333,6 +333,19 @@ void main() {
expect(paint.invertColors, !kIsWeb); expect(paint.invertColors, !kIsWeb);
}); });
test('DecorationImage.toString', () async {
expect(
DecorationImage(
image: SynchronousTestImageProvider(
await createTestImage(width: 100, height: 100),
),
opacity: 0.99,
scale: 2.01,
).toString(),
'DecorationImage(SynchronousTestImageProvider(), Alignment.center, scale 2.0, opacity 1.0, FilterQuality.low)',
);
});
test('DecorationImage with null textDirection configuration should throw Error', () async { test('DecorationImage with null textDirection configuration should throw Error', () async {
const ColorFilter colorFilter = ui.ColorFilter.mode(Color(0xFF00FF00), BlendMode.src); const ColorFilter colorFilter = ui.ColorFilter.mode(Color(0xFF00FF00), BlendMode.src);
final ui.Image image = await createTestImage(width: 100, height: 100); final ui.Image image = await createTestImage(width: 100, height: 100);
......
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