6#import "flutter/third_party/spring_animation/spring_animation.h"
7#include "gtest/gtest.h"
9TEST(SpringAnimationTest, CanInitializeCorrectly) {
17 ASSERT_TRUE(animation.
damping == 500);
18 ASSERT_TRUE(animation.
mass == 3);
21 ASSERT_TRUE(animation.
toValue == 1000);
24TEST(SpringAnimationTest, CurveFunctionCanWorkCorrectly) {
32 const double accuracy = 1.0;
33 const double startTime = 0;
34 const double endTime = 0.6;
36 const double startValue = [animation curveFunction:startTime];
37 ASSERT_TRUE(fabs(startValue - animation.
fromValue) < accuracy);
38 const double toValue = [animation curveFunction:endTime];
39 ASSERT_TRUE(fabs(toValue - animation.
toValue) < accuracy);
42TEST(SpringAnimationTest, CanUpdatePositionValuesAndCalculateCorrectly) {
49 const double startTime = 0;
50 const double endTime = 0.6;
52 const double startValue1 = [animation curveFunction:startTime];
53 const double toValue1 = [animation curveFunction:endTime];
59 ASSERT_TRUE(animation.
toValue == 800);
61 const double startValue2 = [animation curveFunction:startTime];
62 const double toValue2 = [animation curveFunction:endTime];
63 ASSERT_TRUE(startValue2 > startValue1);
64 ASSERT_TRUE(toValue2 < toValue1);
TEST(SpringAnimationTest, CanInitializeCorrectly)