Chromium Code Reviews| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0)) ; | 308 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0)) ; |
| 309 keyframes[0]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(4.0) ); | 309 keyframes[0]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(4.0) ); |
| 310 keyframes[1] = Keyframe::create(); | 310 keyframes[1] = Keyframe::create(); |
| 311 keyframes[1]->setOffset(1.0); | 311 keyframes[1]->setOffset(1.0); |
| 312 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0)) ; | 312 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0)) ; |
| 313 keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0) ); | 313 keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0) ); |
| 314 | 314 |
| 315 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); | 315 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); |
| 316 OwnPtr<AnimationEffect::CompositableValueList> values = effect->sample(0, 0. 6); | 316 OwnPtr<AnimationEffect::CompositableValueList> values = effect->sample(0, 0. 6); |
| 317 ASSERT_EQ(2UL, values->size()); | 317 ASSERT_EQ(2UL, values->size()); |
| 318 EXPECT_TRUE(values->at(0).first == CSSPropertyLeft); | 318 for (size_t i = 0; i < 2; ++i) { |
| 319 expectDoubleValue(5.0, values->at(0).second->compositeOnto(unknownAnimatable Value(7.0))); | 319 std::pair<CSSPropertyID, RefPtr<AnimationEffect::CompositableValue> >& v alue = values->at(i); |
| 320 EXPECT_TRUE(values->at(1).first == CSSPropertyRight); | 320 switch (value.first) { |
| 321 expectDoubleValue(6.0, values->at(1).second->compositeOnto(unknownAnimatable Value(7.0))); | 321 case CSSPropertyLeft: |
| 322 expectDoubleValue(5.0, value.second->compositeOnto(unknownAnimatable Value(7.0))); | |
| 323 break; | |
| 324 case CSSPropertyRight: | |
| 325 expectDoubleValue(6.0, value.second->compositeOnto(unknownAnimatable Value(7.0))); | |
| 326 break; | |
| 327 default: | |
| 328 ADD_FAILURE(); | |
| 329 } | |
| 330 } | |
|
Julien - ping for review
2013/12/16 07:25:10
Wouldn't this still pass if you have 2 'right' or
Steve Block
2013/12/16 23:23:52
Yes, it would. I didn't bother guarding against th
| |
| 322 } | 331 } |
| 323 | 332 |
| 324 TEST(AnimationKeyframeAnimationEffectTest, RecompositeCompositableValue) | 333 TEST(AnimationKeyframeAnimationEffectTest, RecompositeCompositableValue) |
| 325 { | 334 { |
| 326 KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pi xelAnimatableValue(3.0), pixelAnimatableValue(5.0)); | 335 KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pi xelAnimatableValue(3.0), pixelAnimatableValue(5.0)); |
| 327 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 336 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); |
| 328 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 337 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); |
| 329 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); | 338 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); |
| 330 OwnPtr<AnimationEffect::CompositableValueList> values = effect->sample(0, 0. 6); | 339 OwnPtr<AnimationEffect::CompositableValueList> values = effect->sample(0, 0. 6); |
| 331 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0).secon d->compositeOnto(pixelAnimatableValue(7.0))); | 340 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0).secon d->compositeOnto(pixelAnimatableValue(7.0))); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 TEST(AnimationKeyframeAnimationEffectTest, ToKeyframeAnimationEffect) | 379 TEST(AnimationKeyframeAnimationEffectTest, ToKeyframeAnimationEffect) |
| 371 { | 380 { |
| 372 KeyframeAnimationEffect::KeyframeVector keyframes(0); | 381 KeyframeAnimationEffect::KeyframeVector keyframes(0); |
| 373 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); | 382 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); |
| 374 | 383 |
| 375 AnimationEffect* baseEffect = effect.get(); | 384 AnimationEffect* baseEffect = effect.get(); |
| 376 EXPECT_TRUE(toKeyframeAnimationEffect(baseEffect)); | 385 EXPECT_TRUE(toKeyframeAnimationEffect(baseEffect)); |
| 377 } | 386 } |
| 378 | 387 |
| 379 } // namespace | 388 } // namespace |
| OLD | NEW |