Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: cc/animation/scroll_offset_animation_curve_unittest.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.cc ('k') | cc/animation/transform_operation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/animation/scroll_offset_animation_curve.h" 5 #include "cc/animation/scroll_offset_animation_curve.h"
6 6
7 #include "cc/animation/timing_function.h" 7 #include "cc/animation/timing_function.h"
8 #include "cc/base/time_util.h" 8 #include "cc/base/time_util.h"
9 #include "cc/test/geometry_test_utils.h" 9 #include "cc/test/geometry_test_utils.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 scoped_ptr<ScrollOffsetAnimationCurve> curve( 61 scoped_ptr<ScrollOffsetAnimationCurve> curve(
62 ScrollOffsetAnimationCurve::Create( 62 ScrollOffsetAnimationCurve::Create(
63 target_value, 63 target_value,
64 EaseInOutTimingFunction::Create().Pass())); 64 EaseInOutTimingFunction::Create().Pass()));
65 curve->SetInitialValue(initial_value); 65 curve->SetInitialValue(initial_value);
66 66
67 base::TimeDelta duration = curve->Duration(); 67 base::TimeDelta duration = curve->Duration();
68 EXPECT_GT(curve->Duration().InSecondsF(), 0); 68 EXPECT_GT(curve->Duration().InSecondsF(), 0);
69 EXPECT_LT(curve->Duration().InSecondsF(), 0.1); 69 EXPECT_LT(curve->Duration().InSecondsF(), 0.1);
70 70
71 EXPECT_EQ(AnimationCurve::SCROLL_OFFSET, curve->Type()); 71 EXPECT_EQ(AnimationCurve::ScrollOffset, curve->Type());
72 EXPECT_EQ(duration, curve->Duration()); 72 EXPECT_EQ(duration, curve->Duration());
73 73
74 EXPECT_VECTOR2DF_EQ(initial_value, 74 EXPECT_VECTOR2DF_EQ(initial_value,
75 curve->GetValue(base::TimeDelta::FromSecondsD(-1.0))); 75 curve->GetValue(base::TimeDelta::FromSecondsD(-1.0)));
76 EXPECT_VECTOR2DF_EQ(initial_value, curve->GetValue(base::TimeDelta())); 76 EXPECT_VECTOR2DF_EQ(initial_value, curve->GetValue(base::TimeDelta()));
77 EXPECT_VECTOR2DF_NEAR(gfx::ScrollOffset(6.f, 30.f), 77 EXPECT_VECTOR2DF_NEAR(gfx::ScrollOffset(6.f, 30.f),
78 curve->GetValue(TimeUtil::Scale(duration, 0.5f)), 78 curve->GetValue(TimeUtil::Scale(duration, 0.5f)),
79 0.00025); 79 0.00025);
80 EXPECT_VECTOR2DF_EQ(target_value, curve->GetValue(duration)); 80 EXPECT_VECTOR2DF_EQ(target_value, curve->GetValue(duration));
81 EXPECT_VECTOR2DF_EQ( 81 EXPECT_VECTOR2DF_EQ(
(...skipping 12 matching lines...) Expand all
94 gfx::ScrollOffset target_value(10.f, 20.f); 94 gfx::ScrollOffset target_value(10.f, 20.f);
95 scoped_ptr<ScrollOffsetAnimationCurve> curve( 95 scoped_ptr<ScrollOffsetAnimationCurve> curve(
96 ScrollOffsetAnimationCurve::Create( 96 ScrollOffsetAnimationCurve::Create(
97 target_value, 97 target_value,
98 EaseInOutTimingFunction::Create().Pass())); 98 EaseInOutTimingFunction::Create().Pass()));
99 curve->SetInitialValue(initial_value); 99 curve->SetInitialValue(initial_value);
100 base::TimeDelta duration = curve->Duration(); 100 base::TimeDelta duration = curve->Duration();
101 101
102 scoped_ptr<AnimationCurve> clone(curve->Clone().Pass()); 102 scoped_ptr<AnimationCurve> clone(curve->Clone().Pass());
103 103
104 EXPECT_EQ(AnimationCurve::SCROLL_OFFSET, clone->Type()); 104 EXPECT_EQ(AnimationCurve::ScrollOffset, clone->Type());
105 EXPECT_EQ(duration, clone->Duration()); 105 EXPECT_EQ(duration, clone->Duration());
106 106
107 EXPECT_VECTOR2DF_EQ(initial_value, 107 EXPECT_VECTOR2DF_EQ(initial_value,
108 clone->ToScrollOffsetAnimationCurve()->GetValue( 108 clone->ToScrollOffsetAnimationCurve()->GetValue(
109 base::TimeDelta::FromSecondsD(-1.0))); 109 base::TimeDelta::FromSecondsD(-1.0)));
110 EXPECT_VECTOR2DF_EQ( 110 EXPECT_VECTOR2DF_EQ(
111 initial_value, 111 initial_value,
112 clone->ToScrollOffsetAnimationCurve()->GetValue(base::TimeDelta())); 112 clone->ToScrollOffsetAnimationCurve()->GetValue(base::TimeDelta()));
113 EXPECT_VECTOR2DF_NEAR(gfx::ScrollOffset(6.f, 30.f), 113 EXPECT_VECTOR2DF_NEAR(gfx::ScrollOffset(6.f, 30.f),
114 clone->ToScrollOffsetAnimationCurve()->GetValue( 114 clone->ToScrollOffsetAnimationCurve()->GetValue(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 curve->UpdateTarget(1.0, gfx::ScrollOffset(0.0, 7200.0)); 149 curve->UpdateTarget(1.0, gfx::ScrollOffset(0.0, 7200.0));
150 150
151 EXPECT_NEAR(1.674, curve->Duration().InSecondsF(), 0.01); 151 EXPECT_NEAR(1.674, curve->Duration().InSecondsF(), 0.01);
152 EXPECT_NEAR(5566.49, curve->GetValue(base::TimeDelta::FromSecondsD(1.0)).y(), 152 EXPECT_NEAR(5566.49, curve->GetValue(base::TimeDelta::FromSecondsD(1.0)).y(),
153 0.01); 153 0.01);
154 EXPECT_EQ(7200.0, curve->GetValue(base::TimeDelta::FromSecondsD(1.674)).y()); 154 EXPECT_EQ(7200.0, curve->GetValue(base::TimeDelta::FromSecondsD(1.674)).y());
155 } 155 }
156 156
157 } // namespace 157 } // namespace
158 } // namespace cc 158 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.cc ('k') | cc/animation/transform_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698