OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/animation/animatable/AnimatableDoubleAndBool.h" | 6 #include "core/animation/animatable/AnimatableDoubleAndBool.h" |
7 | 7 |
8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 TEST(AnimationAnimatableDoubleAndBoolTest, Flag) | 33 TEST(AnimationAnimatableDoubleAndBoolTest, Flag) |
34 { | 34 { |
35 EXPECT_FALSE(AnimatableDoubleAndBool::create(5.9, false)->flag()); | 35 EXPECT_FALSE(AnimatableDoubleAndBool::create(5.9, false)->flag()); |
36 EXPECT_TRUE(AnimatableDoubleAndBool::create(-10, true)->flag()); | 36 EXPECT_TRUE(AnimatableDoubleAndBool::create(-10, true)->flag()); |
37 } | 37 } |
38 | 38 |
39 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateFalse) | 39 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateFalse) |
40 { | 40 { |
41 RefPtrWillBeRawPtr<AnimatableDoubleAndBool> from10 = AnimatableDoubleAndBool
::create(10, false); | 41 RefPtr<AnimatableDoubleAndBool> from10 = AnimatableDoubleAndBool::create(10,
false); |
42 RefPtrWillBeRawPtr<AnimatableDoubleAndBool> to20 = AnimatableDoubleAndBool::
create(20, false); | 42 RefPtr<AnimatableDoubleAndBool> to20 = AnimatableDoubleAndBool::create(20, f
alse); |
43 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), -0.5).get())->flag()); | 43 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), -0.5).get())->flag()); |
44 EXPECT_EQ(5, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), -0.5).get())->toDouble()); | 44 EXPECT_EQ(5, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), -0.5).get())->toDouble()); |
45 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0).get())->toDouble()); | 45 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0).get())->toDouble()); |
46 EXPECT_EQ(14, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.4).get())->toDouble()); | 46 EXPECT_EQ(14, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.4).get())->toDouble()); |
47 EXPECT_EQ(15, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.5).get())->toDouble()); | 47 EXPECT_EQ(15, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.5).get())->toDouble()); |
48 EXPECT_EQ(16, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.6).get())->toDouble()); | 48 EXPECT_EQ(16, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.6).get())->toDouble()); |
49 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1).get())->toDouble()); | 49 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1).get())->toDouble()); |
50 EXPECT_EQ(25, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1.5).get())->toDouble()); | 50 EXPECT_EQ(25, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1.5).get())->toDouble()); |
51 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), 1.5).get())->flag()); | 51 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), 1.5).get())->flag()); |
52 } | 52 } |
53 | 53 |
54 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateTrue) | 54 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateTrue) |
55 { | 55 { |
56 RefPtrWillBeRawPtr<AnimatableDoubleAndBool> from10 = AnimatableDoubleAndBool
::create(10, true); | 56 RefPtr<AnimatableDoubleAndBool> from10 = AnimatableDoubleAndBool::create(10,
true); |
57 RefPtrWillBeRawPtr<AnimatableDoubleAndBool> to20 = AnimatableDoubleAndBool::
create(20, true); | 57 RefPtr<AnimatableDoubleAndBool> to20 = AnimatableDoubleAndBool::create(20, t
rue); |
58 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), -0.5).get())->flag()); | 58 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), -0.5).get())->flag()); |
59 EXPECT_EQ(5, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), -0.5).get())->toDouble()); | 59 EXPECT_EQ(5, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), -0.5).get())->toDouble()); |
60 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0).get())->toDouble()); | 60 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0).get())->toDouble()); |
61 EXPECT_EQ(14, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.4).get())->toDouble()); | 61 EXPECT_EQ(14, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.4).get())->toDouble()); |
62 EXPECT_EQ(15, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.5).get())->toDouble()); | 62 EXPECT_EQ(15, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.5).get())->toDouble()); |
63 EXPECT_EQ(16, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.6).get())->toDouble()); | 63 EXPECT_EQ(16, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.6).get())->toDouble()); |
64 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1).get())->toDouble()); | 64 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1).get())->toDouble()); |
65 EXPECT_EQ(25, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1.5).get())->toDouble()); | 65 EXPECT_EQ(25, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1.5).get())->toDouble()); |
66 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), 1.5).get())->flag()); | 66 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), 1.5).get())->flag()); |
67 } | 67 } |
68 | 68 |
69 TEST(AnimationAnimatableDoubleAndBoolTest, Step) | 69 TEST(AnimationAnimatableDoubleAndBoolTest, Step) |
70 { | 70 { |
71 RefPtrWillBeRawPtr<AnimatableDoubleAndBool> from10 = AnimatableDoubleAndBool
::create(10, true); | 71 RefPtr<AnimatableDoubleAndBool> from10 = AnimatableDoubleAndBool::create(10,
true); |
72 RefPtrWillBeRawPtr<AnimatableDoubleAndBool> to20 = AnimatableDoubleAndBool::
create(20, false); | 72 RefPtr<AnimatableDoubleAndBool> to20 = AnimatableDoubleAndBool::create(20, f
alse); |
73 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), -0.5).get())->flag()); | 73 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), -0.5).get())->flag()); |
74 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), -0.5).get())->toDouble()); | 74 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), -0.5).get())->toDouble()); |
75 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0).get())->toDouble()); | 75 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0).get())->toDouble()); |
76 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.4).get())->toDouble()); | 76 EXPECT_EQ(10, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.4).get())->toDouble()); |
77 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), 0.4).get())->flag()); | 77 EXPECT_TRUE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.ge
t(), to20.get(), 0.4).get())->flag()); |
78 | 78 |
79 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), 0.6).get())->flag()); | 79 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), 0.6).get())->flag()); |
80 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.6).get())->toDouble()); | 80 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 0.6).get())->toDouble()); |
81 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1).get())->toDouble()); | 81 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1).get())->toDouble()); |
82 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1.5).get())->toDouble()); | 82 EXPECT_EQ(20, toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.
get(), to20.get(), 1.5).get())->toDouble()); |
83 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), 1.5).get())->flag()); | 83 EXPECT_FALSE(toAnimatableDoubleAndBool(AnimatableValue::interpolate(from10.g
et(), to20.get(), 1.5).get())->flag()); |
84 } | 84 } |
85 | 85 |
86 } // namespace blink | 86 } // namespace blink |
OLD | NEW |