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

Unified Diff: ui/views/controls/button/custom_button_unittest.cc

Issue 2017833003: Fixes ink drop being "stuck" on when losing focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting changes and added NOTREACHED() macro Created 4 years, 7 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/controls/button/custom_button.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button_unittest.cc
diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc
index 6ffdd81746ca94b555bd111d9a94718c04fed722..8f6204e90ff4db2ec44e4ba0018c4bd006596599 100644
--- a/ui/views/controls/button/custom_button_unittest.cc
+++ b/ui/views/controls/button/custom_button_unittest.cc
@@ -78,6 +78,9 @@ class TestCustomButton : public CustomButton, public ButtonListener {
canceled_ = false;
}
+ // Raised visibility of OnFocus() to public
+ void OnFocus() override { CustomButton::OnFocus(); }
+
private:
bool pressed_ = false;
bool canceled_ = false;
@@ -468,6 +471,29 @@ TEST_F(CustomButtonTest, DontHideInkDropWhenShowingContextMenu) {
ink_drop_delegate->GetTargetInkDropState());
}
+TEST_F(CustomButtonTest, HideInkDropOnBlur) {
+ gfx::Point center(10, 10);
+
+ TestInkDropDelegate* ink_drop_delegate = new TestInkDropDelegate();
+ CreateButtonWithInkDrop(base::WrapUnique(ink_drop_delegate));
+
+ button()->OnFocus();
+
+ button()->OnMousePressed(ui::MouseEvent(
+ ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
+ EXPECT_EQ(InkDropState::ACTION_PENDING,
+ ink_drop_delegate->GetTargetInkDropState());
+
+ button()->OnBlur();
+ EXPECT_EQ(InkDropState::HIDDEN, ink_drop_delegate->GetTargetInkDropState());
+
+ button()->OnMouseReleased(ui::MouseEvent(
+ ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
+ EXPECT_TRUE(button()->pressed());
+}
+
TEST_F(CustomButtonTest, InkDropAfterTryingToShowContextMenu) {
TestInkDropDelegate* ink_drop_delegate = new TestInkDropDelegate();
CreateButtonWithInkDrop(base::WrapUnique(ink_drop_delegate));
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698