Unverified Commit 896e5b33 authored by fzyzcjy's avatar fzyzcjy Committed by GitHub

(Test-only) Add tests for new `ImageFilter.dilate`/`ImageFilter.erode` in flutter engine (#101036)

parent b4f8d7c7
......@@ -9,6 +9,7 @@
import 'dart:typed_data';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
......@@ -29,6 +30,37 @@ void main() {
);
});
testWidgets('Image filter - dilate', (WidgetTester tester) async {
await tester.pumpWidget(
RepaintBoundary(
child: ImageFiltered(
imageFilter: ImageFilter.dilate(radiusX: 10.0, radiusY: 10.0),
child: const Placeholder(),
),
),
);
await expectLater(
find.byType(ImageFiltered),
matchesGoldenFile('image_filter_dilate.png'),
);
}, skip: kIsWeb); // https://github.com/flutter/flutter/issues/101874
testWidgets('Image filter - erode', (WidgetTester tester) async {
await tester.pumpWidget(
RepaintBoundary(
child: ImageFiltered(
// Do not erode too much, otherwise we will see nothing left.
imageFilter: ImageFilter.erode(radiusX: 1.0, radiusY: 1.0),
child: const Placeholder(strokeWidth: 4),
),
),
);
await expectLater(
find.byType(ImageFiltered),
matchesGoldenFile('image_filter_erode.png'),
);
}, skip: kIsWeb); // https://github.com/flutter/flutter/issues/101874
testWidgets('Image filter - matrix', (WidgetTester tester) async {
final ImageFilter matrix = ImageFilter.matrix(Float64List.fromList(<double>[
0.5, 0.0, 0.0, 0.0, //
......
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