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

Unified Diff: ui/compositor/layer_animation_element_unittest.cc

Issue 22861008: Add support for inverse transform animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed loop condition nit. Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer_animation_element.cc ('k') | ui/compositor/test/test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animation_element_unittest.cc
diff --git a/ui/compositor/layer_animation_element_unittest.cc b/ui/compositor/layer_animation_element_unittest.cc
index 2701200c0146488f0f1b8a9dfd2c2f26f713c4b7..917969fcbe4b53279050e0f8720ffcc7f1cd2608 100644
--- a/ui/compositor/layer_animation_element_unittest.cc
+++ b/ui/compositor/layer_animation_element_unittest.cc
@@ -10,6 +10,7 @@
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/layer_animation_delegate.h"
+#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/test/test_layer_animation_delegate.h"
#include "ui/compositor/test/test_utils.h"
#include "ui/gfx/rect.h"
@@ -23,7 +24,7 @@ namespace {
// that the element can be reused after it completes.
TEST(LayerAnimationElementTest, TransformElement) {
TestLayerAnimationDelegate delegate;
- gfx::Transform start_transform, target_transform, middle_transform;
+ gfx::Transform start_transform, target_transform;
start_transform.Rotate(-30.0);
target_transform.Rotate(30.0);
base::TimeTicks start_time;
@@ -65,6 +66,36 @@ TEST(LayerAnimationElementTest, TransformElement) {
CheckApproximatelyEqual(target_transform, target_value.transform);
}
+// Ensures that duration is copied correctly.
+TEST(LayerAnimationElementTest, InverseElementDurationNoScale) {
+ gfx::Transform transform;
+ base::TimeDelta delta;
+
+ scoped_ptr<LayerAnimationElement> base_element(
+ LayerAnimationElement::CreateTransformElement(transform, delta));
+
+ scoped_ptr<LayerAnimationElement> inverse_element(
+ LayerAnimationElement::CreateInverseTransformElement(transform,
+ base_element.get()));
+ EXPECT_EQ(base_element->duration(), inverse_element->duration());
+}
+
+// Ensures that duration is copied correctly and not double scaled.
+TEST(LayerAnimationElementTest, InverseElementDurationScaled) {
+ gfx::Transform transform;
+ base::TimeDelta delta;
+
+ ScopedAnimationDurationScaleMode faster_duration(
+ ScopedAnimationDurationScaleMode::FAST_DURATION);
+ scoped_ptr<LayerAnimationElement> base_element(
+ LayerAnimationElement::CreateTransformElement(transform, delta));
+
+ scoped_ptr<LayerAnimationElement> inverse_element(
+ LayerAnimationElement::CreateInverseTransformElement(transform,
+ base_element.get()));
+ EXPECT_EQ(base_element->duration(), inverse_element->duration());
+}
+
// Check that the bounds element progresses the delegate as expected and
// that the element can be reused after it completes.
TEST(LayerAnimationElementTest, BoundsElement) {
« no previous file with comments | « ui/compositor/layer_animation_element.cc ('k') | ui/compositor/test/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698