| OLD | NEW |
| 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 "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 parent_target.Translate(0, 100); | 23 parent_target.Translate(0, 100); |
| 24 | 24 |
| 25 gfx::Transform child_transform; | 25 gfx::Transform child_transform; |
| 26 child_transform.Rotate(-30.0); | 26 child_transform.Rotate(-30.0); |
| 27 | 27 |
| 28 base::TimeDelta duration = base::TimeDelta::FromSeconds(1); | 28 base::TimeDelta duration = base::TimeDelta::FromSeconds(1); |
| 29 | 29 |
| 30 const gfx::Transform effective_child_transform = | 30 const gfx::Transform effective_child_transform = |
| 31 parent_start * child_transform; | 31 parent_start * child_transform; |
| 32 | 32 |
| 33 TransformAnimationCurveAdapter parent_curve(Tween::LINEAR, | 33 TransformAnimationCurveAdapter parent_curve(gfx::Tween::LINEAR, |
| 34 parent_start, | 34 parent_start, |
| 35 parent_target, | 35 parent_target, |
| 36 duration); | 36 duration); |
| 37 | 37 |
| 38 InverseTransformCurveAdapter child_curve(parent_curve, | 38 InverseTransformCurveAdapter child_curve(parent_curve, |
| 39 child_transform, | 39 child_transform, |
| 40 duration); | 40 duration); |
| 41 static const int kSteps = 1000; | 41 static const int kSteps = 1000; |
| 42 double step = 1.0 / kSteps; | 42 double step = 1.0 / kSteps; |
| 43 for (int i = 0; i <= kSteps ; ++i) { | 43 for (int i = 0; i <= kSteps ; ++i) { |
| 44 std::ostringstream message; | 44 std::ostringstream message; |
| 45 message << "Step " << i << " of " << kSteps; | 45 message << "Step " << i << " of " << kSteps; |
| 46 SCOPED_TRACE(message.str()); | 46 SCOPED_TRACE(message.str()); |
| 47 gfx::Transform progress_parent_transform = | 47 gfx::Transform progress_parent_transform = |
| 48 parent_curve.GetValue(i*step); | 48 parent_curve.GetValue(i*step); |
| 49 gfx::Transform progress_child_transform = | 49 gfx::Transform progress_child_transform = |
| 50 child_curve.GetValue(i*step); | 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 |
| OLD | NEW |