add trailing commas in flutter/test/animation (#80852)
This commit is contained in:
parent
d9638d25d7
commit
5865c14d67
@ -385,7 +385,7 @@ void main() {
|
||||
' A given AnimationController cannot be disposed more than once.\n'
|
||||
' The following AnimationController object was disposed multiple\n'
|
||||
' times:\n'
|
||||
' AnimationController#00000(⏮ 0.000; paused; DISPOSED)\n'
|
||||
' AnimationController#00000(⏮ 0.000; paused; DISPOSED)\n',
|
||||
),
|
||||
);
|
||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||
@ -966,41 +966,44 @@ void main() {
|
||||
expect(
|
||||
error.toStringDeep(),
|
||||
'FlutterError\n'
|
||||
' AnimationController.forward() called with no default duration.\n'
|
||||
' The "duration" property should be set, either in the constructor\n'
|
||||
' or later, before calling the forward() function.\n'
|
||||
' AnimationController.forward() called with no default duration.\n'
|
||||
' The "duration" property should be set, either in the constructor\n'
|
||||
' or later, before calling the forward() function.\n',
|
||||
);
|
||||
|
||||
controller.dispose();
|
||||
});
|
||||
|
||||
test('AnimationController animateTo() will throw an error if there is no explicit duration '
|
||||
'and default duration', () {
|
||||
final AnimationController controller = AnimationController(
|
||||
vsync: const TestVSync(),
|
||||
);
|
||||
test(
|
||||
'AnimationController animateTo() will throw an error if there is no explicit duration '
|
||||
'and default duration',
|
||||
() {
|
||||
final AnimationController controller = AnimationController(
|
||||
vsync: const TestVSync(),
|
||||
);
|
||||
|
||||
late FlutterError error;
|
||||
try {
|
||||
controller.animateTo(0.8);
|
||||
} on FlutterError catch (e) {
|
||||
error = e;
|
||||
}
|
||||
late FlutterError error;
|
||||
try {
|
||||
controller.animateTo(0.8);
|
||||
} on FlutterError catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error, isNotNull);
|
||||
expect(
|
||||
error.toStringDeep(),
|
||||
'FlutterError\n'
|
||||
expect(error, isNotNull);
|
||||
expect(
|
||||
error.toStringDeep(),
|
||||
'FlutterError\n'
|
||||
' AnimationController.animateTo() called with no explicit duration\n'
|
||||
' and no default duration.\n'
|
||||
' Either the "duration" argument to the animateTo() method should\n'
|
||||
' be provided, or the "duration" property should be set, either in\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', () {
|
||||
final AnimationController controller = AnimationController(
|
||||
@ -1018,43 +1021,46 @@ void main() {
|
||||
expect(
|
||||
error.toStringDeep(),
|
||||
'FlutterError\n'
|
||||
' AnimationController.reverse() called with no default duration or\n'
|
||||
' reverseDuration.\n'
|
||||
' The "duration" or "reverseDuration" property should be set,\n'
|
||||
' either in the constructor or later, before calling the reverse()\n'
|
||||
' function.\n'
|
||||
' AnimationController.reverse() called with no default duration or\n'
|
||||
' reverseDuration.\n'
|
||||
' The "duration" or "reverseDuration" property should be set,\n'
|
||||
' either in the constructor or later, before calling the reverse()\n'
|
||||
' function.\n',
|
||||
);
|
||||
|
||||
controller.dispose();
|
||||
});
|
||||
|
||||
test('AnimationController animateBack() will throw an error if there is no explicit duration and '
|
||||
'no default duration or reverseDuration', () {
|
||||
final AnimationController controller = AnimationController(
|
||||
vsync: const TestVSync(),
|
||||
);
|
||||
test(
|
||||
'AnimationController animateBack() will throw an error if there is no explicit duration and '
|
||||
'no default duration or reverseDuration',
|
||||
() {
|
||||
final AnimationController controller = AnimationController(
|
||||
vsync: const TestVSync(),
|
||||
);
|
||||
|
||||
late FlutterError error;
|
||||
try {
|
||||
controller.animateBack(0.8);
|
||||
} on FlutterError catch (e) {
|
||||
error = e;
|
||||
}
|
||||
late FlutterError error;
|
||||
try {
|
||||
controller.animateBack(0.8);
|
||||
} on FlutterError catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error, isNotNull);
|
||||
expect(
|
||||
error.toStringDeep(),
|
||||
'FlutterError\n'
|
||||
expect(error, isNotNull);
|
||||
expect(
|
||||
error.toStringDeep(),
|
||||
'FlutterError\n'
|
||||
' AnimationController.animateBack() called with no explicit\n'
|
||||
' duration and no default duration or reverseDuration.\n'
|
||||
' Either the "duration" argument to the animateBack() method should\n'
|
||||
' be provided, or the "duration" or "reverseDuration" property\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() {
|
||||
error = e;
|
||||
}
|
||||
expect(error, isNotNull);
|
||||
expect(error!.toStringDeep(), matches(
|
||||
expect(
|
||||
error!.toStringDeep(),
|
||||
// RegExp matcher is required here due to flutter web and flutter mobile generating
|
||||
// slightly different floating point numbers
|
||||
// in Flutter web 0.0 sometimes just appears as 0. or 0
|
||||
RegExp(r'''
|
||||
matches(RegExp(r'''
|
||||
FlutterError
|
||||
Invalid curve endpoint at \d+(\.\d*)?\.
|
||||
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*)?\.
|
||||
''',
|
||||
multiLine: true
|
||||
),
|
||||
));
|
||||
''', multiLine: true)),
|
||||
);
|
||||
});
|
||||
|
||||
test('CurvedAnimation running with different forward and reverse durations.', () {
|
||||
|
@ -398,14 +398,15 @@ void main() {
|
||||
|
||||
// Monotonically increasing in X.
|
||||
expect(
|
||||
CatmullRomCurve.validateControlPoints(
|
||||
const <Offset>[
|
||||
Offset(0.2, 0.25),
|
||||
Offset(0.01, 0.25),
|
||||
],
|
||||
tension: 0.0,
|
||||
),
|
||||
isFalse);
|
||||
CatmullRomCurve.validateControlPoints(
|
||||
const <Offset>[
|
||||
Offset(0.2, 0.25),
|
||||
Offset(0.01, 0.25),
|
||||
],
|
||||
tension: 0.0,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
expect(() {
|
||||
CatmullRomCurve(
|
||||
const <Offset>[
|
||||
@ -418,14 +419,15 @@ void main() {
|
||||
|
||||
// X within range (0.0, 1.0).
|
||||
expect(
|
||||
CatmullRomCurve.validateControlPoints(
|
||||
const <Offset>[
|
||||
Offset(0.2, 0.25),
|
||||
Offset(1.01, 0.25),
|
||||
],
|
||||
tension: 0.0,
|
||||
),
|
||||
isFalse);
|
||||
CatmullRomCurve.validateControlPoints(
|
||||
const <Offset>[
|
||||
Offset(0.2, 0.25),
|
||||
Offset(1.01, 0.25),
|
||||
],
|
||||
tension: 0.0,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
expect(() {
|
||||
CatmullRomCurve(
|
||||
const <Offset>[
|
||||
|
@ -28,7 +28,7 @@ void main() {
|
||||
expect(error.diagnostics.map((DiagnosticsNode node) => node.toString()), <String>[
|
||||
'Cannot lerp between "Instance of \'Object\'" and "Instance of \'Object\'".',
|
||||
'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() {
|
||||
test('throws flutter error when tweening types that do not fully satisfy tween requirements - Rect', () {
|
||||
final Tween<Rect> rectTween = Tween<Rect>(
|
||||
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;
|
||||
@ -185,9 +185,7 @@ void main() {
|
||||
expect(rotationTween.lerp(0.0), equals(a));
|
||||
expect(rotationTween.lerp(1.0), equals(c));
|
||||
expect(
|
||||
rotationTween.lerp(0.5).absoluteError(
|
||||
a.clone()..rotateZ(0.5)
|
||||
),
|
||||
rotationTween.lerp(0.5).absoluteError(a.clone()..rotateZ(0.5)),
|
||||
moreOrLessEquals(0.0),
|
||||
);
|
||||
}, skip: isWindows); // floating point math not quite deterministic on Windows?
|
||||
@ -210,7 +208,7 @@ void main() {
|
||||
test('ColorTween', () {
|
||||
final ColorTween tween = ColorTween(
|
||||
begin: const Color(0xff000000),
|
||||
end: const Color(0xffffffff)
|
||||
end: const Color(0xffffffff),
|
||||
);
|
||||
expect(tween.lerp(0.0), const Color(0xff000000));
|
||||
expect(tween.lerp(0.5), const Color(0xff7f7f7f));
|
||||
|
Loading…
x
Reference in New Issue
Block a user