#include <cmath>
#import "flutter/third_party/spring_animation/spring_animation.h"
#include "gtest/gtest.h"
Go to the source code of this file.
|
| TEST (SpringAnimationTest, CanInitializeCorrectly) |
|
| TEST (SpringAnimationTest, CurveFunctionCanWorkCorrectly) |
|
| TEST (SpringAnimationTest, CanUpdatePositionValuesAndCalculateCorrectly) |
|
◆ TEST() [1/3]
TEST |
( |
SpringAnimationTest |
, |
|
|
CanInitializeCorrectly |
|
|
) |
| |
Definition at line 9 of file SpringAnimationTest.mm.
9 {
11 damping:500
12 mass:3
13 initialVelocity:0
14 fromValue:0
15 toValue:1000];
17 ASSERT_TRUE(animation.
damping == 500);
18 ASSERT_TRUE(animation.
mass == 3);
21 ASSERT_TRUE(animation.
toValue == 1000);
22}
◆ TEST() [2/3]
TEST |
( |
SpringAnimationTest |
, |
|
|
CanUpdatePositionValuesAndCalculateCorrectly |
|
|
) |
| |
Definition at line 42 of file SpringAnimationTest.mm.
42 {
44 damping:500
45 mass:3
46 initialVelocity:0
47 fromValue:0
48 toValue:1000];
49 const double startTime = 0;
50 const double endTime = 0.6;
51
52 const double startValue1 = [animation curveFunction:startTime];
53 const double toValue1 = [animation curveFunction:endTime];
54
57
59 ASSERT_TRUE(animation.
toValue == 800);
60
61 const double startValue2 = [animation curveFunction:startTime];
62 const double toValue2 = [animation curveFunction:endTime];
63 ASSERT_TRUE(startValue2 > startValue1);
64 ASSERT_TRUE(toValue2 < toValue1);
65}
◆ TEST() [3/3]
TEST |
( |
SpringAnimationTest |
, |
|
|
CurveFunctionCanWorkCorrectly |
|
|
) |
| |
Definition at line 24 of file SpringAnimationTest.mm.
24 {
25
27 damping:500
28 mass:3
29 initialVelocity:0
30 fromValue:0
31 toValue:1000];
32 const double accuracy = 1.0;
33 const double startTime = 0;
34 const double endTime = 0.6;
35
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);
40}