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

Unified Diff: ash/display/mouse_cursor_event_filter_unittest.cc

Issue 11033038: Fix the issue of cursor's device scale factor when using monitors with differnt device scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a comment Created 8 years, 2 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 | « ash/display/mouse_cursor_event_filter.h ('k') | ash/ui_controls_ash.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/mouse_cursor_event_filter_unittest.cc
diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc
index 95433e3c836981389265041e38fccdaa81cecdc4..30a90abfb90f646a2fa30e0b5cd541a54a74a8a2 100644
--- a/ash/display/mouse_cursor_event_filter_unittest.cc
+++ b/ash/display/mouse_cursor_event_filter_unittest.cc
@@ -6,7 +6,9 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/cursor_manager_test_api.h"
#include "ash/display/display_controller.h"
+#include "ash/wm/cursor_manager.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/gfx/display.h"
@@ -272,5 +274,30 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) {
event_filter->HideSharedEdgeIndicator();
}
+// Verifies cursor's device scale factor is updated when a cursor has moved
+// across root windows with different device scale factors
+// (http://crbug.com/154183).
+TEST_F(MouseCursorEventFilterTest, CursorDeviceScaleFactor) {
+ UpdateDisplay("400x400,800x800*2");
+ DisplayController* controller =
+ Shell::GetInstance()->display_controller();
+ DisplayLayout default_layout(DisplayLayout::RIGHT, 0);
+ controller->SetDefaultDisplayLayout(default_layout);
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ ASSERT_EQ(2U, root_windows.size());
+ test::CursorManagerTestApi cursor_test_api(
+ Shell::GetInstance()->cursor_manager());
+ MouseCursorEventFilter* event_filter =
+ Shell::GetInstance()->mouse_cursor_filter();
+
+ EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor());
+ event_filter->WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(399, 200));
+ EXPECT_EQ(2.0f, cursor_test_api.GetDeviceScaleFactor());
+ event_filter->WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(400, 200));
+ EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor());
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/display/mouse_cursor_event_filter.h ('k') | ash/ui_controls_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698