| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 widget->Init(params); | 346 widget->Init(params); |
| 347 internal::RootView* root = | 347 internal::RootView* root = |
| 348 static_cast<internal::RootView*>(widget->GetRootView()); | 348 static_cast<internal::RootView*>(widget->GetRootView()); |
| 349 | 349 |
| 350 root->AddChildView(v1); | 350 root->AddChildView(v1); |
| 351 v1->AddChildView(v2); | 351 v1->AddChildView(v2); |
| 352 | 352 |
| 353 v1->Reset(); | 353 v1->Reset(); |
| 354 v2->Reset(); | 354 v2->Reset(); |
| 355 | 355 |
| 356 gfx::Point p1(110, 120); | 356 gfx::PointF p1(110.f, 120.f); |
| 357 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), | 357 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), |
| 358 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 358 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 359 root->OnMousePressed(pressed); | 359 root->OnMousePressed(pressed); |
| 360 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_PRESSED); | 360 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_PRESSED); |
| 361 EXPECT_EQ(v2->location_.x(), 10); | 361 EXPECT_EQ(v2->location_.x(), 10); |
| 362 EXPECT_EQ(v2->location_.y(), 20); | 362 EXPECT_EQ(v2->location_.y(), 20); |
| 363 // Make sure v1 did not receive the event | 363 // Make sure v1 did not receive the event |
| 364 EXPECT_EQ(v1->last_mouse_event_type_, 0); | 364 EXPECT_EQ(v1->last_mouse_event_type_, 0); |
| 365 | 365 |
| 366 // Drag event out of bounds. Should still go to v2 | 366 // Drag event out of bounds. Should still go to v2 |
| 367 v1->Reset(); | 367 v1->Reset(); |
| 368 v2->Reset(); | 368 v2->Reset(); |
| 369 gfx::Point p2(50, 40); | 369 gfx::PointF p2(50.f, 40.f); |
| 370 ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, p2, p2, ui::EventTimeForNow(), | 370 ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, p2, p2, ui::EventTimeForNow(), |
| 371 ui::EF_LEFT_MOUSE_BUTTON, 0); | 371 ui::EF_LEFT_MOUSE_BUTTON, 0); |
| 372 root->OnMouseDragged(dragged); | 372 root->OnMouseDragged(dragged); |
| 373 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_DRAGGED); | 373 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_DRAGGED); |
| 374 EXPECT_EQ(v2->location_.x(), -50); | 374 EXPECT_EQ(v2->location_.x(), -50); |
| 375 EXPECT_EQ(v2->location_.y(), -60); | 375 EXPECT_EQ(v2->location_.y(), -60); |
| 376 // Make sure v1 did not receive the event | 376 // Make sure v1 did not receive the event |
| 377 EXPECT_EQ(v1->last_mouse_event_type_, 0); | 377 EXPECT_EQ(v1->last_mouse_event_type_, 0); |
| 378 | 378 |
| 379 // Releasted event out of bounds. Should still go to v2 | 379 // Releasted event out of bounds. Should still go to v2 |
| 380 v1->Reset(); | 380 v1->Reset(); |
| 381 v2->Reset(); | 381 v2->Reset(); |
| 382 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 382 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::PointF(), gfx::PointF(), |
| 383 ui::EventTimeForNow(), 0, 0); | 383 ui::EventTimeForNow(), 0, 0); |
| 384 root->OnMouseDragged(released); | 384 root->OnMouseDragged(released); |
| 385 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_RELEASED); | 385 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_RELEASED); |
| 386 EXPECT_EQ(v2->location_.x(), -100); | 386 EXPECT_EQ(v2->location_.x(), -100); |
| 387 EXPECT_EQ(v2->location_.y(), -100); | 387 EXPECT_EQ(v2->location_.y(), -100); |
| 388 // Make sure v1 did not receive the event | 388 // Make sure v1 did not receive the event |
| 389 EXPECT_EQ(v1->last_mouse_event_type_, 0); | 389 EXPECT_EQ(v1->last_mouse_event_type_, 0); |
| 390 | 390 |
| 391 widget->CloseNow(); | 391 widget->CloseNow(); |
| 392 } | 392 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 406 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); | 406 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); |
| 407 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 407 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 408 params.bounds = gfx::Rect(50, 50, 650, 650); | 408 params.bounds = gfx::Rect(50, 50, 650, 650); |
| 409 widget->Init(params); | 409 widget->Init(params); |
| 410 View* root = widget->GetRootView(); | 410 View* root = widget->GetRootView(); |
| 411 | 411 |
| 412 root->AddChildView(v1); | 412 root->AddChildView(v1); |
| 413 v1->AddChildView(v2); | 413 v1->AddChildView(v2); |
| 414 | 414 |
| 415 v2->delete_on_pressed_ = true; | 415 v2->delete_on_pressed_ = true; |
| 416 gfx::Point point(110, 120); | 416 gfx::PointF point(110.f, 120.f); |
| 417 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point, point, | 417 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point, point, |
| 418 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 418 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
| 419 ui::EF_LEFT_MOUSE_BUTTON); | 419 ui::EF_LEFT_MOUSE_BUTTON); |
| 420 root->OnMousePressed(pressed); | 420 root->OnMousePressed(pressed); |
| 421 EXPECT_EQ(0, v1->child_count()); | 421 EXPECT_EQ(0, v1->child_count()); |
| 422 | 422 |
| 423 widget->CloseNow(); | 423 widget->CloseNow(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 //////////////////////////////////////////////////////////////////////////////// | 426 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 | 1671 |
| 1672 v1->Reset(); | 1672 v1->Reset(); |
| 1673 v11->Reset(); | 1673 v11->Reset(); |
| 1674 v111->Reset(); | 1674 v111->Reset(); |
| 1675 v12->Reset(); | 1675 v12->Reset(); |
| 1676 v121->Reset(); | 1676 v121->Reset(); |
| 1677 v2->Reset(); | 1677 v2->Reset(); |
| 1678 v21->Reset(); | 1678 v21->Reset(); |
| 1679 | 1679 |
| 1680 // Move the mouse in v111. | 1680 // Move the mouse in v111. |
| 1681 gfx::Point p1(6, 6); | 1681 gfx::PointF p1(6.f, 6.f); |
| 1682 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, p1, p1, ui::EventTimeForNow(), 0, 0); | 1682 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, p1, p1, ui::EventTimeForNow(), 0, 0); |
| 1683 root_view->OnMouseMoved(move1); | 1683 root_view->OnMouseMoved(move1); |
| 1684 EXPECT_TRUE(v111->received_mouse_enter_); | 1684 EXPECT_TRUE(v111->received_mouse_enter_); |
| 1685 EXPECT_FALSE(v11->last_mouse_event_type_); | 1685 EXPECT_FALSE(v11->last_mouse_event_type_); |
| 1686 EXPECT_TRUE(v1->received_mouse_enter_); | 1686 EXPECT_TRUE(v1->received_mouse_enter_); |
| 1687 | 1687 |
| 1688 v111->Reset(); | 1688 v111->Reset(); |
| 1689 v1->Reset(); | 1689 v1->Reset(); |
| 1690 | 1690 |
| 1691 // Now, move into v121. | 1691 // Now, move into v121. |
| 1692 gfx::Point p2(65, 21); | 1692 gfx::PointF p2(65.f, 21.f); |
| 1693 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, p2, p2, ui::EventTimeForNow(), 0, 0); | 1693 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, p2, p2, ui::EventTimeForNow(), 0, 0); |
| 1694 root_view->OnMouseMoved(move2); | 1694 root_view->OnMouseMoved(move2); |
| 1695 EXPECT_TRUE(v111->received_mouse_exit_); | 1695 EXPECT_TRUE(v111->received_mouse_exit_); |
| 1696 EXPECT_TRUE(v121->received_mouse_enter_); | 1696 EXPECT_TRUE(v121->received_mouse_enter_); |
| 1697 EXPECT_FALSE(v1->last_mouse_event_type_); | 1697 EXPECT_FALSE(v1->last_mouse_event_type_); |
| 1698 | 1698 |
| 1699 v111->Reset(); | 1699 v111->Reset(); |
| 1700 v121->Reset(); | 1700 v121->Reset(); |
| 1701 | 1701 |
| 1702 // Now, move into v11. | 1702 // Now, move into v11. |
| 1703 gfx::Point p3(1, 1); | 1703 gfx::PointF p3(1.f, 1.f); |
| 1704 ui::MouseEvent move3(ui::ET_MOUSE_MOVED, p3, p3, ui::EventTimeForNow(), 0, 0); | 1704 ui::MouseEvent move3(ui::ET_MOUSE_MOVED, p3, p3, ui::EventTimeForNow(), 0, 0); |
| 1705 root_view->OnMouseMoved(move3); | 1705 root_view->OnMouseMoved(move3); |
| 1706 EXPECT_TRUE(v121->received_mouse_exit_); | 1706 EXPECT_TRUE(v121->received_mouse_exit_); |
| 1707 EXPECT_TRUE(v11->received_mouse_enter_); | 1707 EXPECT_TRUE(v11->received_mouse_enter_); |
| 1708 EXPECT_FALSE(v1->last_mouse_event_type_); | 1708 EXPECT_FALSE(v1->last_mouse_event_type_); |
| 1709 | 1709 |
| 1710 v121->Reset(); | 1710 v121->Reset(); |
| 1711 v11->Reset(); | 1711 v11->Reset(); |
| 1712 | 1712 |
| 1713 // Move to v21. | 1713 // Move to v21. |
| 1714 gfx::Point p4(121, 15); | 1714 gfx::PointF p4(121.f, 15.f); |
| 1715 ui::MouseEvent move4(ui::ET_MOUSE_MOVED, p4, p4, ui::EventTimeForNow(), 0, 0); | 1715 ui::MouseEvent move4(ui::ET_MOUSE_MOVED, p4, p4, ui::EventTimeForNow(), 0, 0); |
| 1716 root_view->OnMouseMoved(move4); | 1716 root_view->OnMouseMoved(move4); |
| 1717 EXPECT_TRUE(v21->received_mouse_enter_); | 1717 EXPECT_TRUE(v21->received_mouse_enter_); |
| 1718 EXPECT_FALSE(v2->last_mouse_event_type_); | 1718 EXPECT_FALSE(v2->last_mouse_event_type_); |
| 1719 EXPECT_TRUE(v11->received_mouse_exit_); | 1719 EXPECT_TRUE(v11->received_mouse_exit_); |
| 1720 EXPECT_TRUE(v1->received_mouse_exit_); | 1720 EXPECT_TRUE(v1->received_mouse_exit_); |
| 1721 | 1721 |
| 1722 v21->Reset(); | 1722 v21->Reset(); |
| 1723 v11->Reset(); | 1723 v11->Reset(); |
| 1724 v1->Reset(); | 1724 v1->Reset(); |
| 1725 | 1725 |
| 1726 // Move to v1. | 1726 // Move to v1. |
| 1727 gfx::Point p5(21, 0); | 1727 gfx::PointF p5(21.f, 0.f); |
| 1728 ui::MouseEvent move5(ui::ET_MOUSE_MOVED, p5, p5, ui::EventTimeForNow(), 0, 0); | 1728 ui::MouseEvent move5(ui::ET_MOUSE_MOVED, p5, p5, ui::EventTimeForNow(), 0, 0); |
| 1729 root_view->OnMouseMoved(move5); | 1729 root_view->OnMouseMoved(move5); |
| 1730 EXPECT_TRUE(v21->received_mouse_exit_); | 1730 EXPECT_TRUE(v21->received_mouse_exit_); |
| 1731 EXPECT_TRUE(v1->received_mouse_enter_); | 1731 EXPECT_TRUE(v1->received_mouse_enter_); |
| 1732 | 1732 |
| 1733 v21->Reset(); | 1733 v21->Reset(); |
| 1734 v1->Reset(); | 1734 v1->Reset(); |
| 1735 | 1735 |
| 1736 // Now, move into v11. | 1736 // Now, move into v11. |
| 1737 gfx::Point p6(15, 15); | 1737 gfx::PointF p6(15.f, 15.f); |
| 1738 ui::MouseEvent mouse6(ui::ET_MOUSE_MOVED, p6, p6, ui::EventTimeForNow(), 0, | 1738 ui::MouseEvent mouse6(ui::ET_MOUSE_MOVED, p6, p6, ui::EventTimeForNow(), 0, |
| 1739 0); | 1739 0); |
| 1740 root_view->OnMouseMoved(mouse6); | 1740 root_view->OnMouseMoved(mouse6); |
| 1741 EXPECT_TRUE(v11->received_mouse_enter_); | 1741 EXPECT_TRUE(v11->received_mouse_enter_); |
| 1742 EXPECT_FALSE(v1->last_mouse_event_type_); | 1742 EXPECT_FALSE(v1->last_mouse_event_type_); |
| 1743 | 1743 |
| 1744 v11->Reset(); | 1744 v11->Reset(); |
| 1745 v1->Reset(); | 1745 v1->Reset(); |
| 1746 | 1746 |
| 1747 // Move back into v1. Although |v1| had already received an ENTER for mouse6, | 1747 // Move back into v1. Although |v1| had already received an ENTER for mouse6, |
| 1748 // and the mouse remains inside |v1| the whole time, it receives another ENTER | 1748 // and the mouse remains inside |v1| the whole time, it receives another ENTER |
| 1749 // when the mouse leaves v11. | 1749 // when the mouse leaves v11. |
| 1750 gfx::Point p7(21, 0); | 1750 gfx::PointF p7(21.f, 0.f); |
| 1751 ui::MouseEvent mouse7(ui::ET_MOUSE_MOVED, p7, p7, ui::EventTimeForNow(), 0, | 1751 ui::MouseEvent mouse7(ui::ET_MOUSE_MOVED, p7, p7, ui::EventTimeForNow(), 0, |
| 1752 0); | 1752 0); |
| 1753 root_view->OnMouseMoved(mouse7); | 1753 root_view->OnMouseMoved(mouse7); |
| 1754 EXPECT_TRUE(v11->received_mouse_exit_); | 1754 EXPECT_TRUE(v11->received_mouse_exit_); |
| 1755 EXPECT_FALSE(v1->received_mouse_enter_); | 1755 EXPECT_FALSE(v1->received_mouse_enter_); |
| 1756 | 1756 |
| 1757 widget->CloseNow(); | 1757 widget->CloseNow(); |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 TEST_F(ViewTest, Textfield) { | 1760 TEST_F(ViewTest, Textfield) { |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 // Rotate |v1| counter-clockwise. | 2270 // Rotate |v1| counter-clockwise. |
| 2271 gfx::Transform transform(v1->GetTransform()); | 2271 gfx::Transform transform(v1->GetTransform()); |
| 2272 RotateCounterclockwise(&transform); | 2272 RotateCounterclockwise(&transform); |
| 2273 transform.matrix().set(1, 3, 500.0); | 2273 transform.matrix().set(1, 3, 500.0); |
| 2274 v1->SetTransform(transform); | 2274 v1->SetTransform(transform); |
| 2275 | 2275 |
| 2276 // |v2| now occupies (100, 200) to (200, 400) in |root|. | 2276 // |v2| now occupies (100, 200) to (200, 400) in |root|. |
| 2277 v1->Reset(); | 2277 v1->Reset(); |
| 2278 v2->Reset(); | 2278 v2->Reset(); |
| 2279 | 2279 |
| 2280 gfx::Point p1(110, 210); | 2280 gfx::PointF p1(110.f, 210.f); |
| 2281 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), | 2281 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), |
| 2282 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2282 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 2283 root->OnMousePressed(pressed); | 2283 root->OnMousePressed(pressed); |
| 2284 EXPECT_EQ(0, v1->last_mouse_event_type_); | 2284 EXPECT_EQ(0, v1->last_mouse_event_type_); |
| 2285 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); | 2285 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); |
| 2286 EXPECT_EQ(190, v2->location_.x()); | 2286 EXPECT_EQ(190, v2->location_.x()); |
| 2287 EXPECT_EQ(10, v2->location_.y()); | 2287 EXPECT_EQ(10, v2->location_.y()); |
| 2288 | 2288 |
| 2289 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 2289 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::PointF(), gfx::PointF(), |
| 2290 ui::EventTimeForNow(), 0, 0); | 2290 ui::EventTimeForNow(), 0, 0); |
| 2291 root->OnMouseReleased(released); | 2291 root->OnMouseReleased(released); |
| 2292 | 2292 |
| 2293 // Now rotate |v2| inside |v1| clockwise. | 2293 // Now rotate |v2| inside |v1| clockwise. |
| 2294 transform = v2->GetTransform(); | 2294 transform = v2->GetTransform(); |
| 2295 RotateClockwise(&transform); | 2295 RotateClockwise(&transform); |
| 2296 transform.matrix().set(0, 3, 100.f); | 2296 transform.matrix().set(0, 3, 100.f); |
| 2297 v2->SetTransform(transform); | 2297 v2->SetTransform(transform); |
| 2298 | 2298 |
| 2299 // Now, |v2| occupies (100, 100) to (200, 300) in |v1|, and (100, 300) to | 2299 // Now, |v2| occupies (100, 100) to (200, 300) in |v1|, and (100, 300) to |
| 2300 // (300, 400) in |root|. | 2300 // (300, 400) in |root|. |
| 2301 | 2301 |
| 2302 v1->Reset(); | 2302 v1->Reset(); |
| 2303 v2->Reset(); | 2303 v2->Reset(); |
| 2304 | 2304 |
| 2305 gfx::Point point2(110, 320); | 2305 gfx::PointF point2(110.f, 320.f); |
| 2306 ui::MouseEvent p2(ui::ET_MOUSE_PRESSED, point2, point2, ui::EventTimeForNow(), | 2306 ui::MouseEvent p2(ui::ET_MOUSE_PRESSED, point2, point2, ui::EventTimeForNow(), |
| 2307 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2307 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 2308 root->OnMousePressed(p2); | 2308 root->OnMousePressed(p2); |
| 2309 EXPECT_EQ(0, v1->last_mouse_event_type_); | 2309 EXPECT_EQ(0, v1->last_mouse_event_type_); |
| 2310 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); | 2310 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); |
| 2311 EXPECT_EQ(10, v2->location_.x()); | 2311 EXPECT_EQ(10, v2->location_.x()); |
| 2312 EXPECT_EQ(20, v2->location_.y()); | 2312 EXPECT_EQ(20, v2->location_.y()); |
| 2313 | 2313 |
| 2314 root->OnMouseReleased(released); | 2314 root->OnMouseReleased(released); |
| 2315 | 2315 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2331 transform.matrix().set(0, 0, 0.8f); | 2331 transform.matrix().set(0, 0, 0.8f); |
| 2332 transform.matrix().set(1, 1, 0.5f); | 2332 transform.matrix().set(1, 1, 0.5f); |
| 2333 v2->SetTransform(transform); | 2333 v2->SetTransform(transform); |
| 2334 | 2334 |
| 2335 // |v3| occupies (108, 105) to (132, 115) in |root|. | 2335 // |v3| occupies (108, 105) to (132, 115) in |root|. |
| 2336 | 2336 |
| 2337 v1->Reset(); | 2337 v1->Reset(); |
| 2338 v2->Reset(); | 2338 v2->Reset(); |
| 2339 v3->Reset(); | 2339 v3->Reset(); |
| 2340 | 2340 |
| 2341 gfx::Point point(112, 110); | 2341 gfx::PointF point(112.f, 110.f); |
| 2342 ui::MouseEvent p3(ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), | 2342 ui::MouseEvent p3(ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
| 2343 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2343 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 2344 root->OnMousePressed(p3); | 2344 root->OnMousePressed(p3); |
| 2345 | 2345 |
| 2346 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); | 2346 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); |
| 2347 EXPECT_EQ(10, v3->location_.x()); | 2347 EXPECT_EQ(10, v3->location_.x()); |
| 2348 EXPECT_EQ(25, v3->location_.y()); | 2348 EXPECT_EQ(25, v3->location_.y()); |
| 2349 | 2349 |
| 2350 root->OnMouseReleased(released); | 2350 root->OnMouseReleased(released); |
| 2351 | 2351 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2370 v3->SetTransform(transform); | 2370 v3->SetTransform(transform); |
| 2371 | 2371 |
| 2372 // Translate |v2| with respect to |v1|. | 2372 // Translate |v2| with respect to |v1|. |
| 2373 transform = v2->GetTransform(); | 2373 transform = v2->GetTransform(); |
| 2374 transform.matrix().set(0, 3, 10.f); | 2374 transform.matrix().set(0, 3, 10.f); |
| 2375 transform.matrix().set(1, 3, 10.f); | 2375 transform.matrix().set(1, 3, 10.f); |
| 2376 v2->SetTransform(transform); | 2376 v2->SetTransform(transform); |
| 2377 | 2377 |
| 2378 // |v3| now occupies (120, 120) to (144, 130) in |root|. | 2378 // |v3| now occupies (120, 120) to (144, 130) in |root|. |
| 2379 | 2379 |
| 2380 gfx::Point point3(124, 125); | 2380 gfx::PointF point3(124.f, 125.f); |
| 2381 ui::MouseEvent p4(ui::ET_MOUSE_PRESSED, point3, point3, ui::EventTimeForNow(), | 2381 ui::MouseEvent p4(ui::ET_MOUSE_PRESSED, point3, point3, ui::EventTimeForNow(), |
| 2382 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2382 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 2383 root->OnMousePressed(p4); | 2383 root->OnMousePressed(p4); |
| 2384 | 2384 |
| 2385 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); | 2385 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); |
| 2386 EXPECT_EQ(10, v3->location_.x()); | 2386 EXPECT_EQ(10, v3->location_.x()); |
| 2387 EXPECT_EQ(25, v3->location_.y()); | 2387 EXPECT_EQ(25, v3->location_.y()); |
| 2388 | 2388 |
| 2389 root->OnMouseReleased(released); | 2389 root->OnMouseReleased(released); |
| 2390 | 2390 |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 // notification. | 4093 // notification. |
| 4094 TestView* test_view_child_2 = new TestView(); | 4094 TestView* test_view_child_2 = new TestView(); |
| 4095 test_view->AddChildView(test_view_child_2); | 4095 test_view->AddChildView(test_view_child_2); |
| 4096 EXPECT_TRUE(test_view_child_2->native_theme_); | 4096 EXPECT_TRUE(test_view_child_2->native_theme_); |
| 4097 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_); | 4097 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_); |
| 4098 | 4098 |
| 4099 widget->CloseNow(); | 4099 widget->CloseNow(); |
| 4100 } | 4100 } |
| 4101 | 4101 |
| 4102 } // namespace views | 4102 } // namespace views |
| OLD | NEW |