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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::Point p1(110, 120); |
357 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), | 357 ui::MouseEvent pressed( |
358 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 358 ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), |
| 359 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 360 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
359 root->OnMousePressed(pressed); | 361 root->OnMousePressed(pressed); |
360 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_PRESSED); | 362 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_PRESSED); |
361 EXPECT_EQ(v2->location_.x(), 10); | 363 EXPECT_EQ(v2->location_.x(), 10); |
362 EXPECT_EQ(v2->location_.y(), 20); | 364 EXPECT_EQ(v2->location_.y(), 20); |
363 // Make sure v1 did not receive the event | 365 // Make sure v1 did not receive the event |
364 EXPECT_EQ(v1->last_mouse_event_type_, 0); | 366 EXPECT_EQ(v1->last_mouse_event_type_, 0); |
365 | 367 |
366 // Drag event out of bounds. Should still go to v2 | 368 // Drag event out of bounds. Should still go to v2 |
367 v1->Reset(); | 369 v1->Reset(); |
368 v2->Reset(); | 370 v2->Reset(); |
369 gfx::Point p2(50, 40); | 371 gfx::Point p2(50, 40); |
370 ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, p2, p2, ui::EventTimeForNow(), | 372 ui::MouseEvent dragged( |
371 ui::EF_LEFT_MOUSE_BUTTON, 0); | 373 ui::ET_MOUSE_DRAGGED, p2, p2, ui::EventTimeForNow(), |
| 374 ui::EF_LEFT_MOUSE_BUTTON, 0, |
| 375 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
372 root->OnMouseDragged(dragged); | 376 root->OnMouseDragged(dragged); |
373 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_DRAGGED); | 377 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_DRAGGED); |
374 EXPECT_EQ(v2->location_.x(), -50); | 378 EXPECT_EQ(v2->location_.x(), -50); |
375 EXPECT_EQ(v2->location_.y(), -60); | 379 EXPECT_EQ(v2->location_.y(), -60); |
376 // Make sure v1 did not receive the event | 380 // Make sure v1 did not receive the event |
377 EXPECT_EQ(v1->last_mouse_event_type_, 0); | 381 EXPECT_EQ(v1->last_mouse_event_type_, 0); |
378 | 382 |
379 // Releasted event out of bounds. Should still go to v2 | 383 // Releasted event out of bounds. Should still go to v2 |
380 v1->Reset(); | 384 v1->Reset(); |
381 v2->Reset(); | 385 v2->Reset(); |
382 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 386 ui::MouseEvent released( |
383 ui::EventTimeForNow(), 0, 0); | 387 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 388 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
384 root->OnMouseDragged(released); | 389 root->OnMouseDragged(released); |
385 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_RELEASED); | 390 EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_RELEASED); |
386 EXPECT_EQ(v2->location_.x(), -100); | 391 EXPECT_EQ(v2->location_.x(), -100); |
387 EXPECT_EQ(v2->location_.y(), -100); | 392 EXPECT_EQ(v2->location_.y(), -100); |
388 // Make sure v1 did not receive the event | 393 // Make sure v1 did not receive the event |
389 EXPECT_EQ(v1->last_mouse_event_type_, 0); | 394 EXPECT_EQ(v1->last_mouse_event_type_, 0); |
390 | 395 |
391 widget->CloseNow(); | 396 widget->CloseNow(); |
392 } | 397 } |
393 | 398 |
(...skipping 13 matching lines...) Expand all Loading... |
407 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 412 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
408 params.bounds = gfx::Rect(50, 50, 650, 650); | 413 params.bounds = gfx::Rect(50, 50, 650, 650); |
409 widget->Init(params); | 414 widget->Init(params); |
410 View* root = widget->GetRootView(); | 415 View* root = widget->GetRootView(); |
411 | 416 |
412 root->AddChildView(v1); | 417 root->AddChildView(v1); |
413 v1->AddChildView(v2); | 418 v1->AddChildView(v2); |
414 | 419 |
415 v2->delete_on_pressed_ = true; | 420 v2->delete_on_pressed_ = true; |
416 gfx::Point point(110, 120); | 421 gfx::Point point(110, 120); |
417 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point, point, | 422 ui::MouseEvent pressed( |
418 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 423 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
419 ui::EF_LEFT_MOUSE_BUTTON); | 424 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 425 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
420 root->OnMousePressed(pressed); | 426 root->OnMousePressed(pressed); |
421 EXPECT_EQ(0, v1->child_count()); | 427 EXPECT_EQ(0, v1->child_count()); |
422 | 428 |
423 widget->CloseNow(); | 429 widget->CloseNow(); |
424 } | 430 } |
425 | 431 |
426 //////////////////////////////////////////////////////////////////////////////// | 432 //////////////////////////////////////////////////////////////////////////////// |
427 // Painting | 433 // Painting |
428 //////////////////////////////////////////////////////////////////////////////// | 434 //////////////////////////////////////////////////////////////////////////////// |
429 | 435 |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 v1->Reset(); | 1678 v1->Reset(); |
1673 v11->Reset(); | 1679 v11->Reset(); |
1674 v111->Reset(); | 1680 v111->Reset(); |
1675 v12->Reset(); | 1681 v12->Reset(); |
1676 v121->Reset(); | 1682 v121->Reset(); |
1677 v2->Reset(); | 1683 v2->Reset(); |
1678 v21->Reset(); | 1684 v21->Reset(); |
1679 | 1685 |
1680 // Move the mouse in v111. | 1686 // Move the mouse in v111. |
1681 gfx::Point p1(6, 6); | 1687 gfx::Point p1(6, 6); |
1682 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, p1, p1, ui::EventTimeForNow(), 0, 0); | 1688 ui::MouseEvent move1( |
| 1689 ui::ET_MOUSE_MOVED, p1, p1, ui::EventTimeForNow(), 0, 0, |
| 1690 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1683 root_view->OnMouseMoved(move1); | 1691 root_view->OnMouseMoved(move1); |
1684 EXPECT_TRUE(v111->received_mouse_enter_); | 1692 EXPECT_TRUE(v111->received_mouse_enter_); |
1685 EXPECT_FALSE(v11->last_mouse_event_type_); | 1693 EXPECT_FALSE(v11->last_mouse_event_type_); |
1686 EXPECT_TRUE(v1->received_mouse_enter_); | 1694 EXPECT_TRUE(v1->received_mouse_enter_); |
1687 | 1695 |
1688 v111->Reset(); | 1696 v111->Reset(); |
1689 v1->Reset(); | 1697 v1->Reset(); |
1690 | 1698 |
1691 // Now, move into v121. | 1699 // Now, move into v121. |
1692 gfx::Point p2(65, 21); | 1700 gfx::Point p2(65, 21); |
1693 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, p2, p2, ui::EventTimeForNow(), 0, 0); | 1701 ui::MouseEvent move2( |
| 1702 ui::ET_MOUSE_MOVED, p2, p2, ui::EventTimeForNow(), 0, 0, |
| 1703 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1694 root_view->OnMouseMoved(move2); | 1704 root_view->OnMouseMoved(move2); |
1695 EXPECT_TRUE(v111->received_mouse_exit_); | 1705 EXPECT_TRUE(v111->received_mouse_exit_); |
1696 EXPECT_TRUE(v121->received_mouse_enter_); | 1706 EXPECT_TRUE(v121->received_mouse_enter_); |
1697 EXPECT_FALSE(v1->last_mouse_event_type_); | 1707 EXPECT_FALSE(v1->last_mouse_event_type_); |
1698 | 1708 |
1699 v111->Reset(); | 1709 v111->Reset(); |
1700 v121->Reset(); | 1710 v121->Reset(); |
1701 | 1711 |
1702 // Now, move into v11. | 1712 // Now, move into v11. |
1703 gfx::Point p3(1, 1); | 1713 gfx::Point p3(1, 1); |
1704 ui::MouseEvent move3(ui::ET_MOUSE_MOVED, p3, p3, ui::EventTimeForNow(), 0, 0); | 1714 ui::MouseEvent move3( |
| 1715 ui::ET_MOUSE_MOVED, p3, p3, ui::EventTimeForNow(), 0, 0, |
| 1716 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1705 root_view->OnMouseMoved(move3); | 1717 root_view->OnMouseMoved(move3); |
1706 EXPECT_TRUE(v121->received_mouse_exit_); | 1718 EXPECT_TRUE(v121->received_mouse_exit_); |
1707 EXPECT_TRUE(v11->received_mouse_enter_); | 1719 EXPECT_TRUE(v11->received_mouse_enter_); |
1708 EXPECT_FALSE(v1->last_mouse_event_type_); | 1720 EXPECT_FALSE(v1->last_mouse_event_type_); |
1709 | 1721 |
1710 v121->Reset(); | 1722 v121->Reset(); |
1711 v11->Reset(); | 1723 v11->Reset(); |
1712 | 1724 |
1713 // Move to v21. | 1725 // Move to v21. |
1714 gfx::Point p4(121, 15); | 1726 gfx::Point p4(121, 15); |
1715 ui::MouseEvent move4(ui::ET_MOUSE_MOVED, p4, p4, ui::EventTimeForNow(), 0, 0); | 1727 ui::MouseEvent move4( |
| 1728 ui::ET_MOUSE_MOVED, p4, p4, ui::EventTimeForNow(), 0, 0, |
| 1729 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1716 root_view->OnMouseMoved(move4); | 1730 root_view->OnMouseMoved(move4); |
1717 EXPECT_TRUE(v21->received_mouse_enter_); | 1731 EXPECT_TRUE(v21->received_mouse_enter_); |
1718 EXPECT_FALSE(v2->last_mouse_event_type_); | 1732 EXPECT_FALSE(v2->last_mouse_event_type_); |
1719 EXPECT_TRUE(v11->received_mouse_exit_); | 1733 EXPECT_TRUE(v11->received_mouse_exit_); |
1720 EXPECT_TRUE(v1->received_mouse_exit_); | 1734 EXPECT_TRUE(v1->received_mouse_exit_); |
1721 | 1735 |
1722 v21->Reset(); | 1736 v21->Reset(); |
1723 v11->Reset(); | 1737 v11->Reset(); |
1724 v1->Reset(); | 1738 v1->Reset(); |
1725 | 1739 |
1726 // Move to v1. | 1740 // Move to v1. |
1727 gfx::Point p5(21, 0); | 1741 gfx::Point p5(21, 0); |
1728 ui::MouseEvent move5(ui::ET_MOUSE_MOVED, p5, p5, ui::EventTimeForNow(), 0, 0); | 1742 ui::MouseEvent move5( |
| 1743 ui::ET_MOUSE_MOVED, p5, p5, ui::EventTimeForNow(), 0, 0, |
| 1744 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1729 root_view->OnMouseMoved(move5); | 1745 root_view->OnMouseMoved(move5); |
1730 EXPECT_TRUE(v21->received_mouse_exit_); | 1746 EXPECT_TRUE(v21->received_mouse_exit_); |
1731 EXPECT_TRUE(v1->received_mouse_enter_); | 1747 EXPECT_TRUE(v1->received_mouse_enter_); |
1732 | 1748 |
1733 v21->Reset(); | 1749 v21->Reset(); |
1734 v1->Reset(); | 1750 v1->Reset(); |
1735 | 1751 |
1736 // Now, move into v11. | 1752 // Now, move into v11. |
1737 gfx::Point p6(15, 15); | 1753 gfx::Point p6(15, 15); |
1738 ui::MouseEvent mouse6(ui::ET_MOUSE_MOVED, p6, p6, ui::EventTimeForNow(), 0, | 1754 ui::MouseEvent mouse6( |
1739 0); | 1755 ui::ET_MOUSE_MOVED, p6, p6, ui::EventTimeForNow(), 0, 0, |
| 1756 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1740 root_view->OnMouseMoved(mouse6); | 1757 root_view->OnMouseMoved(mouse6); |
1741 EXPECT_TRUE(v11->received_mouse_enter_); | 1758 EXPECT_TRUE(v11->received_mouse_enter_); |
1742 EXPECT_FALSE(v1->last_mouse_event_type_); | 1759 EXPECT_FALSE(v1->last_mouse_event_type_); |
1743 | 1760 |
1744 v11->Reset(); | 1761 v11->Reset(); |
1745 v1->Reset(); | 1762 v1->Reset(); |
1746 | 1763 |
1747 // Move back into v1. Although |v1| had already received an ENTER for mouse6, | 1764 // 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 | 1765 // and the mouse remains inside |v1| the whole time, it receives another ENTER |
1749 // when the mouse leaves v11. | 1766 // when the mouse leaves v11. |
1750 gfx::Point p7(21, 0); | 1767 gfx::Point p7(21, 0); |
1751 ui::MouseEvent mouse7(ui::ET_MOUSE_MOVED, p7, p7, ui::EventTimeForNow(), 0, | 1768 ui::MouseEvent mouse7( |
1752 0); | 1769 ui::ET_MOUSE_MOVED, p7, p7, ui::EventTimeForNow(), 0, 0, |
| 1770 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
1753 root_view->OnMouseMoved(mouse7); | 1771 root_view->OnMouseMoved(mouse7); |
1754 EXPECT_TRUE(v11->received_mouse_exit_); | 1772 EXPECT_TRUE(v11->received_mouse_exit_); |
1755 EXPECT_FALSE(v1->received_mouse_enter_); | 1773 EXPECT_FALSE(v1->received_mouse_enter_); |
1756 | 1774 |
1757 widget->CloseNow(); | 1775 widget->CloseNow(); |
1758 } | 1776 } |
1759 | 1777 |
1760 TEST_F(ViewTest, Textfield) { | 1778 TEST_F(ViewTest, Textfield) { |
1761 const base::string16 kText = ASCIIToUTF16( | 1779 const base::string16 kText = ASCIIToUTF16( |
1762 "Reality is that which, when you stop believing it, doesn't go away."); | 1780 "Reality is that which, when you stop believing it, doesn't go away."); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 gfx::Transform transform(v1->GetTransform()); | 2289 gfx::Transform transform(v1->GetTransform()); |
2272 RotateCounterclockwise(&transform); | 2290 RotateCounterclockwise(&transform); |
2273 transform.matrix().set(1, 3, 500.0); | 2291 transform.matrix().set(1, 3, 500.0); |
2274 v1->SetTransform(transform); | 2292 v1->SetTransform(transform); |
2275 | 2293 |
2276 // |v2| now occupies (100, 200) to (200, 400) in |root|. | 2294 // |v2| now occupies (100, 200) to (200, 400) in |root|. |
2277 v1->Reset(); | 2295 v1->Reset(); |
2278 v2->Reset(); | 2296 v2->Reset(); |
2279 | 2297 |
2280 gfx::Point p1(110, 210); | 2298 gfx::Point p1(110, 210); |
2281 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), | 2299 ui::MouseEvent pressed( |
2282 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2300 ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(), |
| 2301 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 2302 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
2283 root->OnMousePressed(pressed); | 2303 root->OnMousePressed(pressed); |
2284 EXPECT_EQ(0, v1->last_mouse_event_type_); | 2304 EXPECT_EQ(0, v1->last_mouse_event_type_); |
2285 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); | 2305 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); |
2286 EXPECT_EQ(190, v2->location_.x()); | 2306 EXPECT_EQ(190, v2->location_.x()); |
2287 EXPECT_EQ(10, v2->location_.y()); | 2307 EXPECT_EQ(10, v2->location_.y()); |
2288 | 2308 |
2289 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 2309 ui::MouseEvent released( |
2290 ui::EventTimeForNow(), 0, 0); | 2310 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 2311 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
2291 root->OnMouseReleased(released); | 2312 root->OnMouseReleased(released); |
2292 | 2313 |
2293 // Now rotate |v2| inside |v1| clockwise. | 2314 // Now rotate |v2| inside |v1| clockwise. |
2294 transform = v2->GetTransform(); | 2315 transform = v2->GetTransform(); |
2295 RotateClockwise(&transform); | 2316 RotateClockwise(&transform); |
2296 transform.matrix().set(0, 3, 100.f); | 2317 transform.matrix().set(0, 3, 100.f); |
2297 v2->SetTransform(transform); | 2318 v2->SetTransform(transform); |
2298 | 2319 |
2299 // Now, |v2| occupies (100, 100) to (200, 300) in |v1|, and (100, 300) to | 2320 // Now, |v2| occupies (100, 100) to (200, 300) in |v1|, and (100, 300) to |
2300 // (300, 400) in |root|. | 2321 // (300, 400) in |root|. |
2301 | 2322 |
2302 v1->Reset(); | 2323 v1->Reset(); |
2303 v2->Reset(); | 2324 v2->Reset(); |
2304 | 2325 |
2305 gfx::Point point2(110, 320); | 2326 gfx::Point point2(110, 320); |
2306 ui::MouseEvent p2(ui::ET_MOUSE_PRESSED, point2, point2, ui::EventTimeForNow(), | 2327 ui::MouseEvent p2( |
2307 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2328 ui::ET_MOUSE_PRESSED, point2, point2, ui::EventTimeForNow(), |
| 2329 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 2330 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
2308 root->OnMousePressed(p2); | 2331 root->OnMousePressed(p2); |
2309 EXPECT_EQ(0, v1->last_mouse_event_type_); | 2332 EXPECT_EQ(0, v1->last_mouse_event_type_); |
2310 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); | 2333 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); |
2311 EXPECT_EQ(10, v2->location_.x()); | 2334 EXPECT_EQ(10, v2->location_.x()); |
2312 EXPECT_EQ(20, v2->location_.y()); | 2335 EXPECT_EQ(20, v2->location_.y()); |
2313 | 2336 |
2314 root->OnMouseReleased(released); | 2337 root->OnMouseReleased(released); |
2315 | 2338 |
2316 v1->SetTransform(gfx::Transform()); | 2339 v1->SetTransform(gfx::Transform()); |
2317 v2->SetTransform(gfx::Transform()); | 2340 v2->SetTransform(gfx::Transform()); |
(...skipping 14 matching lines...) Expand all Loading... |
2332 transform.matrix().set(1, 1, 0.5f); | 2355 transform.matrix().set(1, 1, 0.5f); |
2333 v2->SetTransform(transform); | 2356 v2->SetTransform(transform); |
2334 | 2357 |
2335 // |v3| occupies (108, 105) to (132, 115) in |root|. | 2358 // |v3| occupies (108, 105) to (132, 115) in |root|. |
2336 | 2359 |
2337 v1->Reset(); | 2360 v1->Reset(); |
2338 v2->Reset(); | 2361 v2->Reset(); |
2339 v3->Reset(); | 2362 v3->Reset(); |
2340 | 2363 |
2341 gfx::Point point(112, 110); | 2364 gfx::Point point(112, 110); |
2342 ui::MouseEvent p3(ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), | 2365 ui::MouseEvent p3( |
2343 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2366 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
| 2367 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 2368 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
2344 root->OnMousePressed(p3); | 2369 root->OnMousePressed(p3); |
2345 | 2370 |
2346 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); | 2371 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); |
2347 EXPECT_EQ(10, v3->location_.x()); | 2372 EXPECT_EQ(10, v3->location_.x()); |
2348 EXPECT_EQ(25, v3->location_.y()); | 2373 EXPECT_EQ(25, v3->location_.y()); |
2349 | 2374 |
2350 root->OnMouseReleased(released); | 2375 root->OnMouseReleased(released); |
2351 | 2376 |
2352 v1->SetTransform(gfx::Transform()); | 2377 v1->SetTransform(gfx::Transform()); |
2353 v2->SetTransform(gfx::Transform()); | 2378 v2->SetTransform(gfx::Transform()); |
(...skipping 17 matching lines...) Expand all Loading... |
2371 | 2396 |
2372 // Translate |v2| with respect to |v1|. | 2397 // Translate |v2| with respect to |v1|. |
2373 transform = v2->GetTransform(); | 2398 transform = v2->GetTransform(); |
2374 transform.matrix().set(0, 3, 10.f); | 2399 transform.matrix().set(0, 3, 10.f); |
2375 transform.matrix().set(1, 3, 10.f); | 2400 transform.matrix().set(1, 3, 10.f); |
2376 v2->SetTransform(transform); | 2401 v2->SetTransform(transform); |
2377 | 2402 |
2378 // |v3| now occupies (120, 120) to (144, 130) in |root|. | 2403 // |v3| now occupies (120, 120) to (144, 130) in |root|. |
2379 | 2404 |
2380 gfx::Point point3(124, 125); | 2405 gfx::Point point3(124, 125); |
2381 ui::MouseEvent p4(ui::ET_MOUSE_PRESSED, point3, point3, ui::EventTimeForNow(), | 2406 ui::MouseEvent p4( |
2382 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 2407 ui::ET_MOUSE_PRESSED, point3, point3, ui::EventTimeForNow(), |
| 2408 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 2409 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
2383 root->OnMousePressed(p4); | 2410 root->OnMousePressed(p4); |
2384 | 2411 |
2385 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); | 2412 EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); |
2386 EXPECT_EQ(10, v3->location_.x()); | 2413 EXPECT_EQ(10, v3->location_.x()); |
2387 EXPECT_EQ(25, v3->location_.y()); | 2414 EXPECT_EQ(25, v3->location_.y()); |
2388 | 2415 |
2389 root->OnMouseReleased(released); | 2416 root->OnMouseReleased(released); |
2390 | 2417 |
2391 widget->CloseNow(); | 2418 widget->CloseNow(); |
2392 } | 2419 } |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4093 // notification. | 4120 // notification. |
4094 TestView* test_view_child_2 = new TestView(); | 4121 TestView* test_view_child_2 = new TestView(); |
4095 test_view->AddChildView(test_view_child_2); | 4122 test_view->AddChildView(test_view_child_2); |
4096 EXPECT_TRUE(test_view_child_2->native_theme_); | 4123 EXPECT_TRUE(test_view_child_2->native_theme_); |
4097 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_); | 4124 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_); |
4098 | 4125 |
4099 widget->CloseNow(); | 4126 widget->CloseNow(); |
4100 } | 4127 } |
4101 | 4128 |
4102 } // namespace views | 4129 } // namespace views |
OLD | NEW |