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

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: rebase and fix 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') | ui/views/animation/test/ink_drop_impl_test_api.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 b6fc8cebb0cfc2ecc281a84b1cc61e70a114f192..ba7a5fbc1c23bcd08dc650924f160051a6bca9b7 100644
--- a/ui/views/animation/ink_drop_impl_unittest.cc
+++ b/ui/views/animation/ink_drop_impl_unittest.cc
@@ -253,4 +253,59 @@ TEST_F(InkDropImplTest, LayersArentRemovedWhenPreemptingFadeOut) {
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
}
+TEST_F(InkDropImplTest, AnimationWhenDeactivated) {
+ 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());
+ EXPECT_FALSE(test_api_.IsHighlightFadingInOrVisible());
+}
+
+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());
+ EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible());
+ EXPECT_EQ(InkDropState::HIDDEN, test_api_.ripple()->target_ink_drop_state());
bruthig 2016/07/25 22:13:20 nit: Why not use InkDrop::GetTargetInkDropState()?
Evan Stade 2016/07/25 22:20:05 no reason, 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_.SetFocused(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());
+
+ 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') | ui/views/animation/test/ink_drop_impl_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698