OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeNegativeWithoutSimultaneousPl
aybackRateChange) | 155 TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeNegativeWithoutSimultaneousPl
aybackRateChange) |
156 { | 156 { |
157 simulateFrame(20); | 157 simulateFrame(20); |
158 EXPECT_EQ(20, player->currentTimeInternal()); | 158 EXPECT_EQ(20, player->currentTimeInternal()); |
159 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); | 159 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); |
160 player->setPlaybackRate(-1); | 160 player->setPlaybackRate(-1); |
161 EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal()); | 161 EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal()); |
162 simulateFrame(30); | 162 simulateFrame(30); |
163 EXPECT_EQ(20, player->currentTimeInternal()); | 163 EXPECT_EQ(20, player->currentTimeInternal()); |
164 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); | 164 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); |
165 player->setCurrentTimeInternal(-10); | 165 player->setCurrentTime(-10 * 1000); |
166 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); | 166 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); |
167 } | 167 } |
168 | 168 |
169 TEST_F(AnimationAnimationPlayerTest, SetCurrentTimePastContentEnd) | 169 TEST_F(AnimationAnimationPlayerTest, SetCurrentTimePastContentEnd) |
170 { | 170 { |
171 player->setCurrentTimeInternal(50); | 171 player->setCurrentTime(50 * 1000); |
172 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); | 172 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); |
173 EXPECT_EQ(50, player->currentTimeInternal()); | 173 EXPECT_EQ(50, player->currentTimeInternal()); |
174 simulateFrame(20); | 174 simulateFrame(20); |
175 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); | 175 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); |
176 EXPECT_EQ(50, player->currentTimeInternal()); | 176 EXPECT_EQ(50, player->currentTimeInternal()); |
177 | 177 |
178 player->setPlaybackRate(-2); | 178 player->setPlaybackRate(-2); |
179 player->setCurrentTimeInternal(50); | 179 player->setCurrentTime(50 * 1000); |
180 EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal()); | 180 EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal()); |
181 EXPECT_EQ(50, player->currentTimeInternal()); | 181 EXPECT_EQ(50, player->currentTimeInternal()); |
182 simulateFrame(20); | 182 simulateFrame(20); |
183 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); | 183 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); |
184 simulateFrame(40); | 184 simulateFrame(40); |
185 EXPECT_EQ(10, player->currentTimeInternal()); | 185 EXPECT_EQ(10, player->currentTimeInternal()); |
186 } | 186 } |
187 | 187 |
188 TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeBeforeTimelineStarted) | 188 TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeBeforeTimelineStarted) |
189 { | 189 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 simulateFrame(1); | 233 simulateFrame(1); |
234 EXPECT_EQ(-1000, player->startTime()); | 234 EXPECT_EQ(-1000, player->startTime()); |
235 EXPECT_EQ(2000, player->currentTime()); | 235 EXPECT_EQ(2000, player->currentTime()); |
236 } | 236 } |
237 | 237 |
238 TEST_F(AnimationAnimationPlayerTest, SetStartTime) | 238 TEST_F(AnimationAnimationPlayerTest, SetStartTime) |
239 { | 239 { |
240 simulateFrame(20); | 240 simulateFrame(20); |
241 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); | 241 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); |
242 EXPECT_EQ(0, player->startTimeInternal()); | 242 EXPECT_EQ(0, player->startTimeInternal()); |
243 EXPECT_EQ(20, player->currentTimeInternal()); | 243 EXPECT_EQ(20 * 1000, player->currentTime()); |
244 player->setStartTime(10 * 1000); | 244 player->setStartTime(10 * 1000); |
245 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); | 245 EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal()); |
246 EXPECT_EQ(10, player->startTimeInternal()); | 246 EXPECT_EQ(10, player->startTimeInternal()); |
247 EXPECT_EQ(10, player->currentTimeInternal()); | 247 EXPECT_EQ(10 * 1000, player->currentTime()); |
248 simulateFrame(30); | 248 simulateFrame(30); |
249 EXPECT_EQ(10, player->startTimeInternal()); | 249 EXPECT_EQ(10, player->startTimeInternal()); |
250 EXPECT_EQ(20, player->currentTimeInternal()); | 250 EXPECT_EQ(20 * 1000, player->currentTime()); |
251 player->setStartTime(-20 * 1000); | 251 player->setStartTime(-20 * 1000); |
252 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); | 252 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); |
253 } | 253 } |
254 | 254 |
255 TEST_F(AnimationAnimationPlayerTest, SetStartTimeLimitsAnimationPlayer) | 255 TEST_F(AnimationAnimationPlayerTest, SetStartTimeLimitsAnimationPlayer) |
256 { | 256 { |
257 player->setStartTime(-50 * 1000); | 257 player->setStartTime(-50 * 1000); |
258 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); | 258 EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal()); |
259 EXPECT_EQ(30, player->currentTimeInternal()); | 259 EXPECT_EQ(30, player->currentTimeInternal()); |
260 player->setPlaybackRate(-1); | 260 player->setPlaybackRate(-1); |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 EXPECT_EQ(AnimationPlayer::Idle, player->playStateInternal()); | 882 EXPECT_EQ(AnimationPlayer::Idle, player->playStateInternal()); |
883 EXPECT_TRUE(std::isnan(player->currentTime())); | 883 EXPECT_TRUE(std::isnan(player->currentTime())); |
884 EXPECT_TRUE(std::isnan(player->startTime())); | 884 EXPECT_TRUE(std::isnan(player->startTime())); |
885 player->pause(); | 885 player->pause(); |
886 EXPECT_EQ(AnimationPlayer::Idle, player->playStateInternal()); | 886 EXPECT_EQ(AnimationPlayer::Idle, player->playStateInternal()); |
887 EXPECT_TRUE(std::isnan(player->currentTime())); | 887 EXPECT_TRUE(std::isnan(player->currentTime())); |
888 EXPECT_TRUE(std::isnan(player->startTime())); | 888 EXPECT_TRUE(std::isnan(player->startTime())); |
889 } | 889 } |
890 | 890 |
891 } | 891 } |
OLD | NEW |