| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 TEST(AnimationKeyframeEffectModel, CompositeReplace) | 119 TEST(AnimationKeyframeEffectModel, CompositeReplace) |
| 120 { | 120 { |
| 121 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); | 121 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); |
| 122 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 122 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); |
| 123 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 123 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); |
| 124 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 124 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 125 expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, effect->sample(0, 0.6)->at(0)); | 125 expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, effect->sample(0, 0.6)->at(0)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 128 TEST(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) | 129 TEST(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) |
| 129 { | 130 { |
| 130 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); | 131 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); |
| 131 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 132 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); |
| 132 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 133 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); |
| 133 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 134 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 134 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, effect->sample(0, 0
.6)->at(0)); | 135 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, effect->sample(0, 0
.6)->at(0)); |
| 135 } | 136 } |
| 136 | 137 |
| 137 TEST(AnimationKeyframeEffectModel, CompositeEaseIn) | 138 TEST(AnimationKeyframeEffectModel, CompositeEaseIn) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 167 | 168 |
| 168 TEST(AnimationKeyframeEffectModel, ExtrapolateReplace) | 169 TEST(AnimationKeyframeEffectModel, ExtrapolateReplace) |
| 169 { | 170 { |
| 170 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); | 171 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); |
| 171 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 172 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 172 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 173 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); |
| 173 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 174 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); |
| 174 expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, effect->sample(0, 1.6)->at(0)); | 175 expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, effect->sample(0, 1.6)->at(0)); |
| 175 } | 176 } |
| 176 | 177 |
| 178 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 177 TEST(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) | 179 TEST(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) |
| 178 { | 180 { |
| 179 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); | 181 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); |
| 180 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 182 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); |
| 181 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 183 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); |
| 182 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 184 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 183 expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, effect->sample(0,
1.6)->at(0)); | 185 expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, effect->sample(0,
1.6)->at(0)); |
| 184 } | 186 } |
| 185 | 187 |
| 186 TEST(AnimationKeyframeEffectModel, ZeroKeyframes) | 188 TEST(AnimationKeyframeEffectModel, ZeroKeyframes) |
| 187 { | 189 { |
| 188 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(KeyframeEffectModel::KeyframeVector()); | 190 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(KeyframeEffectModel::KeyframeVector()); |
| 189 EXPECT_TRUE(effect->sample(0, 0.5)->isEmpty()); | 191 EXPECT_TRUE(effect->sample(0, 0.5)->isEmpty()); |
| 190 } | 192 } |
| 191 | 193 |
| 192 TEST(AnimationKeyframeEffectModel, SingleKeyframeAtOffsetZero) | 194 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 195 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetZero) |
| 193 { | 196 { |
| 194 KeyframeEffectModel::KeyframeVector keyframes(1); | 197 KeyframeEffectModel::KeyframeVector keyframes(1); |
| 195 keyframes[0] = Keyframe::create(); | 198 keyframes[0] = Keyframe::create(); |
| 196 keyframes[0]->setOffset(0.0); | 199 keyframes[0]->setOffset(0.0); |
| 197 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0).
get()); | 200 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0).
get()); |
| 198 | 201 |
| 199 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 202 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 200 expectDoubleValue(3.0, effect->sample(0, 0.6)->at(0)); | 203 expectDoubleValue(3.0, effect->sample(0, 0.6)->at(0)); |
| 201 } | 204 } |
| 202 | 205 |
| 206 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 203 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetOne) | 207 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetOne) |
| 204 { | 208 { |
| 205 KeyframeEffectModel::KeyframeVector keyframes(1); | 209 KeyframeEffectModel::KeyframeVector keyframes(1); |
| 206 keyframes[0] = Keyframe::create(); | 210 keyframes[0] = Keyframe::create(); |
| 207 keyframes[0]->setOffset(1.0); | 211 keyframes[0]->setOffset(1.0); |
| 208 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge
t()); | 212 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge
t()); |
| 209 | 213 |
| 210 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 214 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 211 expectDoubleValue(7.0 * 0.4 + 5.0 * 0.6, effect->sample(0, 0.6)->at(0)); | 215 expectDoubleValue(7.0 * 0.4 + 5.0 * 0.6, effect->sample(0, 0.6)->at(0)); |
| 212 } | 216 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0).
get()); | 264 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0).
get()); |
| 261 | 265 |
| 262 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 266 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 263 expectDoubleValue(3.0, effect->sample(0, 0.0)->at(0)); | 267 expectDoubleValue(3.0, effect->sample(0, 0.0)->at(0)); |
| 264 expectDoubleValue(4.0, effect->sample(0, 0.5)->at(0)); | 268 expectDoubleValue(4.0, effect->sample(0, 0.5)->at(0)); |
| 265 expectDoubleValue(5.0, effect->sample(0, 1.0)->at(0)); | 269 expectDoubleValue(5.0, effect->sample(0, 1.0)->at(0)); |
| 266 } | 270 } |
| 267 | 271 |
| 268 TEST(AnimationKeyframeEffectModel, MultipleKeyframesWithSameOffset) | 272 TEST(AnimationKeyframeEffectModel, MultipleKeyframesWithSameOffset) |
| 269 { | 273 { |
| 270 KeyframeEffectModel::KeyframeVector keyframes(7); | 274 KeyframeEffectModel::KeyframeVector keyframes(9); |
| 271 keyframes[0] = Keyframe::create(); | 275 keyframes[0] = Keyframe::create(); |
| 272 keyframes[0]->setOffset(0.1); | 276 keyframes[0]->setOffset(0.0); |
| 273 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(1.0).
get()); | 277 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(0.0).
get()); |
| 274 keyframes[1] = Keyframe::create(); | 278 keyframes[1] = Keyframe::create(); |
| 275 keyframes[1]->setOffset(0.1); | 279 keyframes[1]->setOffset(0.1); |
| 276 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(2.0).
get()); | 280 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(1.0).
get()); |
| 277 keyframes[2] = Keyframe::create(); | 281 keyframes[2] = Keyframe::create(); |
| 278 keyframes[2]->setOffset(0.5); | 282 keyframes[2]->setOffset(0.1); |
| 279 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0).
get()); | 283 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(2.0).
get()); |
| 280 keyframes[3] = Keyframe::create(); | 284 keyframes[3] = Keyframe::create(); |
| 281 keyframes[3]->setOffset(0.5); | 285 keyframes[3]->setOffset(0.5); |
| 282 keyframes[3]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0).
get()); | 286 keyframes[3]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0).
get()); |
| 283 keyframes[4] = Keyframe::create(); | 287 keyframes[4] = Keyframe::create(); |
| 284 keyframes[4]->setOffset(0.5); | 288 keyframes[4]->setOffset(0.5); |
| 285 keyframes[4]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0).
get()); | 289 keyframes[4]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0).
get()); |
| 286 keyframes[5] = Keyframe::create(); | 290 keyframes[5] = Keyframe::create(); |
| 287 keyframes[5]->setOffset(0.9); | 291 keyframes[5]->setOffset(0.5); |
| 288 keyframes[5]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(6.0).
get()); | 292 keyframes[5]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0).
get()); |
| 289 keyframes[6] = Keyframe::create(); | 293 keyframes[6] = Keyframe::create(); |
| 290 keyframes[6]->setOffset(0.9); | 294 keyframes[6]->setOffset(0.9); |
| 291 keyframes[6]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0).
get()); | 295 keyframes[6]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(6.0).
get()); |
| 296 keyframes[7] = Keyframe::create(); |
| 297 keyframes[7]->setOffset(0.9); |
| 298 keyframes[7]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0).
get()); |
| 299 keyframes[8] = Keyframe::create(); |
| 300 keyframes[8]->setOffset(1.0); |
| 301 keyframes[8]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0).
get()); |
| 292 | 302 |
| 293 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 303 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 294 expectDoubleValue(2.0, effect->sample(0, 0.0)->at(0)); | 304 expectDoubleValue(0.0, effect->sample(0, 0.0)->at(0)); |
| 295 expectDoubleValue(2.0, effect->sample(0, 0.2)->at(0)); | 305 expectDoubleValue(2.0, effect->sample(0, 0.2)->at(0)); |
| 296 expectDoubleValue(3.0, effect->sample(0, 0.4)->at(0)); | 306 expectDoubleValue(3.0, effect->sample(0, 0.4)->at(0)); |
| 297 expectDoubleValue(5.0, effect->sample(0, 0.5)->at(0)); | 307 expectDoubleValue(5.0, effect->sample(0, 0.5)->at(0)); |
| 298 expectDoubleValue(5.0, effect->sample(0, 0.6)->at(0)); | 308 expectDoubleValue(5.0, effect->sample(0, 0.6)->at(0)); |
| 299 expectDoubleValue(6.0, effect->sample(0, 0.8)->at(0)); | 309 expectDoubleValue(6.0, effect->sample(0, 0.8)->at(0)); |
| 300 expectDoubleValue(6.0, effect->sample(0, 1.0)->at(0)); | 310 expectDoubleValue(7.0, effect->sample(0, 1.0)->at(0)); |
| 301 } | 311 } |
| 302 | 312 |
| 313 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 303 TEST(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) | 314 TEST(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) |
| 304 { | 315 { |
| 305 KeyframeEffectModel::KeyframeVector keyframes(2); | 316 KeyframeEffectModel::KeyframeVector keyframes(2); |
| 306 keyframes[0] = Keyframe::create(); | 317 keyframes[0] = Keyframe::create(); |
| 307 keyframes[0]->setOffset(0.0); | 318 keyframes[0]->setOffset(0.0); |
| 308 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0).ge
t()); | 319 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0).ge
t()); |
| 309 keyframes[1] = Keyframe::create(); | 320 keyframes[1] = Keyframe::create(); |
| 310 keyframes[1]->setOffset(1.0); | 321 keyframes[1]->setOffset(1.0); |
| 311 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge
t()); | 322 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge
t()); |
| 312 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 323 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 331 OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6); | 342 OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6); |
| 332 EXPECT_EQ(2UL, values->size()); | 343 EXPECT_EQ(2UL, values->size()); |
| 333 Interpolation* leftValue = findValue(*values.get(), CSSPropertyLeft); | 344 Interpolation* leftValue = findValue(*values.get(), CSSPropertyLeft); |
| 334 ASSERT_TRUE(leftValue); | 345 ASSERT_TRUE(leftValue); |
| 335 expectDoubleValue(5.0, leftValue); | 346 expectDoubleValue(5.0, leftValue); |
| 336 Interpolation* rightValue = findValue(*values.get(), CSSPropertyRight); | 347 Interpolation* rightValue = findValue(*values.get(), CSSPropertyRight); |
| 337 ASSERT_TRUE(rightValue); | 348 ASSERT_TRUE(rightValue); |
| 338 expectDoubleValue(6.0, rightValue); | 349 expectDoubleValue(6.0, rightValue); |
| 339 } | 350 } |
| 340 | 351 |
| 352 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 341 TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) | 353 TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) |
| 342 { | 354 { |
| 343 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); | 355 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(3.0), pixelAnimatableValue(5.0)); |
| 344 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 356 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); |
| 345 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 357 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); |
| 346 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 358 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 347 OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6); | 359 OwnPtr<Vector<RefPtr<Interpolation> > > values = effect->sample(0, 0.6); |
| 348 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 360 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 349 expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); | 361 expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); |
| 350 } | 362 } |
| 351 | 363 |
| 352 TEST(AnimationKeyframeEffectModel, MultipleIterations) | 364 TEST(AnimationKeyframeEffectModel, MultipleIterations) |
| 353 { | 365 { |
| 354 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(1.0), pixelAnimatableValue(3.0)); | 366 KeyframeEffectModel::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelA
nimatableValue(1.0), pixelAnimatableValue(3.0)); |
| 355 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 367 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 356 expectDoubleValue(2.0, effect->sample(0, 0.5)->at(0)); | 368 expectDoubleValue(2.0, effect->sample(0, 0.5)->at(0)); |
| 357 expectDoubleValue(2.0, effect->sample(1, 0.5)->at(0)); | 369 expectDoubleValue(2.0, effect->sample(1, 0.5)->at(0)); |
| 358 expectDoubleValue(2.0, effect->sample(2, 0.5)->at(0)); | 370 expectDoubleValue(2.0, effect->sample(2, 0.5)->at(0)); |
| 359 } | 371 } |
| 360 | 372 |
| 373 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 361 TEST(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) | 374 TEST(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) |
| 362 { | 375 { |
| 363 KeyframeEffectModel::KeyframeVector keyframes(3); | 376 KeyframeEffectModel::KeyframeVector keyframes(3); |
| 364 keyframes[0] = Keyframe::create(); | 377 keyframes[0] = Keyframe::create(); |
| 365 keyframes[0]->setOffset(0.0); | 378 keyframes[0]->setOffset(0.0); |
| 366 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); | 379 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); |
| 367 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 380 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); |
| 368 keyframes[1] = Keyframe::create(); | 381 keyframes[1] = Keyframe::create(); |
| 369 keyframes[1]->setOffset(0.5); | 382 keyframes[1]->setOffset(0.5); |
| 370 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); | 383 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); |
| 371 keyframes[2] = Keyframe::create(); | 384 keyframes[2] = Keyframe::create(); |
| 372 keyframes[2]->setOffset(1.0); | 385 keyframes[2]->setOffset(1.0); |
| 373 keyframes[2]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); | 386 keyframes[2]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); |
| 374 | 387 |
| 375 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 388 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 376 EXPECT_TRUE(effect->sample(0, 0)->at(0)); | 389 EXPECT_TRUE(effect->sample(0, 0)->at(0)); |
| 377 EXPECT_TRUE(effect->sample(0, 0.1)->at(0)); | 390 EXPECT_TRUE(effect->sample(0, 0.1)->at(0)); |
| 378 EXPECT_TRUE(effect->sample(0, 0.25)->at(0)); | 391 EXPECT_TRUE(effect->sample(0, 0.25)->at(0)); |
| 379 EXPECT_TRUE(effect->sample(0, 0.4)->at(0)); | 392 EXPECT_TRUE(effect->sample(0, 0.4)->at(0)); |
| 380 EXPECT_FALSE(effect->sample(0, 0.5)->at(0)); | 393 EXPECT_FALSE(effect->sample(0, 0.5)->at(0)); |
| 381 EXPECT_FALSE(effect->sample(0, 0.6)->at(0)); | 394 EXPECT_FALSE(effect->sample(0, 0.6)->at(0)); |
| 382 EXPECT_FALSE(effect->sample(0, 0.75)->at(0)); | 395 EXPECT_FALSE(effect->sample(0, 0.75)->at(0)); |
| 383 EXPECT_FALSE(effect->sample(0, 0.8)->at(0)); | 396 EXPECT_FALSE(effect->sample(0, 0.8)->at(0)); |
| 384 EXPECT_FALSE(effect->sample(0, 1)->at(0)); | 397 EXPECT_FALSE(effect->sample(0, 1)->at(0)); |
| 385 } | 398 } |
| 386 | 399 |
| 400 TEST(AnimationKeyframeEffectModel, AddSyntheticKeyframes) |
| 401 { |
| 402 KeyframeEffectModel::KeyframeVector keyframes(1); |
| 403 keyframes[0] = Keyframe::create(); |
| 404 keyframes[0]->setOffset(0.5); |
| 405 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0).
get()); |
| 406 |
| 407 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 408 const KeyframeEffectModel::PropertySpecificKeyframeVector& propertySpecificK
eyframes = effect->getPropertySpecificKeyframes(CSSPropertyLeft); |
| 409 EXPECT_EQ(3U, propertySpecificKeyframes.size()); |
| 410 EXPECT_DOUBLE_EQ(0.0, propertySpecificKeyframes[0]->offset()); |
| 411 EXPECT_DOUBLE_EQ(0.5, propertySpecificKeyframes[1]->offset()); |
| 412 EXPECT_DOUBLE_EQ(1.0, propertySpecificKeyframes[2]->offset()); |
| 413 } |
| 414 |
| 387 TEST(AnimationKeyframeEffectModel, ToKeyframeEffectModel) | 415 TEST(AnimationKeyframeEffectModel, ToKeyframeEffectModel) |
| 388 { | 416 { |
| 389 KeyframeEffectModel::KeyframeVector keyframes(0); | 417 KeyframeEffectModel::KeyframeVector keyframes(0); |
| 390 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 418 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); |
| 391 | 419 |
| 392 AnimationEffect* baseEffect = effect.get(); | 420 AnimationEffect* baseEffect = effect.get(); |
| 393 EXPECT_TRUE(toKeyframeEffectModel(baseEffect)); | 421 EXPECT_TRUE(toKeyframeEffectModel(baseEffect)); |
| 394 } | 422 } |
| 395 | 423 |
| 396 } // namespace | 424 } // namespace |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); | 552 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); |
| 525 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); | 553 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); |
| 526 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); | 554 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); |
| 527 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); | 555 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); |
| 528 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); | 556 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); |
| 529 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); | 557 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); |
| 530 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); | 558 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); |
| 531 } | 559 } |
| 532 | 560 |
| 533 } // namespace WebCore | 561 } // namespace WebCore |
| OLD | NEW |