Unverified Commit d12098da authored by houyushan's avatar houyushan Committed by GitHub

Fix a ConstantTween's clerical error and Add some Tween testcases. (#71830)

parent ceca634e
......@@ -436,7 +436,7 @@ class ConstantTween<T> extends Tween<T> {
T lerp(double t) => begin as T;
@override
String toString() => '${objectRuntimeType(this, 'ReverseTween')}(value: $begin)';
String toString() => '${objectRuntimeType(this, 'ConstantTween')}(value: $begin)';
}
/// Transforms the value of the given animation by the given curve.
......
......@@ -93,4 +93,34 @@ void main() {
expect(tween.lerp(0.5), 100.0);
expect(tween.lerp(1.0), 100.0);
});
test('ReverseTween', () {
final ReverseTween<int> tween = ReverseTween<int>(IntTween(begin: 5, end: 9));
expect(tween.lerp(0.5), 7);
expect(tween.lerp(0.7), 6);
});
test('ColorTween', () {
final ColorTween tween = ColorTween(
begin: const Color(0xff000000),
end: const Color(0xffffffff)
);
expect(tween.lerp(0.0), const Color(0xff000000));
expect(tween.lerp(0.5), const Color(0xff7f7f7f));
expect(tween.lerp(0.7), const Color(0xffb2b2b2));
expect(tween.lerp(1.0), const Color(0xffffffff));
});
test('StepTween', () {
final StepTween tween = StepTween(begin: 5, end: 9);
expect(tween.lerp(0.5), 7);
expect(tween.lerp(0.7), 7);
});
test('CurveTween', () {
final CurveTween tween = CurveTween(curve: Curves.easeIn);
expect(tween.transform(0.0), 0.0);
expect(tween.transform(0.5), 0.31640625);
expect(tween.transform(1.0), 1.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