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

Side by Side Diff: ui/compositor/transform_animation_curve_adapter_unittest.cc

Issue 719453007: Make Keyframe use TimeTicks/TimeDelta to represent time instead of double. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 "ui/compositor/transform_animation_curve_adapter.h" 5 #include "ui/compositor/transform_animation_curve_adapter.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/base/time_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/compositor/test/test_utils.h" 12 #include "ui/compositor/test/test_utils.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
15 namespace { 16 namespace {
16 17
17 // Check that the inverse transform curve gives the gives a transform that when 18 // Check that the inverse transform curve gives the gives a transform that when
18 // applied on top of the parent transform gives the original transform 19 // applied on top of the parent transform gives the original transform
19 TEST(InverseTransformCurveAdapterTest, InversesTransform) { 20 TEST(InverseTransformCurveAdapterTest, InversesTransform) {
(...skipping 14 matching lines...) Expand all
34 parent_start, 35 parent_start,
35 parent_target, 36 parent_target,
36 duration); 37 duration);
37 38
38 InverseTransformCurveAdapter child_curve(parent_curve, 39 InverseTransformCurveAdapter child_curve(parent_curve,
39 child_transform, 40 child_transform,
40 duration); 41 duration);
41 static const int kSteps = 1000; 42 static const int kSteps = 1000;
42 double step = 1.0 / kSteps; 43 double step = 1.0 / kSteps;
43 for (int i = 0; i <= kSteps ; ++i) { 44 for (int i = 0; i <= kSteps ; ++i) {
45 base::TimeDelta time_step = cc::TimeUtil::Scale(duration, i * step);
44 std::ostringstream message; 46 std::ostringstream message;
45 message << "Step " << i << " of " << kSteps; 47 message << "Step " << i << " of " << kSteps;
46 SCOPED_TRACE(message.str()); 48 SCOPED_TRACE(message.str());
47 gfx::Transform progress_parent_transform = 49 gfx::Transform progress_parent_transform = parent_curve.GetValue(time_step);
48 parent_curve.GetValue(i*step); 50 gfx::Transform progress_child_transform = child_curve.GetValue(time_step);
49 gfx::Transform progress_child_transform =
50 child_curve.GetValue(i*step);
51 CheckApproximatelyEqual(effective_child_transform, 51 CheckApproximatelyEqual(effective_child_transform,
52 progress_parent_transform * 52 progress_parent_transform *
53 progress_child_transform); 53 progress_child_transform);
54 } 54 }
55 } 55 }
56 56
57 } // namespace 57 } // namespace
58 58
59 } // namespace ui 59 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698