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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 448 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
449 m_timing.iterationCount = 4.0; | 449 m_timing.iterationCount = 4.0; |
450 m_timing.iterationDuration = 5.0; | 450 m_timing.iterationDuration = 5.0; |
451 m_timing.startDelay = -11.0; | 451 m_timing.startDelay = -11.0; |
452 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 452 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
453 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset); | 453 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset); |
454 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); | 454 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); |
455 EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateRe
verse); | 455 EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateRe
verse); |
456 } | 456 } |
457 | 457 |
458 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingTimingFunctionPassThru) | |
459 { | |
460 m_timing.timingFunction = m_stepTimingFunction; | |
461 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect2.get())); | |
462 } | |
463 | |
464 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionLinear) | 458 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionLinear) |
465 { | 459 { |
466 m_timing.timingFunction = m_linearTimingFunction; | 460 m_timing.timingFunction = m_linearTimingFunction; |
467 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 461 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
468 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 462 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
469 } | 463 } |
470 | 464 |
471 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionCubic) | 465 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionCubic) |
472 { | 466 { |
473 m_timing.timingFunction = m_cubicEaseTimingFunction; | 467 m_timing.timingFunction = m_cubicEaseTimingFunction; |
474 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 468 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
475 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 469 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); |
476 | 470 |
477 m_timing.timingFunction = m_cubicCustomTimingFunction; | 471 m_timing.timingFunction = m_cubicCustomTimingFunction; |
478 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 472 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
479 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 473 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); |
480 } | 474 } |
481 | 475 |
482 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionSteps) | 476 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionSteps) |
483 { | 477 { |
484 m_timing.timingFunction = m_stepTimingFunction; | 478 m_timing.timingFunction = m_stepTimingFunction; |
485 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect2.get())); | 479 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
486 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 480 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); |
487 } | 481 } |
488 | 482 |
489 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionChainedLinear) | 483 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionChainedLinear) |
490 { | 484 { |
491 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 485 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
492 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 486 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
493 } | 487 } |
494 | 488 |
495 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorNon
LinearTimingFunctionOnFirstFrame) | 489 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorNon
LinearTimingFunctionOnFirstFrame) |
(...skipping 28 matching lines...) Expand all Loading... |
524 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionMixedGood) | 518 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionMixedGood) |
525 { | 519 { |
526 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); | 520 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); |
527 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); | 521 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); |
528 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 522 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
529 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); | 523 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); |
530 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); | 524 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
531 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 525 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
532 } | 526 } |
533 | 527 |
534 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionWithStepNotOkay) | 528 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionWithStepOkay) |
535 { | 529 { |
536 (*m_keyframeVector2)[0]->setEasing(m_stepTimingFunction.get()); | 530 (*m_keyframeVector2)[0]->setEasing(m_stepTimingFunction.get()); |
537 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector2); | 531 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector2); |
538 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect2.get())); | 532 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
539 | 533 |
540 (*m_keyframeVector5)[0]->setEasing(m_stepTimingFunction.get()); | 534 (*m_keyframeVector5)[0]->setEasing(m_stepTimingFunction.get()); |
541 (*m_keyframeVector5)[1]->setEasing(m_linearTimingFunction.get()); | 535 (*m_keyframeVector5)[1]->setEasing(m_linearTimingFunction.get()); |
542 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 536 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
543 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); | 537 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); |
544 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); | 538 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
545 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 539 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
546 | 540 |
547 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); | 541 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); |
548 (*m_keyframeVector5)[1]->setEasing(m_stepTimingFunction.get()); | 542 (*m_keyframeVector5)[1]->setEasing(m_stepTimingFunction.get()); |
549 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 543 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
550 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); | 544 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); |
551 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); | 545 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
552 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 546 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
553 | 547 |
554 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); | 548 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); |
555 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); | 549 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); |
556 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 550 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
557 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); | 551 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); |
558 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); | 552 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
559 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 553 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
560 } | 554 } |
561 | 555 |
562 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) | 556 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) |
563 { | 557 { |
564 Timing linearTiming(createCompositableTiming()); | 558 Timing linearTiming(createCompositableTiming()); |
565 | 559 |
566 AnimatableValueKeyframeVector basicFramesVector; | 560 AnimatableValueKeyframeVector basicFramesVector; |
567 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 0.0).get()); | 561 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 0.0).get()); |
568 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 1.0).get()); | 562 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 1.0).get()); |
569 | 563 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 | 1093 |
1100 // Go! | 1094 // Go! |
1101 setCompositorForTesting(mockCompositor); | 1095 setCompositorForTesting(mockCompositor); |
1102 Vector<OwnPtr<WebCompositorAnimation> > result; | 1096 Vector<OwnPtr<WebCompositorAnimation> > result; |
1103 getAnimationOnCompositor(m_timing, *effect.get(), result); | 1097 getAnimationOnCompositor(m_timing, *effect.get(), result); |
1104 EXPECT_EQ(1U, result.size()); | 1098 EXPECT_EQ(1U, result.size()); |
1105 result[0].clear(); | 1099 result[0].clear(); |
1106 } | 1100 } |
1107 | 1101 |
1108 } // namespace blink | 1102 } // namespace blink |
OLD | NEW |