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

Unified Diff: ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc

Issue 168943006: Keep the size button pressed when the user hovers the snap left or snap right button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
Index: ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc
diff --git a/ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc b/ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc
index c0c7898ba4233e1f6b82d21ffe2f646ec21e0280..39afe47da71960793f9ea7536a3af8af741f1864 100644
--- a/ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc
+++ b/ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc
@@ -322,11 +322,11 @@ TEST_F(AlternateFrameSizeButtonTest, ResetButtonsAfterClick) {
EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon());
EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon());
- // Dragging the mouse over the minimize button should press the minimize
+ // Dragging the mouse over the minimize button should hover the minimize
// button and the minimize and close button icons should stay changed.
generator.MoveMouseTo(CenterPointInScreen(minimize_button()));
- EXPECT_EQ(views::Button::STATE_PRESSED, minimize_button()->state());
- EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->state());
+ EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state());
+ EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state());
EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon());
EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon());
@@ -375,5 +375,43 @@ TEST_F(AlternateFrameSizeButtonTest, ResetButtonsAfterClick) {
EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon());
}
+// Test that the size button is pressed whenever the snap left/right buttons
+// are hovered.
+TEST_F(AlternateFrameSizeButtonTest, SizeButtonPressedWhenSnapButtonHovered) {
+ EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon());
+ EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon());
+ EXPECT_TRUE(AllButtonsInNormalState());
+
+ // Pressing the size button should result in the size button being pressed and
+ // the minimize and close button icons changing.
+ aura::test::EventGenerator& generator = GetEventGenerator();
+ generator.MoveMouseTo(CenterPointInScreen(size_button()));
+ generator.PressLeftButton();
+ EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state());
+ EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
+ EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state());
+ EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon());
+ EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon());
+
+ // Dragging the mouse over the minimize button (snap left button) should hover
+ // the minimize button and keep the size button pressed.
+ generator.MoveMouseTo(CenterPointInScreen(minimize_button()));
+ EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state());
+ EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
+ EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state());
+
+ // Moving the mouse far away from the caption buttons and then moving it over
+ // the close button (snap right button) should hover the close button and
+ // keep the size button pressed.
+ const gfx::Rect& kWorkAreaBoundsInScreen =
+ ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
+ generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left());
+ EXPECT_TRUE(AllButtonsInNormalState());
+ generator.MoveMouseTo(CenterPointInScreen(close_button()));
+ EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state());
+ EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
+ EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state());
+}
+
} // namespace test
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698