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

Unified Diff: ui/aura/root_window_unittest.cc

Issue 10829180: Move cursor when it's hidden so that UX can update correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added test Created 8 years, 4 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
« ui/aura/root_window.cc ('K') | « ui/aura/root_window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_unittest.cc
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index 89b8e71d8ccd7aa793dec1838e2bb326425864fc..f883bbf135767f436a6756b78a0f0dbcc95f24f1 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -146,6 +146,40 @@ TEST_F(RootWindowTest, OnHostMouseEvent) {
EXPECT_TRUE(delegate1->mouse_event_flags() & ui::EF_IS_NON_CLIENT);
}
+TEST_F(RootWindowTest, HideCursor) {
+ scoped_ptr<NonClientDelegate> delegate(new NonClientDelegate());
+ const int kWindowWidth = 123;
+ const int kWindowHeight = 45;
+ gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight);
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
+ delegate.get(), -1234, bounds, NULL));
+ aura::Window* window_ptr = &*window;
+
+ root_window()->ShowCursor(true);
+ // Send a mouse event to window.
+ gfx::Point point(101, 201);
+ gfx::Point local_point;
+ MouseEvent event(ui::ET_MOUSE_MOVED, point, point, 0);
+ root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&event);
+
+ // Location was in window.
+ local_point = delegate->mouse_event_location();
+ aura::Window::ConvertPointToWindow(window_ptr, root_window(), &local_point);
+ EXPECT_TRUE(window->bounds().Contains(local_point));
+
+ // Location is now out of window.
+ root_window()->ShowCursor(false);
+ local_point = delegate->mouse_event_location();
+ aura::Window::ConvertPointToWindow(window_ptr, root_window(), &local_point);
+ EXPECT_FALSE(window->bounds().Contains(local_point));
+
+ // Location is back in window.
+ root_window()->ShowCursor(true);
+ local_point = delegate->mouse_event_location();
+ aura::Window::ConvertPointToWindow(window_ptr, root_window(), &local_point);
+ EXPECT_TRUE(window->bounds().Contains(local_point));
+}
+
// Check that we correctly track the state of the mouse buttons in response to
// button press and release events.
TEST_F(RootWindowTest, MouseButtonState) {
« ui/aura/root_window.cc ('K') | « ui/aura/root_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698