Unverified Commit d36d5ae3 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

add missing trailing commas (#80995)

parent 4a79bc96
...@@ -94,12 +94,18 @@ void main() { ...@@ -94,12 +94,18 @@ void main() {
expect(AlignmentDirectional.bottomEnd.resolve(TextDirection.rtl), Alignment.bottomLeft); expect(AlignmentDirectional.bottomEnd.resolve(TextDirection.rtl), Alignment.bottomLeft);
expect(AlignmentDirectional(nonconst(1.0), 2.0), AlignmentDirectional(nonconst(1.0), 2.0)); expect(AlignmentDirectional(nonconst(1.0), 2.0), AlignmentDirectional(nonconst(1.0), 2.0));
expect(const AlignmentDirectional(1.0, 2.0), isNot(const AlignmentDirectional(2.0, 1.0))); expect(const AlignmentDirectional(1.0, 2.0), isNot(const AlignmentDirectional(2.0, 1.0)));
expect(AlignmentDirectional.centerStart.resolve(TextDirection.ltr), expect(
AlignmentDirectional.centerEnd.resolve(TextDirection.rtl)); AlignmentDirectional.centerStart.resolve(TextDirection.ltr),
expect(AlignmentDirectional.centerStart.resolve(TextDirection.ltr), AlignmentDirectional.centerEnd.resolve(TextDirection.rtl),
isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.ltr))); );
expect(AlignmentDirectional.centerEnd.resolve(TextDirection.ltr), expect(
isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.rtl))); AlignmentDirectional.centerStart.resolve(TextDirection.ltr),
isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.ltr)),
);
expect(
AlignmentDirectional.centerEnd.resolve(TextDirection.ltr),
isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.rtl)),
);
}); });
test('AlignmentGeometry.lerp ad hoc tests', () { test('AlignmentGeometry.lerp ad hoc tests', () {
......
...@@ -68,7 +68,7 @@ void main() { ...@@ -68,7 +68,7 @@ void main() {
excludes: const <Offset>[ Offset(10.0, 20.0), Offset(30.0, 40.0) ], excludes: const <Offset>[ Offset(10.0, 20.0), Offset(30.0, 40.0) ],
); );
const BeveledRectangleBorder border = BeveledRectangleBorder( const BeveledRectangleBorder border = BeveledRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0)) borderRadius: BorderRadius.all(Radius.circular(5.0)),
); );
expect(border.getOuterPath(rect), looksLikeRect); expect(border.getOuterPath(rect), looksLikeRect);
expect(border.getInnerPath(rect), looksLikeRect); expect(border.getInnerPath(rect), looksLikeRect);
......
...@@ -19,13 +19,12 @@ Future<void> main() async { ...@@ -19,13 +19,12 @@ Future<void> main() async {
Future<ImageInfo>.value(ImageInfo( Future<ImageInfo>.value(ImageInfo(
image: image, image: image,
scale: 1.0, scale: 1.0,
), )),
))); ));
await tester.idle(); await tester.idle();
expect(imageCache!.currentSize, 1); expect(imageCache!.currentSize, 1);
final ByteData message = const JSONMessageCodec().encodeMessage( final ByteData message = const JSONMessageCodec().encodeMessage(<String, dynamic>{'type': 'memoryPressure'})!;
<String, dynamic>{'type': 'memoryPressure'})!;
await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/system', message, (_) { }); await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/system', message, (_) { });
expect(imageCache!.currentSize, 0); expect(imageCache!.currentSize, 0);
}); });
......
...@@ -145,7 +145,7 @@ void main() { ...@@ -145,7 +145,7 @@ void main() {
' However, only Border and BorderDirectional classes are supported\n' ' However, only Border and BorderDirectional classes are supported\n'
' by this method.\n' ' by this method.\n'
' For a more general interpolation method, consider using\n' ' For a more general interpolation method, consider using\n'
' ShapeBorder.lerp instead.\n' ' ShapeBorder.lerp instead.\n',
)); ));
}); });
......
...@@ -101,11 +101,9 @@ void main() { ...@@ -101,11 +101,9 @@ void main() {
final BoxShadow shadow4 = BoxShadow.lerp(shadow2, shadow3, 0.5)!; final BoxShadow shadow4 = BoxShadow.lerp(shadow2, shadow3, 0.5)!;
expect(shadow4.blurRadius, equals(2.0)); expect(shadow4.blurRadius, equals(2.0));
List<BoxShadow> shadowList = BoxShadow.lerpList( List<BoxShadow> shadowList = BoxShadow.lerpList(<BoxShadow>[shadow2, shadow1], <BoxShadow>[shadow3], 0.5)!;
<BoxShadow>[shadow2, shadow1], <BoxShadow>[shadow3], 0.5)!;
expect(shadowList, equals(<BoxShadow>[shadow4, shadow1.scale(0.5)])); expect(shadowList, equals(<BoxShadow>[shadow4, shadow1.scale(0.5)]));
shadowList = BoxShadow.lerpList( shadowList = BoxShadow.lerpList(<BoxShadow>[shadow2], <BoxShadow>[shadow3, shadow1], 0.5)!;
<BoxShadow>[shadow2], <BoxShadow>[shadow3, shadow1], 0.5)!;
expect(shadowList, equals(<BoxShadow>[shadow4, shadow1.scale(0.5)])); expect(shadowList, equals(<BoxShadow>[shadow4, shadow1.scale(0.5)]));
}); });
......
...@@ -447,12 +447,11 @@ void main() { ...@@ -447,12 +447,11 @@ void main() {
}; };
const MaterialColor first = MaterialColor(0, sampleMap); const MaterialColor first = MaterialColor(0, sampleMap);
const MaterialColor second = MaterialColor(0, sampleMap); const MaterialColor second = MaterialColor(0, sampleMap);
const MaterialColor third = MaterialColor( const MaterialColor third = MaterialColor(0, <int, MaterialColor>{
0, <int, MaterialColor>{ 0: Colors.lightBlue,
0: Colors.lightBlue, 1: Colors.deepOrange,
1: Colors.deepOrange, 2: Colors.blueGrey,
2: Colors.blueGrey, });
});
expect(first == second, true); expect(first == second, true);
expect(first == third, true); expect(first == third, true);
}); });
......
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
excludes: const <Offset>[ Offset(10.0, 20.0), Offset(30.0, 40.0) ], excludes: const <Offset>[ Offset(10.0, 20.0), Offset(30.0, 40.0) ],
); );
const ContinuousRectangleBorder border = ContinuousRectangleBorder( const ContinuousRectangleBorder border = ContinuousRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0)) borderRadius: BorderRadius.all(Radius.circular(5.0)),
); );
expect(border.getOuterPath(rect), looksLikeRect); expect(border.getOuterPath(rect), looksLikeRect);
expect(border.getInnerPath(rect), looksLikeRect); expect(border.getInnerPath(rect), looksLikeRect);
......
...@@ -37,7 +37,7 @@ class SynchronousTestImageProvider extends ImageProvider<int> { ...@@ -37,7 +37,7 @@ class SynchronousTestImageProvider extends ImageProvider<int> {
@override @override
ImageStreamCompleter load(int key, DecoderCallback decode) { ImageStreamCompleter load(int key, DecoderCallback decode) {
return OneFrameImageStreamCompleter( return OneFrameImageStreamCompleter(
SynchronousFuture<ImageInfo>(TestImageInfo(key, image: image, scale: 1.0)) SynchronousFuture<ImageInfo>(TestImageInfo(key, image: image, scale: 1.0)),
); );
} }
} }
...@@ -71,7 +71,7 @@ class AsyncTestImageProvider extends ImageProvider<int> { ...@@ -71,7 +71,7 @@ class AsyncTestImageProvider extends ImageProvider<int> {
@override @override
ImageStreamCompleter load(int key, DecoderCallback decode) { ImageStreamCompleter load(int key, DecoderCallback decode) {
return OneFrameImageStreamCompleter( return OneFrameImageStreamCompleter(
Future<ImageInfo>.value(TestImageInfo(key, image: image)) Future<ImageInfo>.value(TestImageInfo(key, image: image)),
); );
} }
} }
...@@ -254,7 +254,7 @@ void main() { ...@@ -254,7 +254,7 @@ void main() {
final TestCanvas canvas = TestCanvas(); final TestCanvas canvas = TestCanvas();
const ImageConfiguration imageConfiguration = ImageConfiguration( const ImageConfiguration imageConfiguration = ImageConfiguration(
size: Size(100.0, 100.0) size: Size(100.0, 100.0),
); );
bool onChangedCalled = false; bool onChangedCalled = false;
final BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
...@@ -327,8 +327,7 @@ void main() { ...@@ -327,8 +327,7 @@ void main() {
image: SynchronousTestImageProvider(image), image: SynchronousTestImageProvider(image),
matchTextDirection: true, matchTextDirection: true,
); );
final BoxDecoration boxDecoration = BoxDecoration( final BoxDecoration boxDecoration = BoxDecoration(image: backgroundImage);
image: backgroundImage);
final BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
assert(false); assert(false);
}); });
...@@ -336,7 +335,9 @@ void main() { ...@@ -336,7 +335,9 @@ void main() {
late FlutterError error; late FlutterError error;
try { try {
boxPainter.paint(canvas, Offset.zero, const ImageConfiguration( boxPainter.paint(canvas, Offset.zero, const ImageConfiguration(
size: Size(100.0, 100.0), textDirection: null)); size: Size(100.0, 100.0),
textDirection: null,
));
} on FlutterError catch (e) { } on FlutterError catch (e) {
error = e; error = e;
} }
...@@ -354,7 +355,7 @@ void main() { ...@@ -354,7 +355,7 @@ void main() {
' DecorationImage(SynchronousTestImageProvider(),\n' ' DecorationImage(SynchronousTestImageProvider(),\n'
' Alignment.center, match text direction, scale: 1.0)\n' ' Alignment.center, match text direction, scale: 1.0)\n'
' The ImageConfiguration was:\n' ' The ImageConfiguration was:\n'
' ImageConfiguration(size: Size(100.0, 100.0))\n' ' ImageConfiguration(size: Size(100.0, 100.0))\n',
); );
}, skip: kIsWeb); }, skip: kIsWeb);
...@@ -364,7 +365,7 @@ void main() { ...@@ -364,7 +365,7 @@ void main() {
image: const SynchronousErrorTestImageProvider('threw'), image: const SynchronousErrorTestImageProvider('threw'),
onError: (dynamic error, StackTrace? stackTrace) { onError: (dynamic error, StackTrace? stackTrace) {
exception = error as String; exception = error as String;
} },
); );
backgroundImage.createPainter(() { }).paint( backgroundImage.createPainter(() { }).paint(
...@@ -662,7 +663,7 @@ void main() { ...@@ -662,7 +663,7 @@ void main() {
final DecorationImage backgroundImage = DecorationImage( final DecorationImage backgroundImage = DecorationImage(
image: SynchronousTestImageProvider(image), image: SynchronousTestImageProvider(image),
scale: 4, scale: 4,
alignment: Alignment.topLeft alignment: Alignment.topLeft,
); );
final BoxDecoration boxDecoration = BoxDecoration(image: backgroundImage); final BoxDecoration boxDecoration = BoxDecoration(image: backgroundImage);
......
...@@ -23,11 +23,15 @@ void main() { ...@@ -23,11 +23,15 @@ void main() {
expect(insets.along(Axis.horizontal), equals(16.0)); expect(insets.along(Axis.horizontal), equals(16.0));
expect(insets.along(Axis.vertical), equals(20.0)); expect(insets.along(Axis.vertical), equals(20.0));
expect(insets.inflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)), expect(
const Rect.fromLTRB(18.0, 25.0, 135.0, 156.0)); insets.inflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)),
const Rect.fromLTRB(18.0, 25.0, 135.0, 156.0),
);
expect(insets.deflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)), expect(
const Rect.fromLTRB(28.0, 39.0, 113.0, 130.0)); insets.deflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)),
const Rect.fromLTRB(28.0, 39.0, 113.0, 130.0),
);
expect(insets.inflateSize(const Size(100.0, 125.0)), const Size(116.0, 145.0)); expect(insets.inflateSize(const Size(100.0, 125.0)), const Size(116.0, 145.0));
expect(insets.deflateSize(const Size(100.0, 125.0)), const Size(84.0, 105.0)); expect(insets.deflateSize(const Size(100.0, 125.0)), const Size(84.0, 105.0));
...@@ -66,12 +70,18 @@ void main() { ...@@ -66,12 +70,18 @@ void main() {
expect(const EdgeInsetsDirectional.only(bottom: 963.25).resolve(TextDirection.rtl), const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 963.25)); expect(const EdgeInsetsDirectional.only(bottom: 963.25).resolve(TextDirection.rtl), const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 963.25));
expect(EdgeInsetsDirectional.only(), EdgeInsetsDirectional.only()); // ignore: prefer_const_constructors expect(EdgeInsetsDirectional.only(), EdgeInsetsDirectional.only()); // ignore: prefer_const_constructors
expect(const EdgeInsetsDirectional.only(top: 1.0), isNot(const EdgeInsetsDirectional.only(bottom: 1.0))); expect(const EdgeInsetsDirectional.only(top: 1.0), isNot(const EdgeInsetsDirectional.only(bottom: 1.0)));
expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), expect(
const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.rtl)); const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr),
expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.rtl),
isNot(const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.ltr))); );
expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), expect(
isNot(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.rtl))); const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr),
isNot(const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.ltr)),
);
expect(
const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr),
isNot(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.rtl)),
);
}); });
test('EdgeInsets equality', () { test('EdgeInsets equality', () {
......
...@@ -63,7 +63,7 @@ void main() { ...@@ -63,7 +63,7 @@ void main() {
expect( expect(
start.toString(), start.toString(),
equals( equals(
'FlutterLogoDecoration(textColor: Color(0xffd4f144), style: stacked)' 'FlutterLogoDecoration(textColor: Color(0xffd4f144), style: stacked)',
), ),
); );
expect( expect(
......
...@@ -801,7 +801,7 @@ void main() { ...@@ -801,7 +801,7 @@ void main() {
child: RepaintBoundary( child: RepaintBoundary(
key: painterKey, key: painterKey,
child: CustomPaint( child: CustomPaint(
painter: GradientPainter(shader, rect) painter: GradientPainter(shader, rect),
), ),
), ),
), ),
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
stream.addListener(ImageStreamListener( stream.addListener(ImageStreamListener(
(ImageInfo image, bool synchronousCall) { (ImageInfo image, bool synchronousCall) {
completer.complete(); completer.complete();
} },
)); ));
imageCache!.clearLiveImages(); imageCache!.clearLiveImages();
await completer.future; await completer.future;
......
...@@ -136,8 +136,10 @@ void main() { ...@@ -136,8 +136,10 @@ void main() {
}); });
} }
Future<Size> _resolveAndGetSize(ImageProvider imageProvider, Future<Size> _resolveAndGetSize(
{ImageConfiguration configuration = ImageConfiguration.empty}) async { ImageProvider imageProvider, {
ImageConfiguration configuration = ImageConfiguration.empty,
}) async {
final ImageStream stream = imageProvider.resolve(configuration); final ImageStream stream = imageProvider.resolve(configuration);
final Completer<Size> completer = Completer<Size>(); final Completer<Size> completer = Completer<Size>();
final ImageStreamListener listener = final ImageStreamListener listener =
......
...@@ -24,8 +24,7 @@ class TestAssetBundle extends CachingAssetBundle { ...@@ -24,8 +24,7 @@ class TestAssetBundle extends CachingAssetBundle {
@override @override
Future<ByteData> load(String key) async { Future<ByteData> load(String key) async {
if (key == 'AssetManifest.json') if (key == 'AssetManifest.json')
return ByteData.view(Uint8List.fromList( return ByteData.view(Uint8List.fromList(const Utf8Encoder().convert(_assetBundleContents)).buffer);
const Utf8Encoder().convert(_assetBundleContents)).buffer);
loadCallCount[key] = loadCallCount[key] ?? 0 + 1; loadCallCount[key] = loadCallCount[key] ?? 0 + 1;
if (key == 'one') if (key == 'one')
...@@ -43,8 +42,9 @@ void main() { ...@@ -43,8 +42,9 @@ void main() {
assetBundleMap[mainAssetPath] = <String>[]; assetBundleMap[mainAssetPath] = <String>[];
final AssetImage assetImage = AssetImage( final AssetImage assetImage = AssetImage(
mainAssetPath, mainAssetPath,
bundle: TestAssetBundle(assetBundleMap)); bundle: TestAssetBundle(assetBundleMap),
);
const ImageConfiguration configuration = ImageConfiguration.empty; const ImageConfiguration configuration = ImageConfiguration.empty;
assetImage.obtainKey(configuration) assetImage.obtainKey(configuration)
...@@ -90,12 +90,12 @@ void main() { ...@@ -90,12 +90,12 @@ void main() {
assetBundleMap[mainAssetPath] = <String>[mainAssetPath, variantPath]; assetBundleMap[mainAssetPath] = <String>[mainAssetPath, variantPath];
final TestAssetBundle testAssetBundle = TestAssetBundle( final TestAssetBundle testAssetBundle = TestAssetBundle(assetBundleMap);
assetBundleMap);
final AssetImage assetImage = AssetImage( final AssetImage assetImage = AssetImage(
mainAssetPath, mainAssetPath,
bundle: testAssetBundle); bundle: testAssetBundle,
);
// we have the exact match for this scale, let's use it // we have the exact match for this scale, let's use it
assetImage.obtainKey(ImageConfiguration.empty) assetImage.obtainKey(ImageConfiguration.empty)
...@@ -122,12 +122,12 @@ void main() { ...@@ -122,12 +122,12 @@ void main() {
assetBundleMap[mainAssetPath] = <String>[mainAssetPath]; assetBundleMap[mainAssetPath] = <String>[mainAssetPath];
final TestAssetBundle testAssetBundle = TestAssetBundle( final TestAssetBundle testAssetBundle = TestAssetBundle(assetBundleMap);
assetBundleMap);
final AssetImage assetImage = AssetImage( final AssetImage assetImage = AssetImage(
mainAssetPath, mainAssetPath,
bundle: TestAssetBundle(assetBundleMap)); bundle: TestAssetBundle(assetBundleMap),
);
assetImage.obtainKey(ImageConfiguration.empty) assetImage.obtainKey(ImageConfiguration.empty)
...@@ -138,8 +138,8 @@ void main() { ...@@ -138,8 +138,8 @@ void main() {
assetImage.obtainKey(ImageConfiguration( assetImage.obtainKey(ImageConfiguration(
bundle: testAssetBundle, bundle: testAssetBundle,
devicePixelRatio: 3.0), devicePixelRatio: 3.0,
).then(expectAsync1((AssetBundleImageKey bundleKey) { )).then(expectAsync1((AssetBundleImageKey bundleKey) {
expect(bundleKey.name, mainAssetPath); expect(bundleKey.name, mainAssetPath);
expect(bundleKey.scale, 1.0); expect(bundleKey.scale, 1.0);
})); }));
...@@ -161,18 +161,18 @@ void main() { ...@@ -161,18 +161,18 @@ void main() {
assetBundleMap[mainAssetPath] = <String>[mainAssetPath, variantPath]; assetBundleMap[mainAssetPath] = <String>[mainAssetPath, variantPath];
final TestAssetBundle testAssetBundle = TestAssetBundle( final TestAssetBundle testAssetBundle = TestAssetBundle(assetBundleMap);
assetBundleMap);
final AssetImage assetImage = AssetImage( final AssetImage assetImage = AssetImage(
mainAssetPath, mainAssetPath,
bundle: testAssetBundle); bundle: testAssetBundle,
);
// we have 1.0 and 3.0, asking for 1.5 should give // we have 1.0 and 3.0, asking for 1.5 should give
assetImage.obtainKey(ImageConfiguration( assetImage.obtainKey(ImageConfiguration(
bundle: testAssetBundle, bundle: testAssetBundle,
devicePixelRatio: deviceRatio), devicePixelRatio: deviceRatio,
).then(expectAsync1((AssetBundleImageKey bundleKey) { )).then(expectAsync1((AssetBundleImageKey bundleKey) {
expect(bundleKey.name, expectedAssetPath); expect(bundleKey.name, expectedAssetPath);
expect(bundleKey.scale, chosenAssetRatio); expect(bundleKey.scale, chosenAssetRatio);
})); }));
......
...@@ -75,7 +75,7 @@ class TestImageProvider extends ImageProvider<int> { ...@@ -75,7 +75,7 @@ class TestImageProvider extends ImageProvider<int> {
@override @override
ImageStreamCompleter load(int key, DecoderCallback decode) { ImageStreamCompleter load(int key, DecoderCallback decode) {
return OneFrameImageStreamCompleter( return OneFrameImageStreamCompleter(
SynchronousFuture<ImageInfo>(TestImageInfo(imageValue, image: image.clone())) SynchronousFuture<ImageInfo>(TestImageInfo(imageValue, image: image.clone())),
); );
} }
......
...@@ -55,8 +55,10 @@ void main() { ...@@ -55,8 +55,10 @@ void main() {
const RoundedRectangleBorder directional = RoundedRectangleBorder( const RoundedRectangleBorder directional = RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.only(topStart: Radius.circular(20)), borderRadius: BorderRadiusDirectional.only(topStart: Radius.circular(20)),
); );
expect(ShapeBorder.lerp(directional, c10, 1.0), expect(
ShapeBorder.lerp(c10, directional, 0.0)); ShapeBorder.lerp(directional, c10, 1.0),
ShapeBorder.lerp(c10, directional, 0.0),
);
}); });
test('RoundedRectangleBorder and CircleBorder', () { test('RoundedRectangleBorder and CircleBorder', () {
...@@ -86,19 +88,31 @@ void main() { ...@@ -86,19 +88,31 @@ void main() {
expect(ShapeBorder.lerp(c, ShapeBorder.lerp(r, c, 0.1), 0.1)!.getOuterPath(rect), looksLikeC); expect(ShapeBorder.lerp(c, ShapeBorder.lerp(r, c, 0.1), 0.1)!.getOuterPath(rect), looksLikeC);
expect(ShapeBorder.lerp(c, ShapeBorder.lerp(r, c, 0.1), 0.9)!.getOuterPath(rect), looksLikeR); expect(ShapeBorder.lerp(c, ShapeBorder.lerp(r, c, 0.1), 0.9)!.getOuterPath(rect), looksLikeR);
expect(ShapeBorder.lerp(r, c, 0.1).toString(), expect(
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)'); ShapeBorder.lerp(r, c, 0.1).toString(),
expect(ShapeBorder.lerp(r, c, 0.2).toString(), 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)',
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)'); );
expect(ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.9), 0.9).toString(), expect(
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)'); ShapeBorder.lerp(r, c, 0.2).toString(),
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)',
);
expect(
ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.9), 0.9).toString(),
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)',
);
expect(ShapeBorder.lerp(c, r, 0.9).toString(), expect(
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)'); ShapeBorder.lerp(c, r, 0.9).toString(),
expect(ShapeBorder.lerp(c, r, 0.8).toString(), 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)',
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)'); );
expect(ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.9), ShapeBorder.lerp(r, c, 0.1), 0.1).toString(), expect(
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)'); ShapeBorder.lerp(c, r, 0.8).toString(),
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)',
);
expect(
ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.9), ShapeBorder.lerp(r, c, 0.1), 0.1).toString(),
'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)',
);
expect(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.1)); expect(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.1));
expect(ShapeBorder.lerp(r, c, 0.1).hashCode, ShapeBorder.lerp(r, c, 0.1).hashCode); expect(ShapeBorder.lerp(r, c, 0.1).hashCode, ShapeBorder.lerp(r, c, 0.1).hashCode);
......
...@@ -74,19 +74,31 @@ void main() { ...@@ -74,19 +74,31 @@ void main() {
expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.1)!.getOuterPath(rect), looksLikeC); expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.1)!.getOuterPath(rect), looksLikeC);
expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.9)!.getOuterPath(rect), looksLikeS); expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.9)!.getOuterPath(rect), looksLikeS);
expect(ShapeBorder.lerp(stadium, circle, 0.1).toString(), expect(
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)'); ShapeBorder.lerp(stadium, circle, 0.1).toString(),
expect(ShapeBorder.lerp(stadium, circle, 0.2).toString(), 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)',
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)'); );
expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.9).toString(), expect(
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)'); ShapeBorder.lerp(stadium, circle, 0.2).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)',
expect(ShapeBorder.lerp(circle, stadium, 0.9).toString(), );
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)'); expect(
expect(ShapeBorder.lerp(circle, stadium, 0.8).toString(), ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.9).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)'); 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)',
expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), ShapeBorder.lerp(stadium, circle, 0.1), 0.1).toString(), );
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)');
expect(
ShapeBorder.lerp(circle, stadium, 0.9).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)',
);
expect(
ShapeBorder.lerp(circle, stadium, 0.8).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)',
);
expect(
ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), ShapeBorder.lerp(stadium, circle, 0.1), 0.1).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)',
);
expect(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.1)); expect(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.1));
expect(ShapeBorder.lerp(stadium, circle, 0.1).hashCode, ShapeBorder.lerp(stadium, circle, 0.1).hashCode); expect(ShapeBorder.lerp(stadium, circle, 0.1).hashCode, ShapeBorder.lerp(stadium, circle, 0.1).hashCode);
...@@ -141,25 +153,37 @@ void main() { ...@@ -141,25 +153,37 @@ void main() {
expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.1)!.getOuterPath(rect), looksLikeS); expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.1)!.getOuterPath(rect), looksLikeS);
expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.9)!.getOuterPath(rect), looksLikeS); expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.9)!.getOuterPath(rect), looksLikeS);
expect(ShapeBorder.lerp(stadium, rrect, 0.1).toString(), expect(
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' ShapeBorder.lerp(stadium, rrect, 0.1).toString(),
'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)'); 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), '
expect(ShapeBorder.lerp(stadium, rrect, 0.2).toString(), 'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)',
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' );
'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)'); expect(
expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(), ShapeBorder.lerp(stadium, rrect, 0.2).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), '
'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)'); 'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)',
);
expect(ShapeBorder.lerp(rrect, stadium, 0.9).toString(), expect(
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(),
'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)'); 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), '
expect(ShapeBorder.lerp(rrect, stadium, 0.8).toString(), 'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)',
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' );
'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)');
expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(), expect(
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' ShapeBorder.lerp(rrect, stadium, 0.9).toString(),
'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)'); 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), '
'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)',
);
expect(
ShapeBorder.lerp(rrect, stadium, 0.8).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), '
'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)',
);
expect(
ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(),
'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), '
'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)',
);
expect(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.1)); expect(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.1));
expect(ShapeBorder.lerp(stadium, rrect, 0.1).hashCode, ShapeBorder.lerp(stadium, rrect, 0.1).hashCode); expect(ShapeBorder.lerp(stadium, rrect, 0.1).hashCode, ShapeBorder.lerp(stadium, rrect, 0.1).hashCode);
......
...@@ -72,7 +72,7 @@ void main() { ...@@ -72,7 +72,7 @@ void main() {
' TextSpan:\n' ' TextSpan:\n'
' (empty)\n' ' (empty)\n'
' TextSpan:\n' ' TextSpan:\n'
' "c"\n' ' "c"\n',
)); ));
}); });
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
); );
expect(test1.toStringDeep(), equals( expect(test1.toStringDeep(), equals(
'TextSpan:\n' 'TextSpan:\n'
' "a"\n' ' "a"\n',
)); ));
final TextSpan test2 = TextSpan( final TextSpan test2 = TextSpan(
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
'TextSpan:\n' 'TextSpan:\n'
' "a"\n' ' "a"\n'
' callbacks: enter, exit\n' ' callbacks: enter, exit\n'
' mouseCursor: SystemMouseCursor(forbidden)\n' ' mouseCursor: SystemMouseCursor(forbidden)\n',
)); ));
}); });
...@@ -335,7 +335,7 @@ void main() { ...@@ -335,7 +335,7 @@ void main() {
}, },
onExit: (PointerExitEvent event) { onExit: (PointerExitEvent event) {
logEvents.add(event); logEvents.add(event);
} },
), ),
const TextSpan( const TextSpan(
text: 'xxxxx', text: 'xxxxx',
......
...@@ -43,8 +43,7 @@ void main() { ...@@ -43,8 +43,7 @@ void main() {
// Verify that the "through" FrictionSimulation ends up at // Verify that the "through" FrictionSimulation ends up at
// endPosition and endVelocity; implies that it computed the right // endPosition and endVelocity; implies that it computed the right
// value for _drag. // value for _drag.
FrictionSimulation friction = FrictionSimulation.through( FrictionSimulation friction = FrictionSimulation.through(startPosition, endPosition, startVelocity, endVelocity);
startPosition, endPosition, startVelocity, endVelocity);
expect(friction.isDone(0.0), false); expect(friction.isDone(0.0), false);
expect(friction.x(0.0), 10.0); expect(friction.x(0.0), 10.0);
expect(friction.dx(0.0), 600.0); expect(friction.dx(0.0), 600.0);
...@@ -63,8 +62,7 @@ void main() { ...@@ -63,8 +62,7 @@ void main() {
expect(endPosition, lessThan(startPosition)); expect(endPosition, lessThan(startPosition));
expect(endVelocity, greaterThan(startVelocity)); expect(endVelocity, greaterThan(startVelocity));
friction = FrictionSimulation.through( friction = FrictionSimulation.through(startPosition, endPosition, startVelocity, endVelocity);
startPosition, endPosition, startVelocity, endVelocity);
expect(friction.isDone(1.0 + precisionErrorTolerance), true); expect(friction.isDone(1.0 + precisionErrorTolerance), true);
expect(friction.x(1.0), moreOrLessEquals(endPosition)); expect(friction.x(1.0), moreOrLessEquals(endPosition));
expect(friction.dx(1.0), moreOrLessEquals(endVelocity)); expect(friction.dx(1.0), moreOrLessEquals(endVelocity));
...@@ -116,31 +114,47 @@ void main() { ...@@ -116,31 +114,47 @@ void main() {
test('spring_types', () { test('spring_types', () {
SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio( SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0), 0.0, 300.0, 0.0); mass: 1.0,
stiffness: 100.0,
), 0.0, 300.0, 0.0);
expect(crit.type, SpringType.criticallyDamped); expect(crit.type, SpringType.criticallyDamped);
crit = SpringSimulation(SpringDescription.withDampingRatio( crit = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0, ratio: 1.0), 0.0, 300.0, 0.0); mass: 1.0,
stiffness: 100.0,
ratio: 1.0,
), 0.0, 300.0, 0.0);
expect(crit.type, SpringType.criticallyDamped); expect(crit.type, SpringType.criticallyDamped);
final SpringSimulation under = SpringSimulation(SpringDescription.withDampingRatio( final SpringSimulation under = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0, ratio: 0.75), 0.0, 300.0, 0.0); mass: 1.0,
stiffness: 100.0,
ratio: 0.75,
), 0.0, 300.0, 0.0);
expect(under.type, SpringType.underDamped); expect(under.type, SpringType.underDamped);
final SpringSimulation over = SpringSimulation(SpringDescription.withDampingRatio( final SpringSimulation over = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0, ratio: 1.25), 0.0, 300.0, 0.0); mass: 1.0,
stiffness: 100.0,
ratio: 1.25,
), 0.0, 300.0, 0.0);
expect(over.type, SpringType.overDamped); expect(over.type, SpringType.overDamped);
// Just so we don't forget how to create a desc without the ratio. // Just so we don't forget how to create a desc without the ratio.
final SpringSimulation other = SpringSimulation( final SpringSimulation other = SpringSimulation(const SpringDescription(
const SpringDescription(mass: 1.0, stiffness: 100.0, damping: 20.0), mass: 1.0,
0.0, 20.0, 20.0); stiffness: 100.0,
damping: 20.0,
), 0.0, 20.0, 20.0);
expect(other.type, SpringType.criticallyDamped); expect(other.type, SpringType.criticallyDamped);
}); });
test('crit_spring', () { test('crit_spring', () {
final SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio( final SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0, ratio: 1.0), 0.0, 500.0, 0.0); mass: 1.0,
stiffness: 100.0,
ratio: 1.0,
), 0.0, 500.0, 0.0);
crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01);
...@@ -165,7 +179,10 @@ void main() { ...@@ -165,7 +179,10 @@ void main() {
test('overdamped_spring', () { test('overdamped_spring', () {
final SpringSimulation over = SpringSimulation(SpringDescription.withDampingRatio( final SpringSimulation over = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0, ratio: 1.25), 0.0, 500.0, 0.0); mass: 1.0,
stiffness: 100.0,
ratio: 1.25,
), 0.0, 500.0, 0.0);
over.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); over.tolerance = const Tolerance(distance: 0.01, velocity: 0.01);
...@@ -187,7 +204,10 @@ void main() { ...@@ -187,7 +204,10 @@ void main() {
test('underdamped_spring', () { test('underdamped_spring', () {
final SpringSimulation under = SpringSimulation(SpringDescription.withDampingRatio( final SpringSimulation under = SpringSimulation(SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 100.0, ratio: 0.25), 0.0, 300.0, 0.0); mass: 1.0,
stiffness: 100.0,
ratio: 0.25,
), 0.0, 300.0, 0.0);
expect(under.type, SpringType.underDamped); expect(under.type, SpringType.underDamped);
expect(under.isDone(0.0), false); expect(under.isDone(0.0), false);
...@@ -204,7 +224,10 @@ void main() { ...@@ -204,7 +224,10 @@ void main() {
test('test_kinetic_scroll', () { test('test_kinetic_scroll', () {
final SpringDescription spring = SpringDescription.withDampingRatio( final SpringDescription spring = SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 50.0, ratio: 0.5); mass: 1.0,
stiffness: 50.0,
ratio: 0.5,
);
final BouncingScrollSimulation scroll = BouncingScrollSimulation( final BouncingScrollSimulation scroll = BouncingScrollSimulation(
position: 100.0, position: 100.0,
...@@ -233,7 +256,10 @@ void main() { ...@@ -233,7 +256,10 @@ void main() {
test('scroll_with_inf_edge_ends', () { test('scroll_with_inf_edge_ends', () {
final SpringDescription spring = SpringDescription.withDampingRatio( final SpringDescription spring = SpringDescription.withDampingRatio(
mass: 1.0, stiffness: 50.0, ratio: 0.5); mass: 1.0,
stiffness: 50.0,
ratio: 0.5,
);
final BouncingScrollSimulation scroll = BouncingScrollSimulation( final BouncingScrollSimulation scroll = BouncingScrollSimulation(
position: 100.0, position: 100.0,
......
...@@ -39,34 +39,36 @@ void main() { ...@@ -39,34 +39,36 @@ void main() {
}); });
test('test pumpBenchmark() only runs one frame', () async { test('test pumpBenchmark() only runs one frame', () async {
await benchmarkWidgets((WidgetTester tester) async { await benchmarkWidgets(
const Key root = Key('root'); (WidgetTester tester) async {
binding.attachRootWidget(Container(key: root)); const Key root = Key('root');
await tester.pump(); binding.attachRootWidget(Container(key: root));
await tester.pump();
expect(binding.framesBegun, greaterThan(0)); expect(binding.framesBegun, greaterThan(0));
expect(binding.framesDrawn, greaterThan(0)); expect(binding.framesDrawn, greaterThan(0));
final Element appState = tester.element(find.byKey(root)); final Element appState = tester.element(find.byKey(root));
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.benchmark; binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.benchmark;
final int startFramesBegun = binding.framesBegun; final int startFramesBegun = binding.framesBegun;
final int startFramesDrawn = binding.framesDrawn; final int startFramesDrawn = binding.framesDrawn;
expect(startFramesBegun, equals(startFramesDrawn)); expect(startFramesBegun, equals(startFramesDrawn));
appState.markNeedsBuild(); appState.markNeedsBuild();
await tester.pumpBenchmark(const Duration(milliseconds: 16)); await tester.pumpBenchmark(const Duration(milliseconds: 16));
final int endFramesBegun = binding.framesBegun; final int endFramesBegun = binding.framesBegun;
final int endFramesDrawn = binding.framesDrawn; final int endFramesDrawn = binding.framesDrawn;
expect(endFramesBegun, equals(endFramesDrawn)); expect(endFramesBegun, equals(endFramesDrawn));
expect(endFramesBegun, equals(startFramesBegun + 1)); expect(endFramesBegun, equals(startFramesBegun + 1));
expect(endFramesDrawn, equals(startFramesDrawn + 1)); expect(endFramesDrawn, equals(startFramesDrawn + 1));
}, },
// We are not interested in the performance of the "benchmark", we are just // We are not interested in the performance of the "benchmark", we are just
// testing the behavior. So it's OK that asserts are enabled. // testing the behavior. So it's OK that asserts are enabled.
mayRunWithAsserts: true); mayRunWithAsserts: true,
);
}, skip: isBrowser); }, skip: isBrowser);
} }
...@@ -82,9 +82,10 @@ void main() { ...@@ -82,9 +82,10 @@ void main() {
childrenInInversePaintOrder: children, childrenInInversePaintOrder: children,
); );
children.add(SemanticsNode() children.add(
..isMergedIntoParent = true SemanticsNode()
..rect = const Rect.fromLTRB(42.0, 42.0, 10.0, 10.0) ..isMergedIntoParent = true
..rect = const Rect.fromLTRB(42.0, 42.0, 10.0, 10.0),
); );
{ {
...@@ -101,7 +102,7 @@ void main() { ...@@ -101,7 +102,7 @@ void main() {
'Failed to replace child semantics nodes because the list of `SemanticsNode`s was mutated.\n' 'Failed to replace child semantics nodes because the list of `SemanticsNode`s was mutated.\n'
'Instead of mutating the existing list, create a new list containing the desired `SemanticsNode`s.\n' 'Instead of mutating the existing list, create a new list containing the desired `SemanticsNode`s.\n'
'Error details:\n' 'Error details:\n'
"The list's length has changed from 1 to 2." "The list's length has changed from 1 to 2.",
)); ));
expect( expect(
error.diagnostics.singleWhere((DiagnosticsNode node) => node.level == DiagnosticLevel.hint).toString(), error.diagnostics.singleWhere((DiagnosticsNode node) => node.level == DiagnosticLevel.hint).toString(),
...@@ -150,7 +151,7 @@ void main() { ...@@ -150,7 +151,7 @@ void main() {
'\n' '\n'
' Child node at position 1 was replaced:\n' ' Child node at position 1 was replaced:\n'
' Previous child: SemanticsNode#7(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(40.0, 14.0, 20.0, 20.0))\n' ' Previous child: SemanticsNode#7(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(40.0, 14.0, 20.0, 20.0))\n'
' New child: SemanticsNode#5(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0))\n' ' New child: SemanticsNode#5(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0))\n',
)); ));
expect( expect(
...@@ -489,16 +490,16 @@ void main() { ...@@ -489,16 +490,16 @@ void main() {
expect( expect(
allProperties.toStringDeep(), allProperties.toStringDeep(),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'SemanticsNode#2\n' 'SemanticsNode#2\n'
' STALE\n' ' STALE\n'
' owner: null\n' ' owner: null\n'
' merge boundary ⛔️\n' ' merge boundary ⛔️\n'
' Rect.fromLTRB(60.0, 20.0, 80.0, 50.0)\n' ' Rect.fromLTRB(60.0, 20.0, 80.0, 50.0)\n'
' actions: longPress, scrollUp, showOnScreen\n' ' actions: longPress, scrollUp, showOnScreen\n'
' flags: hasCheckedState, isSelected, isButton\n' ' flags: hasCheckedState, isSelected, isButton\n'
' label: "Use all the properties"\n' ' label: "Use all the properties"\n'
' textDirection: rtl\n' ' textDirection: rtl\n'
' sortKey: OrdinalSortKey#19df5(order: 1.0)\n' ' sortKey: OrdinalSortKey#19df5(order: 1.0)\n',
), ),
); );
expect( expect(
......
...@@ -18,7 +18,7 @@ void main() { ...@@ -18,7 +18,7 @@ void main() {
const Placeholder(), const Placeholder(),
// Stops right after the warm up frame. // Stops right after the warm up frame.
null, null,
EnginePhase.build EnginePhase.build,
); );
// The warm up frame will send update for an empty semantics tree. We // The warm up frame will send update for an empty semantics tree. We
// ignore this one time update. // ignore this one time update.
......
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