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

Unified Diff: ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc

Issue 2615613003: Fix double ripple on activated flood fill ripple (Closed)
Patch Set: Addressed nits Created 3 years, 11 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/views/animation/flood_fill_ink_drop_ripple.cc ('k') | ui/views/animation/ink_drop_highlight_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc
diff --git a/ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc b/ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc
index 8f3ed99ce31259f95a79f26832db6052c169a461..44ea59f952303e40af1a7acfcc5706cd80c6368f 100644
--- a/ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc
+++ b/ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc
@@ -67,5 +67,45 @@ TEST(FloodFillInkDropRippleTest, MaxDistanceToCorners) {
kAbsError);
}
+// Verifies that both going directly from HIDDEN to ACTIVATED state and going
+// through PENDING to ACTIVAED state lead to the same final opacity and
+// transform values.
+TEST(FloodFillInkDropRippleTest, ActivatedFinalState) {
+ const float kAbsError = 0.01f;
+
+ const gfx::Size host_size(100, 50);
+ const gfx::Point center_point(host_size.width() / 2, host_size.height() / 2);
+ const SkColor color = SK_ColorWHITE;
+ const float visible_opacity = 0.7f;
+
+ FloodFillInkDropRipple ripple(host_size, center_point, color,
+ visible_opacity);
+ FloodFillInkDropRippleTestApi test_api(&ripple);
+
+ // Go to ACTIVATED state directly.
+ ripple.AnimateToState(InkDropState::ACTIVATED);
+ test_api.CompleteAnimations();
+ const float activated_opacity = test_api.GetCurrentOpacity();
+ const gfx::Transform activated_transform =
+ test_api.GetPaintedLayerTransform();
+
+ // Reset state.
+ ripple.AnimateToState(InkDropState::HIDDEN);
+ test_api.CompleteAnimations();
+
+ // Go to ACTIVATED state through PENDING state.
+ ripple.AnimateToState(InkDropState::ACTION_PENDING);
+ ripple.AnimateToState(InkDropState::ACTIVATED);
+ test_api.CompleteAnimations();
+ const float pending_activated_opacity = test_api.GetCurrentOpacity();
+ const gfx::Transform pending_activated_transform =
+ test_api.GetPaintedLayerTransform();
+
+ // Compare opacity and transform values.
+ EXPECT_NEAR(activated_opacity, pending_activated_opacity, kAbsError);
+ EXPECT_TRUE(
+ activated_transform.ApproximatelyEqual(pending_activated_transform));
+}
+
} // namespace test
} // namespace views
« no previous file with comments | « ui/views/animation/flood_fill_ink_drop_ripple.cc ('k') | ui/views/animation/ink_drop_highlight_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698