| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 | 6 |
| 7 #include "CCActiveAnimation.h" | 7 #include "CCActiveAnimation.h" |
| 8 | 8 |
| 9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using namespace WebKitTests; | 13 using namespace WebKitTests; |
| 14 using namespace cc; | 14 using namespace cc; |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 PassOwnPtr<CCActiveAnimation> createActiveAnimation(int iterations, double durat
ion) | 18 scoped_ptr<CCActiveAnimation> createActiveAnimation(int iterations, double durat
ion) |
| 19 { | 19 { |
| 20 OwnPtr<CCActiveAnimation> toReturn(CCActiveAnimation::create(adoptPtr(new Fa
keFloatAnimationCurve(duration)), 0, 1, CCActiveAnimation::Opacity)); | 20 scoped_ptr<CCActiveAnimation> toReturn(CCActiveAnimation::create(make_scoped
_ptr(new FakeFloatAnimationCurve(duration)).PassAs<CCAnimationCurve>(), 0, 1, CC
ActiveAnimation::Opacity)); |
| 21 toReturn->setIterations(iterations); | 21 toReturn->setIterations(iterations); |
| 22 return toReturn.release(); | 22 return toReturn.Pass(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 PassOwnPtr<CCActiveAnimation> createActiveAnimation(int iterations) | 25 scoped_ptr<CCActiveAnimation> createActiveAnimation(int iterations) |
| 26 { | 26 { |
| 27 return createActiveAnimation(iterations, 1); | 27 return createActiveAnimation(iterations, 1); |
| 28 } | 28 } |
| 29 | 29 |
| 30 TEST(CCActiveAnimationTest, TrimTimeZeroIterations) | 30 TEST(CCActiveAnimationTest, TrimTimeZeroIterations) |
| 31 { | 31 { |
| 32 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); | 32 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); |
| 33 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); | 33 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); |
| 34 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 34 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 35 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); | 35 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 TEST(CCActiveAnimationTest, TrimTimeOneIteration) | 38 TEST(CCActiveAnimationTest, TrimTimeOneIteration) |
| 39 { | 39 { |
| 40 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 40 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 41 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); | 41 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); |
| 42 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 42 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 43 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); | 43 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); |
| 44 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(2)); | 44 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(2)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) | 47 TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) |
| 48 { | 48 { |
| 49 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); | 49 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); |
| 50 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 50 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 51 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); | 51 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); |
| 52 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); | 52 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); |
| 53 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1.5)); | 53 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1.5)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TEST(CCActiveAnimationTest, TrimTimeAlternating) | 56 TEST(CCActiveAnimationTest, TrimTimeAlternating) |
| 57 { | 57 { |
| 58 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); | 58 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); |
| 59 anim->setAlternatesDirection(true); | 59 anim->setAlternatesDirection(true); |
| 60 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 60 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 61 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); | 61 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); |
| 62 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); | 62 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); |
| 63 EXPECT_EQ(0.75, anim->trimTimeToCurrentIteration(1.25)); | 63 EXPECT_EQ(0.75, anim->trimTimeToCurrentIteration(1.25)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST(CCActiveAnimationTest, TrimTimeStartTime) | 66 TEST(CCActiveAnimationTest, TrimTimeStartTime) |
| 67 { | 67 { |
| 68 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 68 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 69 anim->setStartTime(4); | 69 anim->setStartTime(4); |
| 70 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 70 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 71 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(4)); | 71 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(4)); |
| 72 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(4.5)); | 72 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(4.5)); |
| 73 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(5)); | 73 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(5)); |
| 74 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(6)); | 74 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(6)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 TEST(CCActiveAnimationTest, TrimTimeTimeOffset) | 77 TEST(CCActiveAnimationTest, TrimTimeTimeOffset) |
| 78 { | 78 { |
| 79 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 79 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 80 anim->setTimeOffset(4); | 80 anim->setTimeOffset(4); |
| 81 anim->setStartTime(4); | 81 anim->setStartTime(4); |
| 82 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 82 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 83 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); | 83 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); |
| 84 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); | 84 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); |
| 85 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); | 85 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 TEST(CCActiveAnimationTest, TrimTimePauseResume) | 88 TEST(CCActiveAnimationTest, TrimTimePauseResume) |
| 89 { | 89 { |
| 90 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 90 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 91 anim->setRunState(CCActiveAnimation::Running, 0); | 91 anim->setRunState(CCActiveAnimation::Running, 0); |
| 92 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 92 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 93 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); | 93 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); |
| 94 anim->setRunState(CCActiveAnimation::Paused, 0.5); | 94 anim->setRunState(CCActiveAnimation::Paused, 0.5); |
| 95 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); | 95 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); |
| 96 anim->setRunState(CCActiveAnimation::Running, 1024); | 96 anim->setRunState(CCActiveAnimation::Running, 1024); |
| 97 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); | 97 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); |
| 98 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); | 98 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST(CCActiveAnimationTest, TrimTimeSuspendResume) | 101 TEST(CCActiveAnimationTest, TrimTimeSuspendResume) |
| 102 { | 102 { |
| 103 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 103 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 104 anim->setRunState(CCActiveAnimation::Running, 0); | 104 anim->setRunState(CCActiveAnimation::Running, 0); |
| 105 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 105 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 106 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); | 106 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); |
| 107 anim->suspend(0.5); | 107 anim->suspend(0.5); |
| 108 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); | 108 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); |
| 109 anim->resume(1024); | 109 anim->resume(1024); |
| 110 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); | 110 EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); |
| 111 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); | 111 EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST(CCActiveAnimationTest, TrimTimeZeroDuration) | 114 TEST(CCActiveAnimationTest, TrimTimeZeroDuration) |
| 115 { | 115 { |
| 116 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0, 0)); | 116 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0, 0)); |
| 117 anim->setRunState(CCActiveAnimation::Running, 0); | 117 anim->setRunState(CCActiveAnimation::Running, 0); |
| 118 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); | 118 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); |
| 119 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); | 119 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); |
| 120 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); | 120 EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations) | 123 TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations) |
| 124 { | 124 { |
| 125 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); | 125 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); |
| 126 anim->setRunState(CCActiveAnimation::Running, 0); | 126 anim->setRunState(CCActiveAnimation::Running, 0); |
| 127 EXPECT_FALSE(anim->isFinishedAt(-1)); | 127 EXPECT_FALSE(anim->isFinishedAt(-1)); |
| 128 EXPECT_TRUE(anim->isFinishedAt(0)); | 128 EXPECT_TRUE(anim->isFinishedAt(0)); |
| 129 EXPECT_TRUE(anim->isFinishedAt(1)); | 129 EXPECT_TRUE(anim->isFinishedAt(1)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 TEST(CCActiveAnimationTest, IsFinishedAtOneIteration) | 132 TEST(CCActiveAnimationTest, IsFinishedAtOneIteration) |
| 133 { | 133 { |
| 134 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 134 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 135 anim->setRunState(CCActiveAnimation::Running, 0); | 135 anim->setRunState(CCActiveAnimation::Running, 0); |
| 136 EXPECT_FALSE(anim->isFinishedAt(-1)); | 136 EXPECT_FALSE(anim->isFinishedAt(-1)); |
| 137 EXPECT_FALSE(anim->isFinishedAt(0)); | 137 EXPECT_FALSE(anim->isFinishedAt(0)); |
| 138 EXPECT_TRUE(anim->isFinishedAt(1)); | 138 EXPECT_TRUE(anim->isFinishedAt(1)); |
| 139 EXPECT_TRUE(anim->isFinishedAt(2)); | 139 EXPECT_TRUE(anim->isFinishedAt(2)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 TEST(CCActiveAnimationTest, IsFinishedAtInfiniteIterations) | 142 TEST(CCActiveAnimationTest, IsFinishedAtInfiniteIterations) |
| 143 { | 143 { |
| 144 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); | 144 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(-1)); |
| 145 anim->setRunState(CCActiveAnimation::Running, 0); | 145 anim->setRunState(CCActiveAnimation::Running, 0); |
| 146 EXPECT_FALSE(anim->isFinishedAt(0)); | 146 EXPECT_FALSE(anim->isFinishedAt(0)); |
| 147 EXPECT_FALSE(anim->isFinishedAt(0.5)); | 147 EXPECT_FALSE(anim->isFinishedAt(0.5)); |
| 148 EXPECT_FALSE(anim->isFinishedAt(1)); | 148 EXPECT_FALSE(anim->isFinishedAt(1)); |
| 149 EXPECT_FALSE(anim->isFinishedAt(1.5)); | 149 EXPECT_FALSE(anim->isFinishedAt(1.5)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 TEST(CCActiveAnimationTest, IsFinishedAtNotRunning) | 152 TEST(CCActiveAnimationTest, IsFinishedAtNotRunning) |
| 153 { | 153 { |
| 154 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); | 154 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(0)); |
| 155 anim->setRunState(CCActiveAnimation::Running, 0); | 155 anim->setRunState(CCActiveAnimation::Running, 0); |
| 156 EXPECT_TRUE(anim->isFinishedAt(0)); | 156 EXPECT_TRUE(anim->isFinishedAt(0)); |
| 157 anim->setRunState(CCActiveAnimation::Paused, 0); | 157 anim->setRunState(CCActiveAnimation::Paused, 0); |
| 158 EXPECT_FALSE(anim->isFinishedAt(0)); | 158 EXPECT_FALSE(anim->isFinishedAt(0)); |
| 159 anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); | 159 anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); |
| 160 EXPECT_FALSE(anim->isFinishedAt(0)); | 160 EXPECT_FALSE(anim->isFinishedAt(0)); |
| 161 anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); | 161 anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); |
| 162 EXPECT_FALSE(anim->isFinishedAt(0)); | 162 EXPECT_FALSE(anim->isFinishedAt(0)); |
| 163 anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); | 163 anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); |
| 164 EXPECT_FALSE(anim->isFinishedAt(0)); | 164 EXPECT_FALSE(anim->isFinishedAt(0)); |
| 165 anim->setRunState(CCActiveAnimation::Finished, 0); | 165 anim->setRunState(CCActiveAnimation::Finished, 0); |
| 166 EXPECT_TRUE(anim->isFinishedAt(0)); | 166 EXPECT_TRUE(anim->isFinishedAt(0)); |
| 167 anim->setRunState(CCActiveAnimation::Aborted, 0); | 167 anim->setRunState(CCActiveAnimation::Aborted, 0); |
| 168 EXPECT_TRUE(anim->isFinishedAt(0)); | 168 EXPECT_TRUE(anim->isFinishedAt(0)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 TEST(CCActiveAnimationTest, IsFinished) | 171 TEST(CCActiveAnimationTest, IsFinished) |
| 172 { | 172 { |
| 173 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 173 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 174 anim->setRunState(CCActiveAnimation::Running, 0); | 174 anim->setRunState(CCActiveAnimation::Running, 0); |
| 175 EXPECT_FALSE(anim->isFinished()); | 175 EXPECT_FALSE(anim->isFinished()); |
| 176 anim->setRunState(CCActiveAnimation::Paused, 0); | 176 anim->setRunState(CCActiveAnimation::Paused, 0); |
| 177 EXPECT_FALSE(anim->isFinished()); | 177 EXPECT_FALSE(anim->isFinished()); |
| 178 anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); | 178 anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); |
| 179 EXPECT_FALSE(anim->isFinished()); | 179 EXPECT_FALSE(anim->isFinished()); |
| 180 anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); | 180 anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); |
| 181 EXPECT_FALSE(anim->isFinished()); | 181 EXPECT_FALSE(anim->isFinished()); |
| 182 anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); | 182 anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); |
| 183 EXPECT_FALSE(anim->isFinished()); | 183 EXPECT_FALSE(anim->isFinished()); |
| 184 anim->setRunState(CCActiveAnimation::Finished, 0); | 184 anim->setRunState(CCActiveAnimation::Finished, 0); |
| 185 EXPECT_TRUE(anim->isFinished()); | 185 EXPECT_TRUE(anim->isFinished()); |
| 186 anim->setRunState(CCActiveAnimation::Aborted, 0); | 186 anim->setRunState(CCActiveAnimation::Aborted, 0); |
| 187 EXPECT_TRUE(anim->isFinished()); | 187 EXPECT_TRUE(anim->isFinished()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST(CCActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime) | 190 TEST(CCActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime) |
| 191 { | 191 { |
| 192 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 192 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 193 anim->setRunState(CCActiveAnimation::Running, 2); | 193 anim->setRunState(CCActiveAnimation::Running, 2); |
| 194 EXPECT_FALSE(anim->isFinished()); | 194 EXPECT_FALSE(anim->isFinished()); |
| 195 anim->setRunState(CCActiveAnimation::Paused, 2); | 195 anim->setRunState(CCActiveAnimation::Paused, 2); |
| 196 EXPECT_FALSE(anim->isFinished()); | 196 EXPECT_FALSE(anim->isFinished()); |
| 197 anim->setRunState(CCActiveAnimation::WaitingForNextTick, 2); | 197 anim->setRunState(CCActiveAnimation::WaitingForNextTick, 2); |
| 198 EXPECT_FALSE(anim->isFinished()); | 198 EXPECT_FALSE(anim->isFinished()); |
| 199 anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 2); | 199 anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 2); |
| 200 EXPECT_FALSE(anim->isFinished()); | 200 EXPECT_FALSE(anim->isFinished()); |
| 201 anim->setRunState(CCActiveAnimation::WaitingForStartTime, 2); | 201 anim->setRunState(CCActiveAnimation::WaitingForStartTime, 2); |
| 202 EXPECT_FALSE(anim->isFinished()); | 202 EXPECT_FALSE(anim->isFinished()); |
| 203 anim->setRunState(CCActiveAnimation::Finished, 0); | 203 anim->setRunState(CCActiveAnimation::Finished, 0); |
| 204 EXPECT_TRUE(anim->isFinished()); | 204 EXPECT_TRUE(anim->isFinished()); |
| 205 anim->setRunState(CCActiveAnimation::Aborted, 0); | 205 anim->setRunState(CCActiveAnimation::Aborted, 0); |
| 206 EXPECT_TRUE(anim->isFinished()); | 206 EXPECT_TRUE(anim->isFinished()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 TEST(CCActiveAnimationTest, RunStateChangesIgnoredWhileSuspended) | 209 TEST(CCActiveAnimationTest, RunStateChangesIgnoredWhileSuspended) |
| 210 { | 210 { |
| 211 OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); | 211 scoped_ptr<CCActiveAnimation> anim(createActiveAnimation(1)); |
| 212 anim->suspend(0); | 212 anim->suspend(0); |
| 213 EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); | 213 EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); |
| 214 anim->setRunState(CCActiveAnimation::Running, 0); | 214 anim->setRunState(CCActiveAnimation::Running, 0); |
| 215 EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); | 215 EXPECT_EQ(CCActiveAnimation::Paused, anim->runState()); |
| 216 anim->resume(0); | 216 anim->resume(0); |
| 217 anim->setRunState(CCActiveAnimation::Running, 0); | 217 anim->setRunState(CCActiveAnimation::Running, 0); |
| 218 EXPECT_EQ(CCActiveAnimation::Running, anim->runState()); | 218 EXPECT_EQ(CCActiveAnimation::Running, anim->runState()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace | 221 } // namespace |
| OLD | NEW |