Unverified Commit a67a2f62 authored by Mehmet Fidanboylu's avatar Mehmet Fidanboylu Committed by GitHub

Extract TestBorder into a utility file (#25888)

parent 8049893f
...@@ -8,7 +8,7 @@ import 'package:flutter/rendering.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
import '../widgets/shape_decoration_test.dart' show TestBorder; import '../widgets/test_border.dart' show TestBorder;
class NotifyMaterial extends StatelessWidget { class NotifyMaterial extends StatelessWidget {
@override @override
......
...@@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
import 'shape_decoration_test.dart' show TestBorder; import 'test_border.dart' show TestBorder;
final List<String> log = <String>[]; final List<String> log = <String>[];
......
...@@ -11,6 +11,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -11,6 +11,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../painting/image_data.dart'; import '../painting/image_data.dart';
import '../painting/mocks_for_image_cache.dart'; import '../painting/mocks_for_image_cache.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
import 'test_border.dart' show TestBorder;
Future<void> main() async { Future<void> main() async {
final ui.Image rawImage = await decodeImageFromList(Uint8List.fromList(kTransparentImage)); final ui.Image rawImage = await decodeImageFromList(Uint8List.fromList(kTransparentImage));
...@@ -104,34 +105,3 @@ Future<void> main() async { ...@@ -104,34 +105,3 @@ Future<void> main() async {
); );
}); });
} }
typedef Logger = void Function(String caller);
class TestBorder extends ShapeBorder {
const TestBorder(this.onLog) : assert(onLog != null);
final Logger onLog;
@override
EdgeInsetsGeometry get dimensions => const EdgeInsetsDirectional.only(start: 1.0);
@override
ShapeBorder scale(double t) => TestBorder(onLog);
@override
Path getInnerPath(Rect rect, { TextDirection textDirection }) {
onLog('getInnerPath $rect $textDirection');
return Path();
}
@override
Path getOuterPath(Rect rect, { TextDirection textDirection }) {
onLog('getOuterPath $rect $textDirection');
return Path();
}
@override
void paint(Canvas canvas, Rect rect, { TextDirection textDirection }) {
onLog('paint $rect $textDirection');
}
}
import 'package:flutter/material.dart';
typedef Logger = void Function(String caller);
class TestBorder extends ShapeBorder {
const TestBorder(this.onLog) : assert(onLog != null);
final Logger onLog;
@override
EdgeInsetsGeometry get dimensions => const EdgeInsetsDirectional.only(start: 1.0);
@override
ShapeBorder scale(double t) => TestBorder(onLog);
@override
Path getInnerPath(Rect rect, { TextDirection textDirection }) {
onLog('getInnerPath $rect $textDirection');
return Path();
}
@override
Path getOuterPath(Rect rect, { TextDirection textDirection }) {
onLog('getOuterPath $rect $textDirection');
return Path();
}
@override
void paint(Canvas canvas, Rect rect, { TextDirection textDirection }) {
onLog('paint $rect $textDirection');
}
}
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