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

Unified Diff: trunk/src/ash/wm/ash_native_cursor_manager_unittest.cc

Issue 233693002: Revert 263043 "Remove obsolete scale related APIs for cursor" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | « trunk/src/ash/wm/ash_native_cursor_manager.cc ('k') | trunk/src/ui/aura/client/cursor_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ash/wm/ash_native_cursor_manager_unittest.cc
===================================================================
--- trunk/src/ash/wm/ash_native_cursor_manager_unittest.cc (revision 263047)
+++ trunk/src/ash/wm/ash_native_cursor_manager_unittest.cc (working copy)
@@ -62,7 +62,9 @@
EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
display.set_device_scale_factor(2.0f);
display.set_rotation(gfx::Display::ROTATE_90);
+ cursor_manager->SetScale(2.5f);
cursor_manager->SetDisplay(display);
+ EXPECT_EQ(2.5f, test_api.GetCurrentScale());
EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor());
EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet());
EXPECT_EQ(gfx::Display::ROTATE_90, test_api.GetDisplay().rotation());
@@ -80,6 +82,13 @@
cursor_manager->SetCursorSet(ui::CURSOR_SET_NORMAL);
EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet());
+ // Cusror scale does change even while cursor is locked.
+ EXPECT_EQ(2.5f, test_api.GetCurrentScale());
+ cursor_manager->SetScale(1.f);
+ EXPECT_EQ(1.f, test_api.GetCurrentScale());
+ cursor_manager->SetScale(1.5f);
+ EXPECT_EQ(1.5f, test_api.GetCurrentScale());
+
// Cursor type does not change while cursor is locked.
cursor_manager->SetCursor(ui::kCursorPointer);
EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
@@ -95,6 +104,7 @@
EXPECT_FALSE(cursor_manager->IsCursorLocked());
// Cursor type changes to the one specified while cursor is locked.
+ EXPECT_EQ(1.5f, test_api.GetCurrentScale());
EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type());
EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor());
EXPECT_TRUE(test_api.GetCurrentCursor().platform());
@@ -130,6 +140,19 @@
EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet());
}
+TEST_F(AshNativeCursorManagerTest, SetScale) {
+ ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
+ CursorManagerTestApi test_api(cursor_manager);
+
+ EXPECT_EQ(1.f, test_api.GetCurrentScale());
+
+ cursor_manager->SetScale(2.5f);
+ EXPECT_EQ(2.5f, test_api.GetCurrentScale());
+
+ cursor_manager->SetScale(1.f);
+ EXPECT_EQ(1.f, test_api.GetCurrentScale());
+}
+
TEST_F(AshNativeCursorManagerTest, SetDeviceScaleFactorAndRotation) {
::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
CursorManagerTestApi test_api(cursor_manager);
« no previous file with comments | « trunk/src/ash/wm/ash_native_cursor_manager.cc ('k') | trunk/src/ui/aura/client/cursor_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698