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

Unified Diff: ui/gfx/animation/tween_unittest.cc

Issue 2966723003: Add support for bounds animations (Closed)
Patch Set: address reviewer feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/animation/tween.cc ('k') | ui/gfx/test/gfx_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/animation/tween_unittest.cc
diff --git a/ui/gfx/animation/tween_unittest.cc b/ui/gfx/animation/tween_unittest.cc
index 1871fc9b8297ec0c895b4e9591fd6c51bbcb28d0..d55904f9410112ec811fb8012e10496bd1705fc3 100644
--- a/ui/gfx/animation/tween_unittest.cc
+++ b/ui/gfx/animation/tween_unittest.cc
@@ -155,5 +155,36 @@ TEST(TweenTest, ClampedFloatValueBetweenTimeTicks) {
EXPECT_EQ(v2, Tween::ClampedFloatValueBetween(t_after, from, v1, to, v2));
}
+TEST(TweenTest, SizeValueBetween) {
+ const gfx::SizeF s1(12.0f, 24.0f);
+ const gfx::SizeF s2(36.0f, 48.0f);
+
+ double before = -0.125;
+ double from = 0.0;
+ double between = 0.5;
+ double to = 1.0;
+ double after = 1.125;
+
+ EXPECT_SIZEF_EQ(gfx::SizeF(9.0f, 21.0f),
+ Tween::SizeValueBetween(before, s1, s2));
+ EXPECT_SIZEF_EQ(s1, Tween::SizeValueBetween(from, s1, s2));
+ EXPECT_SIZEF_EQ(gfx::SizeF(24.0f, 36.0f),
+ Tween::SizeValueBetween(between, s1, s2));
+ EXPECT_SIZEF_EQ(s2, Tween::SizeValueBetween(to, s1, s2));
+ EXPECT_SIZEF_EQ(gfx::SizeF(39.0f, 51.0f),
+ Tween::SizeValueBetween(after, s1, s2));
+}
+
+TEST(TweenTest, SizeValueBetweenClampedExtrapolation) {
+ const gfx::SizeF s1(0.0f, 0.0f);
+ const gfx::SizeF s2(36.0f, 48.0f);
+
+ double before = -1.0f;
+
+ // We should not extrapolate in this case as it would result in a negative and
+ // invalid size.
+ EXPECT_SIZEF_EQ(s1, Tween::SizeValueBetween(before, s1, s2));
+}
+
} // namespace
} // namespace gfx
« no previous file with comments | « ui/gfx/animation/tween.cc ('k') | ui/gfx/test/gfx_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698