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

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

Issue 2125223004: Restore focus-state ink drop highlight on buttons after ripple animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add some tests Created 4 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/views/animation/ink_drop_impl.cc ('k') | no next file » | 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 b6fc8cebb0cfc2ecc281a84b1cc61e70a114f192..93a1dd8754a6be6e6702cf83a4c81e29426ce83c 100644
--- a/ui/views/animation/ink_drop_impl_unittest.cc
+++ b/ui/views/animation/ink_drop_impl_unittest.cc
@@ -253,4 +253,58 @@ TEST_F(InkDropImplTest, LayersArentRemovedWhenPreemptingFadeOut) {
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
}
+TEST_F(InkDropImplTest, AnimationWhenDeactivated) {
+ ink_drop_host_.set_should_show_highlight(true);
+
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.AnimateToState(InkDropState::ACTIVATED);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ test_api_.CompleteAnimations();
+
+ ink_drop_.AnimateToState(InkDropState::DEACTIVATED);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_TRUE(test_api_.HasActiveAnimations());
bruthig 2016/07/13 21:11:38 nit: test_api_.HasActiveAnimations() could return
Evan Stade 2016/07/25 22:00:42 Done, sorta
+}
+
+TEST_F(InkDropImplTest, AnimationSkippedWhenFocusedAndDeactivated) {
+ ink_drop_host_.set_should_show_highlight(true);
+
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.SetFocused(true);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.AnimateToState(InkDropState::ACTIVATED);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ test_api_.CompleteAnimations();
+
+ ink_drop_.AnimateToState(InkDropState::DEACTIVATED);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+ EXPECT_FALSE(test_api_.HasActiveAnimations());
bruthig 2016/07/13 21:11:38 nit: Might want to confirm the highlight is visibl
Evan Stade 2016/07/25 22:00:42 Done.
+}
+
+TEST_F(InkDropImplTest, FocusHighlightComesBackImmediatelyAfterAction) {
+ ink_drop_host_.set_should_show_highlight(true);
+
+ EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
+
+ ink_drop_.SetHovered(true);
bruthig 2016/07/13 21:11:38 I believe this should be SetFocused() and not hove
Evan Stade 2016/07/25 22:00:42 -_-
+ 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());
+
+ ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
+ EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
+
+ test_api_.CompleteAnimations();
+
+ // No delay (unlike in the hover case).
+ EXPECT_FALSE(task_runner_->HasPendingTask());
+
+ // Highlight should be back.
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+}
+
} // namespace views
« no previous file with comments | « ui/views/animation/ink_drop_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698