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

Side by Side Diff: ash/wm/drag_window_resizer_unittest.cc

Issue 226293005: Use platform's device scale factor for cursor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/drag_window_resizer.h" 5 #include "ash/wm/drag_window_resizer.h"
6 6
7 #include "ash/display/mouse_cursor_event_filter.h" 7 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 Shell::GetInstance()->cursor_manager()); 487 Shell::GetInstance()->cursor_manager());
488 // Move window from the root window with 1.0 device scale factor to the root 488 // Move window from the root window with 1.0 device scale factor to the root
489 // window with 2.0 device scale factor. 489 // window with 2.0 device scale factor.
490 { 490 {
491 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 491 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
492 Shell::GetScreen()->GetPrimaryDisplay()); 492 Shell::GetScreen()->GetPrimaryDisplay());
493 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 493 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
494 // Grab (0, 0) of the window. 494 // Grab (0, 0) of the window.
495 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( 495 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer(
496 window_.get(), gfx::Point(), HTCAPTION)); 496 window_.get(), gfx::Point(), HTCAPTION));
497 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 497 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
498 ASSERT_TRUE(resizer.get()); 498 ASSERT_TRUE(resizer.get());
499 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); 499 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
500 WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200)); 500 WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200));
501 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); 501 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
502 resizer->CompleteDrag(); 502 resizer->CompleteDrag();
503 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); 503 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
504 } 504 }
505 505
506 // Move window from the root window with 2.0 device scale factor to the root 506 // Move window from the root window with 2.0 device scale factor to the root
507 // window with 1.0 device scale factor. 507 // window with 1.0 device scale factor.
508 { 508 {
509 // Make sure the window is on the default container first. 509 // Make sure the window is on the default container first.
510 aura::Window* default_container = 510 aura::Window* default_container =
511 GetRootWindowController(root_windows[1]) 511 GetRootWindowController(root_windows[1])
512 ->GetContainer(kShellWindowId_DefaultContainer); 512 ->GetContainer(kShellWindowId_DefaultContainer);
513 default_container->AddChild(window_.get()); 513 default_container->AddChild(window_.get());
514 window_->SetBoundsInScreen( 514 window_->SetBoundsInScreen(
515 gfx::Rect(600, 0, 50, 60), 515 gfx::Rect(600, 0, 50, 60),
516 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1])); 516 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1]));
517 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 517 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
518 // Grab (0, 0) of the window. 518 // Grab (0, 0) of the window.
519 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( 519 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer(
520 window_.get(), gfx::Point(), HTCAPTION)); 520 window_.get(), gfx::Point(), HTCAPTION));
521 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); 521 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
522 ASSERT_TRUE(resizer.get()); 522 ASSERT_TRUE(resizer.get());
523 resizer->Drag(CalculateDragPoint(*resizer, -200, 200), 0); 523 resizer->Drag(CalculateDragPoint(*resizer, -200, 200), 0);
524 WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(400, 200)); 524 WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(400, 200));
525 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 525 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
526 resizer->CompleteDrag(); 526 resizer->CompleteDrag();
527 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 527 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
528 } 528 }
529 } 529 }
530 530
531 // Verifies several kinds of windows can be moved across displays. 531 // Verifies several kinds of windows can be moved across displays.
532 TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { 532 TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
533 if (!SupportsMultipleDisplays()) 533 if (!SupportsMultipleDisplays())
534 return; 534 return;
535 535
536 // The secondary display is logically on the right, but on the system (e.g. X) 536 // The secondary display is logically on the right, but on the system (e.g. X)
537 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 537 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 window, gfx::Point(), HTCAPTION)); 626 window, gfx::Point(), HTCAPTION));
627 ASSERT_TRUE(resizer.get()); 627 ASSERT_TRUE(resizer.get());
628 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); 628 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
629 EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], 629 EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0],
630 gfx::Point(399, 200))); 630 gfx::Point(399, 200)));
631 resizer->CompleteDrag(); 631 resizer->CompleteDrag();
632 } 632 }
633 } 633 }
634 634
635 } // namespace ash 635 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698