Unverified Commit 5865c14d authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

add trailing commas in flutter/test/animation (#80852)

parent d9638d25
...@@ -385,7 +385,7 @@ void main() { ...@@ -385,7 +385,7 @@ void main() {
' A given AnimationController cannot be disposed more than once.\n' ' A given AnimationController cannot be disposed more than once.\n'
' The following AnimationController object was disposed multiple\n' ' The following AnimationController object was disposed multiple\n'
' times:\n' ' times:\n'
' AnimationController#00000(⏮ 0.000; paused; DISPOSED)\n' ' AnimationController#00000(⏮ 0.000; paused; DISPOSED)\n',
), ),
); );
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
...@@ -968,14 +968,16 @@ void main() { ...@@ -968,14 +968,16 @@ void main() {
'FlutterError\n' 'FlutterError\n'
' AnimationController.forward() called with no default duration.\n' ' AnimationController.forward() called with no default duration.\n'
' The "duration" property should be set, either in the constructor\n' ' The "duration" property should be set, either in the constructor\n'
' or later, before calling the forward() function.\n' ' or later, before calling the forward() function.\n',
); );
controller.dispose(); controller.dispose();
}); });
test('AnimationController animateTo() will throw an error if there is no explicit duration ' test(
'and default duration', () { 'AnimationController animateTo() will throw an error if there is no explicit duration '
'and default duration',
() {
final AnimationController controller = AnimationController( final AnimationController controller = AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -996,11 +998,12 @@ void main() { ...@@ -996,11 +998,12 @@ void main() {
' Either the "duration" argument to the animateTo() method should\n' ' Either the "duration" argument to the animateTo() method should\n'
' be provided, or the "duration" property should be set, either in\n' ' be provided, or the "duration" property should be set, either in\n'
' the constructor or later, before calling the animateTo()\n' ' the constructor or later, before calling the animateTo()\n'
' function.\n' ' function.\n',
); );
controller.dispose(); controller.dispose();
}); },
);
test('AnimationController reverse() will throw an error if there is no default duration or reverseDuration', () { test('AnimationController reverse() will throw an error if there is no default duration or reverseDuration', () {
final AnimationController controller = AnimationController( final AnimationController controller = AnimationController(
...@@ -1022,14 +1025,16 @@ void main() { ...@@ -1022,14 +1025,16 @@ void main() {
' reverseDuration.\n' ' reverseDuration.\n'
' The "duration" or "reverseDuration" property should be set,\n' ' The "duration" or "reverseDuration" property should be set,\n'
' either in the constructor or later, before calling the reverse()\n' ' either in the constructor or later, before calling the reverse()\n'
' function.\n' ' function.\n',
); );
controller.dispose(); controller.dispose();
}); });
test('AnimationController animateBack() will throw an error if there is no explicit duration and ' test(
'no default duration or reverseDuration', () { 'AnimationController animateBack() will throw an error if there is no explicit duration and '
'no default duration or reverseDuration',
() {
final AnimationController controller = AnimationController( final AnimationController controller = AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -1050,11 +1055,12 @@ void main() { ...@@ -1050,11 +1055,12 @@ void main() {
' Either the "duration" argument to the animateBack() method should\n' ' Either the "duration" argument to the animateBack() method should\n'
' be provided, or the "duration" or "reverseDuration" property\n' ' be provided, or the "duration" or "reverseDuration" property\n'
' should be set, either in the constructor or later, before calling\n' ' should be set, either in the constructor or later, before calling\n'
' the animateBack() function.\n' ' the animateBack() function.\n',
); );
controller.dispose(); controller.dispose();
}); },
);
}); });
} }
......
...@@ -243,19 +243,18 @@ void main() { ...@@ -243,19 +243,18 @@ void main() {
error = e; error = e;
} }
expect(error, isNotNull); expect(error, isNotNull);
expect(error!.toStringDeep(), matches( expect(
error!.toStringDeep(),
// RegExp matcher is required here due to flutter web and flutter mobile generating // RegExp matcher is required here due to flutter web and flutter mobile generating
// slightly different floating point numbers // slightly different floating point numbers
// in Flutter web 0.0 sometimes just appears as 0. or 0 // in Flutter web 0.0 sometimes just appears as 0. or 0
RegExp(r''' matches(RegExp(r'''
FlutterError FlutterError
Invalid curve endpoint at \d+(\.\d*)?\. Invalid curve endpoint at \d+(\.\d*)?\.
Curves must map 0\.0 to near zero and 1\.0 to near one but Curves must map 0\.0 to near zero and 1\.0 to near one but
BogusCurve mapped \d+(\.\d*)? to \d+(\.\d*)?, which is near \d+(\.\d*)?\. BogusCurve mapped \d+(\.\d*)? to \d+(\.\d*)?, which is near \d+(\.\d*)?\.
''', ''', multiLine: true)),
multiLine: true );
),
));
}); });
test('CurvedAnimation running with different forward and reverse durations.', () { test('CurvedAnimation running with different forward and reverse durations.', () {
......
...@@ -405,7 +405,8 @@ void main() { ...@@ -405,7 +405,8 @@ void main() {
], ],
tension: 0.0, tension: 0.0,
), ),
isFalse); isFalse,
);
expect(() { expect(() {
CatmullRomCurve( CatmullRomCurve(
const <Offset>[ const <Offset>[
...@@ -425,7 +426,8 @@ void main() { ...@@ -425,7 +426,8 @@ void main() {
], ],
tension: 0.0, tension: 0.0,
), ),
isFalse); isFalse,
);
expect(() { expect(() {
CatmullRomCurve( CatmullRomCurve(
const <Offset>[ const <Offset>[
......
...@@ -28,7 +28,7 @@ void main() { ...@@ -28,7 +28,7 @@ void main() {
expect(error.diagnostics.map((DiagnosticsNode node) => node.toString()), <String>[ expect(error.diagnostics.map((DiagnosticsNode node) => node.toString()), <String>[
'Cannot lerp between "Instance of \'Object\'" and "Instance of \'Object\'".', 'Cannot lerp between "Instance of \'Object\'" and "Instance of \'Object\'".',
'The type Object might not fully implement `+`, `-`, and/or `*`. $kApiDocsLink', 'The type Object might not fully implement `+`, `-`, and/or `*`. $kApiDocsLink',
'There may be a dedicated "ObjectTween" for this type, or you may need to create one.' 'There may be a dedicated "ObjectTween" for this type, or you may need to create one.',
]); ]);
}); });
...@@ -59,7 +59,7 @@ void main() { ...@@ -59,7 +59,7 @@ void main() {
test('throws flutter error when tweening types that do not fully satisfy tween requirements - Rect', () { test('throws flutter error when tweening types that do not fully satisfy tween requirements - Rect', () {
final Tween<Rect> rectTween = Tween<Rect>( final Tween<Rect> rectTween = Tween<Rect>(
begin: const Rect.fromLTWH(0, 0, 10, 10), begin: const Rect.fromLTWH(0, 0, 10, 10),
end: const Rect.fromLTWH(2, 2, 2, 2) end: const Rect.fromLTWH(2, 2, 2, 2),
); );
FlutterError? error; FlutterError? error;
...@@ -185,9 +185,7 @@ void main() { ...@@ -185,9 +185,7 @@ void main() {
expect(rotationTween.lerp(0.0), equals(a)); expect(rotationTween.lerp(0.0), equals(a));
expect(rotationTween.lerp(1.0), equals(c)); expect(rotationTween.lerp(1.0), equals(c));
expect( expect(
rotationTween.lerp(0.5).absoluteError( rotationTween.lerp(0.5).absoluteError(a.clone()..rotateZ(0.5)),
a.clone()..rotateZ(0.5)
),
moreOrLessEquals(0.0), moreOrLessEquals(0.0),
); );
}, skip: isWindows); // floating point math not quite deterministic on Windows? }, skip: isWindows); // floating point math not quite deterministic on Windows?
...@@ -210,7 +208,7 @@ void main() { ...@@ -210,7 +208,7 @@ void main() {
test('ColorTween', () { test('ColorTween', () {
final ColorTween tween = ColorTween( final ColorTween tween = ColorTween(
begin: const Color(0xff000000), begin: const Color(0xff000000),
end: const Color(0xffffffff) end: const Color(0xffffffff),
); );
expect(tween.lerp(0.0), const Color(0xff000000)); expect(tween.lerp(0.0), const Color(0xff000000));
expect(tween.lerp(0.5), const Color(0xff7f7f7f)); expect(tween.lerp(0.5), const Color(0xff7f7f7f));
......
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