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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/event_rewriter_delegate.h ('k') | ash/keyboard_overlay/keyboard_overlay_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/multi_display_manager.h" 6 #include "ash/display/multi_display_manager.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/coordinate_conversion.h" 9 #include "ash/wm/coordinate_conversion.h"
10 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 // Transient window doesn't move between root window unless 451 // Transient window doesn't move between root window unless
452 // its transient parent moves. 452 // its transient parent moves.
453 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50)); 453 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50));
454 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); 454 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow());
455 EXPECT_EQ("10,50 50x50", 455 EXPECT_EQ("10,50 50x50",
456 w1_t1->GetWindowBoundsInScreen().ToString()); 456 w1_t1->GetWindowBoundsInScreen().ToString());
457 } 457 }
458 458
459 namespace internal { 459 namespace internal {
460 // Test if the Window::ConvertPointToWindow works across root windows. 460 // Test if the Window::ConvertPointToTarget works across root windows.
461 // TODO(oshima): Move multiple display suport and this test to aura. 461 // TODO(oshima): Move multiple display suport and this test to aura.
462 TEST_F(ExtendedDesktopTest, ConvertPoint) { 462 TEST_F(ExtendedDesktopTest, ConvertPoint) {
463 UpdateDisplay("1000x600,600x400"); 463 UpdateDisplay("1000x600,600x400");
464 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 464 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
465 gfx::Display& display_1 = 465 gfx::Display& display_1 =
466 display_manager()->FindDisplayForRootWindow(root_windows[0]); 466 display_manager()->FindDisplayForRootWindow(root_windows[0]);
467 EXPECT_EQ("0,0", display_1.bounds().origin().ToString()); 467 EXPECT_EQ("0,0", display_1.bounds().origin().ToString());
468 gfx::Display& display_2 = 468 gfx::Display& display_2 =
469 display_manager()->FindDisplayForRootWindow(root_windows[1]); 469 display_manager()->FindDisplayForRootWindow(root_windows[1]);
470 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString()); 470 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString());
471 471
472 aura::Window* d1 = 472 aura::Window* d1 =
473 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView(); 473 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView();
474 aura::Window* d2 = 474 aura::Window* d2 =
475 CreateTestWidget(gfx::Rect(1020, 20, 100, 100))->GetNativeView(); 475 CreateTestWidget(gfx::Rect(1020, 20, 100, 100))->GetNativeView();
476 EXPECT_EQ(root_windows[0], d1->GetRootWindow()); 476 EXPECT_EQ(root_windows[0], d1->GetRootWindow());
477 EXPECT_EQ(root_windows[1], d2->GetRootWindow()); 477 EXPECT_EQ(root_windows[1], d2->GetRootWindow());
478 478
479 // Convert point in the Root2's window to the Root1's window Coord. 479 // Convert point in the Root2's window to the Root1's window Coord.
480 gfx::Point p(0, 0); 480 gfx::Point p(0, 0);
481 aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p); 481 aura::Window::ConvertPointToTarget(root_windows[1], root_windows[0], &p);
482 EXPECT_EQ("1000,0", p.ToString()); 482 EXPECT_EQ("1000,0", p.ToString());
483 p.SetPoint(0, 0); 483 p.SetPoint(0, 0);
484 aura::Window::ConvertPointToWindow(d2, d1, &p); 484 aura::Window::ConvertPointToTarget(d2, d1, &p);
485 EXPECT_EQ("1010,10", p.ToString()); 485 EXPECT_EQ("1010,10", p.ToString());
486 486
487 // Convert point in the Root1's window to the Root2's window Coord. 487 // Convert point in the Root1's window to the Root2's window Coord.
488 p.SetPoint(0, 0); 488 p.SetPoint(0, 0);
489 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); 489 aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p);
490 EXPECT_EQ("-1000,0", p.ToString()); 490 EXPECT_EQ("-1000,0", p.ToString());
491 p.SetPoint(0, 0); 491 p.SetPoint(0, 0);
492 aura::Window::ConvertPointToWindow(d1, d2, &p); 492 aura::Window::ConvertPointToTarget(d1, d2, &p);
493 EXPECT_EQ("-1010,-10", p.ToString()); 493 EXPECT_EQ("-1010,-10", p.ToString());
494 494
495 // Move the 2nd display to the bottom and test again. 495 // Move the 2nd display to the bottom and test again.
496 Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout( 496 Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
497 internal::DisplayController::BOTTOM); 497 internal::DisplayController::BOTTOM);
498 498
499 display_2 = display_manager()->FindDisplayForRootWindow(root_windows[1]); 499 display_2 = display_manager()->FindDisplayForRootWindow(root_windows[1]);
500 EXPECT_EQ("0,600", display_2.bounds().origin().ToString()); 500 EXPECT_EQ("0,600", display_2.bounds().origin().ToString());
501 501
502 // Convert point in Root2's window to Root1's window Coord. 502 // Convert point in Root2's window to Root1's window Coord.
503 p.SetPoint(0, 0); 503 p.SetPoint(0, 0);
504 aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p); 504 aura::Window::ConvertPointToTarget(root_windows[1], root_windows[0], &p);
505 EXPECT_EQ("0,600", p.ToString()); 505 EXPECT_EQ("0,600", p.ToString());
506 p.SetPoint(0, 0); 506 p.SetPoint(0, 0);
507 aura::Window::ConvertPointToWindow(d2, d1, &p); 507 aura::Window::ConvertPointToTarget(d2, d1, &p);
508 EXPECT_EQ("10,610", p.ToString()); 508 EXPECT_EQ("10,610", p.ToString());
509 509
510 // Convert point in Root1's window to Root2's window Coord. 510 // Convert point in Root1's window to Root2's window Coord.
511 p.SetPoint(0, 0); 511 p.SetPoint(0, 0);
512 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); 512 aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p);
513 EXPECT_EQ("0,-600", p.ToString()); 513 EXPECT_EQ("0,-600", p.ToString());
514 p.SetPoint(0, 0); 514 p.SetPoint(0, 0);
515 aura::Window::ConvertPointToWindow(d1, d2, &p); 515 aura::Window::ConvertPointToTarget(d1, d2, &p);
516 EXPECT_EQ("-10,-610", p.ToString()); 516 EXPECT_EQ("-10,-610", p.ToString());
517 } 517 }
518 518
519 } // namespace internal 519 } // namespace internal
520 } // namespace ash 520 } // namespace ash
OLDNEW
« no previous file with comments | « ash/event_rewriter_delegate.h ('k') | ash/keyboard_overlay/keyboard_overlay_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698