| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 EXPECT_FALSE(w1.HitTest(gfx::Point(-5, -6))); | 456 EXPECT_FALSE(w1.HitTest(gfx::Point(-5, -6))); |
| 457 ui::TouchEvent released( | 457 ui::TouchEvent released( |
| 458 ui::ET_TOUCH_RELEASED, gfx::Point(50, 50), 0, getTime()); | 458 ui::ET_TOUCH_RELEASED, gfx::Point(50, 50), 0, getTime()); |
| 459 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&released); | 459 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&released); |
| 460 EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2))); | 460 EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2))); |
| 461 | 461 |
| 462 // TODO(beng): clip Window to parent. | 462 // TODO(beng): clip Window to parent. |
| 463 } | 463 } |
| 464 | 464 |
| 465 TEST_F(WindowTest, HitTestMask) { | 465 TEST_F(WindowTest, HitTestMask) { |
| 466 Window w1(new MaskedWindowDelegate(gfx::Rect(5, 6, 20, 30))); | 466 MaskedWindowDelegate d1(gfx::Rect(5, 6, 20, 30)); |
| 467 Window w1(&d1); |
| 467 w1.Init(ui::LAYER_NOT_DRAWN); | 468 w1.Init(ui::LAYER_NOT_DRAWN); |
| 468 w1.SetBounds(gfx::Rect(10, 20, 50, 60)); | 469 w1.SetBounds(gfx::Rect(10, 20, 50, 60)); |
| 469 w1.Show(); | 470 w1.Show(); |
| 470 w1.SetParent(NULL); | 471 w1.SetParent(NULL); |
| 471 | 472 |
| 472 // Points inside the mask. | 473 // Points inside the mask. |
| 473 EXPECT_TRUE(w1.HitTest(gfx::Point(5, 6))); // top-left | 474 EXPECT_TRUE(w1.HitTest(gfx::Point(5, 6))); // top-left |
| 474 EXPECT_TRUE(w1.HitTest(gfx::Point(15, 21))); // center | 475 EXPECT_TRUE(w1.HitTest(gfx::Point(15, 21))); // center |
| 475 EXPECT_TRUE(w1.HitTest(gfx::Point(24, 35))); // bottom-right | 476 EXPECT_TRUE(w1.HitTest(gfx::Point(24, 35))); // bottom-right |
| 476 | 477 |
| (...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2536 // Move |w2| to be a child of |w1|. | 2537 // Move |w2| to be a child of |w1|. |
| 2537 w1->AddChild(w2.get()); | 2538 w1->AddChild(w2.get()); |
| 2538 // Sine we moved in the same root, observer shouldn't be notified. | 2539 // Sine we moved in the same root, observer shouldn't be notified. |
| 2539 EXPECT_EQ("0 0", observer.CountStringAndReset()); | 2540 EXPECT_EQ("0 0", observer.CountStringAndReset()); |
| 2540 // |w2| should still have focus after moving. | 2541 // |w2| should still have focus after moving. |
| 2541 EXPECT_TRUE(w2->HasFocus()); | 2542 EXPECT_TRUE(w2->HasFocus()); |
| 2542 } | 2543 } |
| 2543 | 2544 |
| 2544 } // namespace test | 2545 } // namespace test |
| 2545 } // namespace aura | 2546 } // namespace aura |
| OLD | NEW |