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

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

Issue 2831353002: Allow a LocatedEvent to be passed to MenuButton, so the ink drop animation is centered on the click… (Closed)
Patch Set: Addressed review comments Created 3 years, 8 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/menu_button.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/menu_button_unittest.cc
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc
index adb1a6d3d5fcf475fde5ee011bbbfcceba0b72c6..4677853cb5f211d6cc479502ade9bd117e4842d4 100644
--- a/ui/views/controls/button/menu_button_unittest.cc
+++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -340,6 +340,37 @@ TEST_F(MenuButtonTest, ActivateDropDownOnMouseClick) {
EXPECT_EQ(Button::STATE_HOVERED, menu_button_listener.last_source_state());
}
+// Tests that the ink drop center point is set from the mouse click point.
+TEST_F(MenuButtonTest, InkDropCenterSetFromClick) {
+ TestMenuButtonListener menu_button_listener;
+ CreateMenuButtonWithMenuButtonListener(&menu_button_listener);
+
+ gfx::Point click_point(6, 8);
+ generator()->MoveMouseTo(click_point);
+ generator()->ClickLeftButton();
+
+ EXPECT_EQ(button(), menu_button_listener.last_source());
+ EXPECT_EQ(
+ click_point,
+ InkDropHostViewTestApi(button()).GetInkDropCenterBasedOnLastEvent());
+}
+
+// Tests that the ink drop center point is set from the PressedLock constructor.
+TEST_F(MenuButtonTest, InkDropCenterSetFromClickWithPressedLock) {
+ TestMenuButtonListener menu_button_listener;
+ CreateMenuButtonWithMenuButtonListener(&menu_button_listener);
+
+ gfx::Point click_point(11, 7);
+ ui::MouseEvent click_event(ui::EventType::ET_MOUSE_PRESSED, click_point,
+ click_point, base::TimeTicks(), 0, 0);
+ MenuButton::PressedLock pressed_lock(button(), false, &click_event);
+
+ EXPECT_EQ(Button::STATE_PRESSED, button()->state());
+ EXPECT_EQ(
+ click_point,
+ InkDropHostViewTestApi(button()).GetInkDropCenterBasedOnLastEvent());
+}
+
// Test that the MenuButton stays pressed while there are any PressedLocks.
TEST_F(MenuButtonTest, ButtonStateForMenuButtonsWithPressedLocks) {
// Similarly for aura-mus-client the location of the cursor is not updated by
« no previous file with comments | « ui/views/controls/button/menu_button.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698