OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/animation/CompositorAnimation.h" | 5 #include "platform/animation/CompositorAnimation.h" |
6 | 6 |
7 #include "platform/animation/CompositorFloatAnimationCurve.h" | 7 #include "platform/animation/CompositorFloatAnimationCurve.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 TEST(WebCompositorAnimationTest, DefaultSettings) | 12 TEST(WebCompositorAnimationTest, DefaultSettings) |
13 { | 13 { |
14 scoped_ptr<CompositorAnimationCurve> curve(new CompositorFloatAnimationCurve
()); | 14 scoped_ptr<CompositorAnimationCurve> curve(new CompositorFloatAnimationCurve
()); |
15 scoped_ptr<CompositorAnimation> animation(new CompositorAnimation( | 15 scoped_ptr<CompositorAnimation> animation(new CompositorAnimation( |
16 *curve, CompositorAnimation::TargetPropertyOpacity, 1, 0)); | 16 *curve, CompositorTargetProperty::OPACITY, 1, 0)); |
17 | 17 |
18 // Ensure that the defaults are correct. | 18 // Ensure that the defaults are correct. |
19 EXPECT_EQ(1, animation->iterations()); | 19 EXPECT_EQ(1, animation->iterations()); |
20 EXPECT_EQ(0, animation->startTime()); | 20 EXPECT_EQ(0, animation->startTime()); |
21 EXPECT_EQ(0, animation->timeOffset()); | 21 EXPECT_EQ(0, animation->timeOffset()); |
22 EXPECT_EQ(CompositorAnimation::DirectionNormal, animation->direction()); | 22 EXPECT_EQ(CompositorAnimation::DirectionNormal, animation->direction()); |
23 } | 23 } |
24 | 24 |
25 TEST(WebCompositorAnimationTest, ModifiedSettings) | 25 TEST(WebCompositorAnimationTest, ModifiedSettings) |
26 { | 26 { |
27 scoped_ptr<CompositorFloatAnimationCurve> curve(new CompositorFloatAnimation
Curve()); | 27 scoped_ptr<CompositorFloatAnimationCurve> curve(new CompositorFloatAnimation
Curve()); |
28 scoped_ptr<CompositorAnimation> animation(new CompositorAnimation( | 28 scoped_ptr<CompositorAnimation> animation(new CompositorAnimation( |
29 *curve, CompositorAnimation::TargetPropertyOpacity, 1, 0)); | 29 *curve, CompositorTargetProperty::OPACITY, 1, 0)); |
30 animation->setIterations(2); | 30 animation->setIterations(2); |
31 animation->setStartTime(2); | 31 animation->setStartTime(2); |
32 animation->setTimeOffset(2); | 32 animation->setTimeOffset(2); |
33 animation->setDirection(CompositorAnimation::DirectionReverse); | 33 animation->setDirection(CompositorAnimation::DirectionReverse); |
34 | 34 |
35 EXPECT_EQ(2, animation->iterations()); | 35 EXPECT_EQ(2, animation->iterations()); |
36 EXPECT_EQ(2, animation->startTime()); | 36 EXPECT_EQ(2, animation->startTime()); |
37 EXPECT_EQ(2, animation->timeOffset()); | 37 EXPECT_EQ(2, animation->timeOffset()); |
38 EXPECT_EQ(CompositorAnimation::DirectionReverse, animation->direction()); | 38 EXPECT_EQ(CompositorAnimation::DirectionReverse, animation->direction()); |
39 } | 39 } |
40 | 40 |
41 } // namespace blink | 41 } // namespace blink |
OLD | NEW |