OLD | NEW |
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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // Test Window::ConvertPointToWindow() with transform to root_window. | 368 // Test Window::ConvertPointToWindow() with transform to root_window. |
369 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) { | 369 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) { |
370 RootWindow* root = root_window(); | 370 RootWindow* root = root_window(); |
371 gfx::Transform transform; | 371 gfx::Transform transform; |
372 transform.Translate(100.0, 100.0); | 372 transform.Translate(100.0, 100.0); |
373 transform.Rotate(90.0); | 373 transform.Rotate(90.0); |
374 transform.Scale(2.0, 5.0); | 374 transform.Scale(2.0, 5.0); |
375 root->SetTransform(transform); | 375 root->SetTransform(transform); |
376 root->MoveCursorTo(gfx::Point(10, 10)); | 376 root->MoveCursorTo(gfx::Point(10, 10)); |
377 #if !defined(OS_WIN) | 377 #if !defined(OS_WIN) |
| 378 gfx::Point mouse_location; |
| 379 EXPECT_TRUE(root->QueryMouseLocationForTest(&mouse_location)); |
378 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD | 380 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD |
379 EXPECT_EQ("50,120", root->QueryMouseLocationForTest().ToString()); | 381 EXPECT_EQ("50,120", mouse_location.ToString()); |
380 #endif | 382 #endif |
381 EXPECT_EQ("10,10", | 383 EXPECT_EQ("10,10", |
382 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); | 384 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); |
383 } | 385 } |
384 | 386 |
385 // Tests Window::ConvertPointToWindow() with transform to non-root windows. | 387 // Tests Window::ConvertPointToWindow() with transform to non-root windows. |
386 TEST_F(WindowTest, MoveCursorToWithTransformWindow) { | 388 TEST_F(WindowTest, MoveCursorToWithTransformWindow) { |
387 scoped_ptr<Window> w1( | 389 scoped_ptr<Window> w1( |
388 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), | 390 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), |
389 root_window())); | 391 root_window())); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 root->SetTransform(root_transform); | 451 root->SetTransform(root_transform); |
450 w1->SetTransform(transform); | 452 w1->SetTransform(transform); |
451 w11->SetTransform(transform); | 453 w11->SetTransform(transform); |
452 w111->SetTransform(transform); | 454 w111->SetTransform(transform); |
453 w1111->SetTransform(transform); | 455 w1111->SetTransform(transform); |
454 | 456 |
455 w1111->MoveCursorTo(gfx::Point(10, 10)); | 457 w1111->MoveCursorTo(gfx::Point(10, 10)); |
456 | 458 |
457 #if !defined(OS_WIN) | 459 #if !defined(OS_WIN) |
458 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. | 460 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. |
459 EXPECT_EQ("169,80", root->QueryMouseLocationForTest().ToString()); | 461 gfx::Point mouse_location; |
| 462 EXPECT_TRUE(root->QueryMouseLocationForTest(&mouse_location)); |
| 463 EXPECT_EQ("169,80", mouse_location.ToString()); |
460 #endif | 464 #endif |
461 EXPECT_EQ("20,53", | 465 EXPECT_EQ("20,53", |
462 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); | 466 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); |
463 } | 467 } |
464 | 468 |
465 TEST_F(WindowTest, HitTest) { | 469 TEST_F(WindowTest, HitTest) { |
466 Window w1(new ColorTestWindowDelegate(SK_ColorWHITE)); | 470 Window w1(new ColorTestWindowDelegate(SK_ColorWHITE)); |
467 w1.set_id(1); | 471 w1.set_id(1); |
468 w1.Init(ui::LAYER_TEXTURED); | 472 w1.Init(ui::LAYER_TEXTURED); |
469 w1.SetBounds(gfx::Rect(10, 20, 50, 60)); | 473 w1.SetBounds(gfx::Rect(10, 20, 50, 60)); |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 // Move |w2| to be a child of |w1|. | 2594 // Move |w2| to be a child of |w1|. |
2591 w1->AddChild(w2.get()); | 2595 w1->AddChild(w2.get()); |
2592 // Sine we moved in the same root, observer shouldn't be notified. | 2596 // Sine we moved in the same root, observer shouldn't be notified. |
2593 EXPECT_EQ("0 0", observer.CountStringAndReset()); | 2597 EXPECT_EQ("0 0", observer.CountStringAndReset()); |
2594 // |w2| should still have focus after moving. | 2598 // |w2| should still have focus after moving. |
2595 EXPECT_TRUE(w2->HasFocus()); | 2599 EXPECT_TRUE(w2->HasFocus()); |
2596 } | 2600 } |
2597 | 2601 |
2598 } // namespace test | 2602 } // namespace test |
2599 } // namespace aura | 2603 } // namespace aura |
OLD | NEW |