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