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

Unified Diff: services/ui/ws/cursor_unittest.cc

Issue 2680883002: Fixes bugs in cursor handling (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | services/ui/ws/event_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/cursor_unittest.cc
diff --git a/services/ui/ws/cursor_unittest.cc b/services/ui/ws/cursor_unittest.cc
index bfd4008d0a12da110f5d58b140d6e0bf0e3b0ba6..c2061185e353d9b5bcebe187e0371d4e5f14d99e 100644
--- a/services/ui/ws/cursor_unittest.cc
+++ b/services/ui/ws/cursor_unittest.cc
@@ -95,8 +95,8 @@ class CursorTest : public testing::Test {
WindowManagerDisplayRoot* active_display_root =
display->GetActiveWindowManagerDisplayRoot();
ASSERT_TRUE(active_display_root);
- static_cast<PlatformDisplayDelegate*>(display)->OnEvent(ui::PointerEvent(
- ui::MouseEvent(ui::ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0)));
+ static_cast<PlatformDisplayDelegate*>(display)->OnEvent(PointerEvent(
+ MouseEvent(ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0)));
WindowManagerState* wms = active_display_root->window_manager_state();
wms->OnEventAck(wms->window_tree(), mojom::EventResult::HANDLED);
}
@@ -110,6 +110,7 @@ class CursorTest : public testing::Test {
TEST_F(CursorTest, ChangeByMouseMove) {
ServerWindow* win = BuildServerWindow();
win->SetPredefinedCursor(mojom::Cursor::IBEAM);
+ win->parent()->SetPredefinedCursor(mojom::Cursor::CELL);
EXPECT_EQ(mojom::Cursor::IBEAM, win->cursor());
win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
EXPECT_EQ(mojom::Cursor::EAST_RESIZE, win->non_client_cursor());
@@ -118,13 +119,14 @@ TEST_F(CursorTest, ChangeByMouseMove) {
MoveCursorTo(gfx::Point(15, 15));
EXPECT_EQ(mojom::Cursor::EAST_RESIZE, cursor());
- // Client area
+ // Client area, which comes from win->parent().
MoveCursorTo(gfx::Point(25, 25));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor());
+ EXPECT_EQ(mojom::Cursor::CELL, cursor());
}
TEST_F(CursorTest, ChangeByClientAreaChange) {
ServerWindow* win = BuildServerWindow();
+ win->parent()->SetPredefinedCursor(mojom::Cursor::CROSS);
win->SetPredefinedCursor(mojom::Cursor::IBEAM);
EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor()));
win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
@@ -134,9 +136,10 @@ TEST_F(CursorTest, ChangeByClientAreaChange) {
MoveCursorTo(gfx::Point(15, 15));
EXPECT_EQ(mojom::Cursor::EAST_RESIZE, cursor());
- // Changing the client area should cause a change.
+ // Changing the client area should cause a change. The cursor for the client
+ // area comes from root ancestor, which is win->parent().
win->SetClientArea(gfx::Insets(1, 1), std::vector<gfx::Rect>());
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor());
+ EXPECT_EQ(mojom::Cursor::CROSS, cursor());
}
TEST_F(CursorTest, NonClientCursorChange) {
@@ -169,6 +172,7 @@ TEST_F(CursorTest, IgnoreClientCursorChangeInNonClientArea) {
TEST_F(CursorTest, NonClientToClientByBoundsChange) {
ServerWindow* win = BuildServerWindow();
+ win->parent()->SetPredefinedCursor(mojom::Cursor::COPY);
win->SetPredefinedCursor(mojom::Cursor::IBEAM);
EXPECT_EQ(mojom::Cursor::IBEAM, win->cursor());
win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
@@ -179,7 +183,7 @@ TEST_F(CursorTest, NonClientToClientByBoundsChange) {
EXPECT_EQ(mojom::Cursor::EAST_RESIZE, cursor());
win->SetBounds(gfx::Rect(0, 0, 30, 30));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor());
+ EXPECT_EQ(mojom::Cursor::COPY, cursor());
}
} // namespace test
« no previous file with comments | « no previous file | services/ui/ws/event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698