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

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

Issue 2971503002: Transform animations should not collapse by default when interpolating (Closed)
Patch Set: . Created 3 years, 5 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 | « ui/compositor/transform_animation_curve_adapter.cc ('k') | no next file » | 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 "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 "cc/base/time_util.h"
(...skipping 13 matching lines...) Expand all
24 parent_target.Translate(0, 100); 24 parent_target.Translate(0, 100);
25 25
26 gfx::Transform child_transform; 26 gfx::Transform child_transform;
27 child_transform.Rotate(-30.0); 27 child_transform.Rotate(-30.0);
28 28
29 base::TimeDelta duration = base::TimeDelta::FromSeconds(1); 29 base::TimeDelta duration = base::TimeDelta::FromSeconds(1);
30 30
31 const gfx::Transform effective_child_transform = 31 const gfx::Transform effective_child_transform =
32 parent_start * child_transform; 32 parent_start * child_transform;
33 33
34 TransformAnimationCurveAdapter parent_curve(gfx::Tween::LINEAR, 34 TransformAnimationCurveAdapter parent_curve(gfx::Tween::LINEAR, parent_start,
35 parent_start, 35 parent_target, duration);
36 parent_target,
37 duration);
38 36
39 InverseTransformCurveAdapter child_curve(parent_curve, 37 InverseTransformCurveAdapter child_curve(parent_curve, child_transform,
40 child_transform,
41 duration); 38 duration);
42 static const int kSteps = 1000; 39 static const int kSteps = 1000;
43 double step = 1.0 / kSteps; 40 double step = 1.0 / kSteps;
44 for (int i = 0; i <= kSteps ; ++i) { 41 for (int i = 0; i <= kSteps; ++i) {
45 base::TimeDelta time_step = cc::TimeUtil::Scale(duration, i * step); 42 base::TimeDelta time_step = cc::TimeUtil::Scale(duration, i * step);
46 std::ostringstream message; 43 std::ostringstream message;
47 message << "Step " << i << " of " << kSteps; 44 message << "Step " << i << " of " << kSteps;
48 SCOPED_TRACE(message.str()); 45 SCOPED_TRACE(message.str());
49 gfx::Transform progress_parent_transform = parent_curve.GetValue(time_step); 46 gfx::Transform progress_parent_transform =
50 gfx::Transform progress_child_transform = child_curve.GetValue(time_step); 47 parent_curve.GetValue(time_step).Apply();
51 CheckApproximatelyEqual(effective_child_transform, 48 gfx::Transform progress_child_transform =
52 progress_parent_transform * 49 child_curve.GetValue(time_step).Apply();
53 progress_child_transform); 50 CheckApproximatelyEqual(
51 effective_child_transform,
52 progress_parent_transform * progress_child_transform);
54 } 53 }
55 } 54 }
56 55
57 } // namespace 56 } // namespace
58 57
59 } // namespace ui 58 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/transform_animation_curve_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698