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

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

Issue 2250783002: Allow InkDropRipple to co-exist with highlight (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove EmptyInkDropRipple Created 4 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/views/animation/ink_drop_impl.cc ('k') | ui/views/animation/ink_drop_ripple.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_impl_unittest.cc
diff --git a/ui/views/animation/ink_drop_impl_unittest.cc b/ui/views/animation/ink_drop_impl_unittest.cc
index 14c549a9f37e11d5fb68d5f54cfd3afe03b3fc38..b7c85dcf28b500ed309aefd24f3ed61341f0d440 100644
--- a/ui/views/animation/ink_drop_impl_unittest.cc
+++ b/ui/views/animation/ink_drop_impl_unittest.cc
@@ -294,6 +294,7 @@ TEST_F(InkDropImplTest, FocusHighlightComesBackImmediatelyAfterAction) {
ink_drop_.AnimateToState(InkDropState::ACTION_PENDING);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_FALSE(test_api_.IsHighlightFadingInOrVisible());
ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
@@ -307,4 +308,66 @@ TEST_F(InkDropImplTest, FocusHighlightComesBackImmediatelyAfterAction) {
EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
}
+TEST_F(InkDropImplTest, HighlightCanCoexistWithRipple) {
+ ink_drop_host_.set_should_show_highlight(true);
+ ink_drop_host_.set_ripple_overrides_highlight(false);
+
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.SetHovered(true);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.AnimateToState(InkDropState::ACTION_PENDING);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+
+ ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+
+ test_api_.CompleteAnimations();
+
+ // Nothing to fade in because the highlight has always been visible.
+ EXPECT_FALSE(task_runner_->HasPendingTask());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+
+ // Now try with the ripple showing before the highlight comes in.
+ ink_drop_.AnimateToState(InkDropState::HIDDEN);
+ ink_drop_.SetHovered(false);
+ test_api_.CompleteAnimations();
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.AnimateToState(InkDropState::ACTION_PENDING);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ ink_drop_.SetHovered(true);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+}
+
+TEST_F(InkDropImplTest, HighlightCanCoexistWithSnapToActivatedRipple) {
+ ink_drop_host_.set_should_show_highlight(true);
+ ink_drop_host_.set_ripple_overrides_highlight(false);
+
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.SetHovered(true);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.SnapToActivated();
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+
+ // Now try with the ripple showing before the highlight comes in.
+ ink_drop_.AnimateToState(InkDropState::HIDDEN);
+ ink_drop_.SetHovered(false);
+ test_api_.CompleteAnimations();
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.SnapToActivated();
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ ink_drop_.SetHovered(true);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+}
+
} // namespace views
« no previous file with comments | « ui/views/animation/ink_drop_impl.cc ('k') | ui/views/animation/ink_drop_ripple.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698