OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
6 #import "testing/gtest_mac.h" | 6 #import "testing/gtest_mac.h" |
7 #include "ui/app_list/app_list_item_model.h" | 7 #include "ui/app_list/app_list_item_model.h" |
8 #import "ui/app_list/cocoa/apps_collection_view_drag_manager.h" | 8 #import "ui/app_list/cocoa/apps_collection_view_drag_manager.h" |
9 #import "ui/app_list/cocoa/apps_grid_controller.h" | 9 #import "ui/app_list/cocoa/apps_grid_controller.h" |
10 #import "ui/app_list/cocoa/apps_grid_view_item.h" | 10 #import "ui/app_list/cocoa/apps_grid_view_item.h" |
11 #import "ui/app_list/cocoa/apps_pagination_model_observer.h" | 11 #import "ui/app_list/cocoa/apps_pagination_model_observer.h" |
12 #import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h" | 12 #import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h" |
13 #include "ui/app_list/test/app_list_test_model.h" | 13 #include "ui/app_list/test/app_list_test_model.h" |
14 #include "ui/app_list/test/app_list_test_view_delegate.h" | 14 #include "ui/app_list/test/app_list_test_view_delegate.h" |
15 #import "ui/base/test/cocoa_test_event_utils.h" | 15 #import "ui/base/test/cocoa_test_event_utils.h" |
16 | 16 |
17 @interface TestPaginationObserver : NSObject<AppsPaginationModelObserver> { | 17 @interface TestPaginationObserver : NSObject<AppsPaginationModelObserver> { |
18 @private | 18 @private |
| 19 NSInteger hoveredSegmentForTest_; |
19 int totalPagesChangedCount_; | 20 int totalPagesChangedCount_; |
20 int selectedPageChangedCount_; | 21 int selectedPageChangedCount_; |
21 int lastNewSelectedPage_; | 22 int lastNewSelectedPage_; |
22 bool visibilityDidChange_; | 23 bool visibilityDidChange_; |
23 } | 24 } |
24 | 25 |
| 26 @property(assign, nonatomic) NSInteger hoveredSegmentForTest; |
25 @property(assign, nonatomic) int totalPagesChangedCount; | 27 @property(assign, nonatomic) int totalPagesChangedCount; |
26 @property(assign, nonatomic) int selectedPageChangedCount; | 28 @property(assign, nonatomic) int selectedPageChangedCount; |
27 @property(assign, nonatomic) int lastNewSelectedPage; | 29 @property(assign, nonatomic) int lastNewSelectedPage; |
28 | 30 |
29 - (bool)readVisibilityDidChange; | 31 - (bool)readVisibilityDidChange; |
30 | 32 |
31 @end | 33 @end |
32 | 34 |
33 @implementation TestPaginationObserver | 35 @implementation TestPaginationObserver |
34 | 36 |
| 37 @synthesize hoveredSegmentForTest = hoveredSegmentForTest_; |
35 @synthesize totalPagesChangedCount = totalPagesChangedCount_; | 38 @synthesize totalPagesChangedCount = totalPagesChangedCount_; |
36 @synthesize selectedPageChangedCount = selectedPageChangedCount_; | 39 @synthesize selectedPageChangedCount = selectedPageChangedCount_; |
37 @synthesize lastNewSelectedPage = lastNewSelectedPage_; | 40 @synthesize lastNewSelectedPage = lastNewSelectedPage_; |
38 | 41 |
| 42 - (id)init { |
| 43 if ((self = [super init])) |
| 44 hoveredSegmentForTest_ = -1; |
| 45 |
| 46 return self; |
| 47 } |
| 48 |
39 - (bool)readVisibilityDidChange { | 49 - (bool)readVisibilityDidChange { |
40 bool truth = visibilityDidChange_; | 50 bool truth = visibilityDidChange_; |
41 visibilityDidChange_ = false; | 51 visibilityDidChange_ = false; |
42 return truth; | 52 return truth; |
43 } | 53 } |
44 | 54 |
45 - (void)totalPagesChanged { | 55 - (void)totalPagesChanged { |
46 ++totalPagesChangedCount_; | 56 ++totalPagesChangedCount_; |
47 } | 57 } |
48 | 58 |
49 - (void)selectedPageChanged:(int)newSelected { | 59 - (void)selectedPageChanged:(int)newSelected { |
50 ++selectedPageChangedCount_; | 60 ++selectedPageChangedCount_; |
51 lastNewSelectedPage_ = newSelected; | 61 lastNewSelectedPage_ = newSelected; |
52 } | 62 } |
53 | 63 |
54 - (void)pageVisibilityChanged { | 64 - (void)pageVisibilityChanged { |
55 visibilityDidChange_ = true; | 65 visibilityDidChange_ = true; |
56 } | 66 } |
57 | 67 |
| 68 - (NSInteger)pagerSegmentAtLocation:(NSPoint)locationInWindow { |
| 69 return hoveredSegmentForTest_; |
| 70 } |
| 71 |
58 @end | 72 @end |
59 | 73 |
60 namespace app_list { | 74 namespace app_list { |
61 namespace test { | 75 namespace test { |
62 | 76 |
63 namespace { | 77 namespace { |
64 | 78 |
65 class AppsGridControllerTest : public AppsGridControllerTestHelper { | 79 class AppsGridControllerTest : public AppsGridControllerTestHelper { |
66 public: | 80 public: |
67 AppsGridControllerTest() {} | 81 AppsGridControllerTest() {} |
(...skipping 13 matching lines...) Expand all Loading... |
81 owned_apps_grid_controller_.reset(); | 95 owned_apps_grid_controller_.reset(); |
82 AppsGridControllerTestHelper::TearDown(); | 96 AppsGridControllerTestHelper::TearDown(); |
83 } | 97 } |
84 | 98 |
85 private: | 99 private: |
86 scoped_nsobject<AppsGridController> owned_apps_grid_controller_; | 100 scoped_nsobject<AppsGridController> owned_apps_grid_controller_; |
87 | 101 |
88 DISALLOW_COPY_AND_ASSIGN(AppsGridControllerTest); | 102 DISALLOW_COPY_AND_ASSIGN(AppsGridControllerTest); |
89 }; | 103 }; |
90 | 104 |
| 105 // Generate a mouse event at the centre of the view in |page| with the given |
| 106 // |index_in_page| that can be used to initiate, update and complete drag |
| 107 // operations. |
| 108 NSEvent* MouseEventInCell(NSCollectionView* page, size_t index_in_page) { |
| 109 NSRect cell_rect = [page frameForItemAtIndex:index_in_page]; |
| 110 NSPoint point_in_view = NSMakePoint(NSMidX(cell_rect), NSMidY(cell_rect)); |
| 111 NSPoint point_in_window = [page convertPoint:point_in_view |
| 112 toView:nil]; |
| 113 return cocoa_test_event_utils::LeftMouseDownAtPoint(point_in_window); |
| 114 } |
| 115 |
| 116 NSEvent* MouseEventForScroll(NSView* view, CGFloat relative_x) { |
| 117 NSRect view_rect = [view frame]; |
| 118 NSPoint point_in_view = NSMakePoint(NSMidX(view_rect), NSMidY(view_rect)); |
| 119 point_in_view.x += point_in_view.x * relative_x; |
| 120 NSPoint point_in_window = [view convertPoint:point_in_view |
| 121 toView:nil]; |
| 122 return cocoa_test_event_utils::LeftMouseDownAtPoint(point_in_window); |
| 123 } |
| 124 |
91 } // namespace | 125 } // namespace |
92 | 126 |
93 TEST_VIEW(AppsGridControllerTest, [apps_grid_controller_ view]); | 127 TEST_VIEW(AppsGridControllerTest, [apps_grid_controller_ view]); |
94 | 128 |
95 // Test showing with an empty model. | 129 // Test showing with an empty model. |
96 TEST_F(AppsGridControllerTest, EmptyModelAndShow) { | 130 TEST_F(AppsGridControllerTest, EmptyModelAndShow) { |
97 EXPECT_TRUE([[apps_grid_controller_ view] superview]); | 131 EXPECT_TRUE([[apps_grid_controller_ view] superview]); |
98 | 132 |
99 // First page should always exist, even if empty. | 133 // First page should always exist, even if empty. |
100 EXPECT_EQ(1u, [apps_grid_controller_ pageCount]); | 134 EXPECT_EQ(1u, [apps_grid_controller_ pageCount]); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 SimulateKeyAction(@selector(moveRight:)); | 253 SimulateKeyAction(@selector(moveRight:)); |
220 SimulateKeyAction(@selector(moveRight:)); | 254 SimulateKeyAction(@selector(moveRight:)); |
221 EXPECT_EQ(2u, [apps_grid_controller_ selectedItemIndex]); | 255 EXPECT_EQ(2u, [apps_grid_controller_ selectedItemIndex]); |
222 SimulateKeyAction(@selector(insertNewline:)); | 256 SimulateKeyAction(@selector(insertNewline:)); |
223 EXPECT_EQ(1, delegate()->activate_count()); | 257 EXPECT_EQ(1, delegate()->activate_count()); |
224 EXPECT_EQ(std::string("Item 2"), delegate()->last_activated()->title()); | 258 EXPECT_EQ(std::string("Item 2"), delegate()->last_activated()->title()); |
225 } | 259 } |
226 | 260 |
227 // Tests keyboard navigation across pages. | 261 // Tests keyboard navigation across pages. |
228 TEST_F(AppsGridControllerTest, CrossPageKeyboardNavigation) { | 262 TEST_F(AppsGridControllerTest, CrossPageKeyboardNavigation) { |
229 [AppsGridController setScrollAnimationDuration:0.0]; | |
230 | |
231 model()->PopulateApps(2 * kItemsPerPage); | 263 model()->PopulateApps(2 * kItemsPerPage); |
232 EXPECT_EQ(kItemsPerPage, [[GetPageAt(0) content] count]); | 264 EXPECT_EQ(kItemsPerPage, [[GetPageAt(0) content] count]); |
233 EXPECT_EQ(kItemsPerPage, [[GetPageAt(1) content] count]); | 265 EXPECT_EQ(kItemsPerPage, [[GetPageAt(1) content] count]); |
234 | 266 |
235 // Moving Left, Up, or PageUp from the top-left corner of the first page does | 267 // Moving Left, Up, or PageUp from the top-left corner of the first page does |
236 // nothing. | 268 // nothing. |
237 [apps_grid_controller_ selectItemAtIndex:0]; | 269 [apps_grid_controller_ selectItemAtIndex:0]; |
238 SimulateKeyAction(@selector(moveLeft:)); | 270 SimulateKeyAction(@selector(moveLeft:)); |
239 EXPECT_EQ(0u, [apps_grid_controller_ selectedItemIndex]); | 271 EXPECT_EQ(0u, [apps_grid_controller_ selectedItemIndex]); |
240 SimulateKeyAction(@selector(moveUp:)); | 272 SimulateKeyAction(@selector(moveUp:)); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 EXPECT_EQ(4u, [apps_grid_controller_ pageCount]); | 485 EXPECT_EQ(4u, [apps_grid_controller_ pageCount]); |
454 | 486 |
455 EXPECT_FALSE([observer readVisibilityDidChange]); | 487 EXPECT_FALSE([observer readVisibilityDidChange]); |
456 EXPECT_EQ(0, [observer selectedPageChangedCount]); | 488 EXPECT_EQ(0, [observer selectedPageChangedCount]); |
457 | 489 |
458 [apps_grid_controller_ setPaginationObserver:nil]; | 490 [apps_grid_controller_ setPaginationObserver:nil]; |
459 } | 491 } |
460 | 492 |
461 // Test AppsGridPaginationObserver selectedPageChanged(). | 493 // Test AppsGridPaginationObserver selectedPageChanged(). |
462 TEST_F(AppsGridControllerTest, PaginationObserverSelectedPageChanged) { | 494 TEST_F(AppsGridControllerTest, PaginationObserverSelectedPageChanged) { |
463 [AppsGridController setScrollAnimationDuration:0.0]; | |
464 scoped_nsobject<TestPaginationObserver> observer( | 495 scoped_nsobject<TestPaginationObserver> observer( |
465 [[TestPaginationObserver alloc] init]); | 496 [[TestPaginationObserver alloc] init]); |
466 [apps_grid_controller_ setPaginationObserver:observer]; | 497 [apps_grid_controller_ setPaginationObserver:observer]; |
467 EXPECT_EQ(0, [[NSAnimationContext currentContext] duration]); | 498 EXPECT_EQ(0, [[NSAnimationContext currentContext] duration]); |
468 | 499 |
469 ReplaceTestModel(kItemsPerPage * 3 + 1); | 500 ReplaceTestModel(kItemsPerPage * 3 + 1); |
470 EXPECT_EQ(1, [observer totalPagesChangedCount]); | 501 EXPECT_EQ(1, [observer totalPagesChangedCount]); |
471 EXPECT_EQ(4u, [apps_grid_controller_ pageCount]); | 502 EXPECT_EQ(4u, [apps_grid_controller_ pageCount]); |
472 | 503 |
473 EXPECT_FALSE([observer readVisibilityDidChange]); | 504 EXPECT_FALSE([observer readVisibilityDidChange]); |
(...skipping 22 matching lines...) Expand all Loading... |
496 // view updates and sends out NSViewBoundsDidChangeNotification. | 527 // view updates and sends out NSViewBoundsDidChangeNotification. |
497 EXPECT_EQ(3, [observer selectedPageChangedCount]); | 528 EXPECT_EQ(3, [observer selectedPageChangedCount]); |
498 EXPECT_EQ(3, [observer lastNewSelectedPage]); | 529 EXPECT_EQ(3, [observer lastNewSelectedPage]); |
499 EXPECT_TRUE([observer readVisibilityDidChange]); | 530 EXPECT_TRUE([observer readVisibilityDidChange]); |
500 EXPECT_EQ(0.0, [apps_grid_controller_ visiblePortionOfPage:0]); | 531 EXPECT_EQ(0.0, [apps_grid_controller_ visiblePortionOfPage:0]); |
501 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:3]); | 532 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:3]); |
502 | 533 |
503 [apps_grid_controller_ setPaginationObserver:nil]; | 534 [apps_grid_controller_ setPaginationObserver:nil]; |
504 } | 535 } |
505 | 536 |
506 namespace { | |
507 | |
508 // Generate a mouse event at the centre of the view in |page| with the given | |
509 // |index_in_page| that can be used to initiate, update and complete drag | |
510 // operations. | |
511 NSEvent* MouseEventInCell(NSCollectionView* page, size_t index_in_page) { | |
512 NSRect cell_rect = [page frameForItemAtIndex:index_in_page]; | |
513 NSPoint point_in_view = NSMakePoint(NSMidX(cell_rect), NSMidY(cell_rect)); | |
514 NSPoint point_in_window = [page convertPoint:point_in_view | |
515 toView:nil]; | |
516 return cocoa_test_event_utils::LeftMouseDownAtPoint(point_in_window); | |
517 } | |
518 | |
519 } // namespace | |
520 | |
521 // Test basic item moves with two items; swapping them around, dragging outside | 537 // Test basic item moves with two items; swapping them around, dragging outside |
522 // of the view bounds, and dragging on the background. | 538 // of the view bounds, and dragging on the background. |
523 TEST_F(AppsGridControllerTest, DragAndDropSimple) { | 539 TEST_F(AppsGridControllerTest, DragAndDropSimple) { |
524 model()->PopulateApps(2); | 540 model()->PopulateApps(2); |
525 NSCollectionView* page = [apps_grid_controller_ collectionViewAtPageIndex:0]; | 541 NSCollectionView* page = [apps_grid_controller_ collectionViewAtPageIndex:0]; |
526 NSEvent* mouse_at_cell_0 = MouseEventInCell(page, 0); | 542 NSEvent* mouse_at_cell_0 = MouseEventInCell(page, 0); |
527 NSEvent* mouse_at_cell_1 = MouseEventInCell(page, 1); | 543 NSEvent* mouse_at_cell_1 = MouseEventInCell(page, 1); |
528 NSEvent* mouse_at_page_centre = MouseEventInCell(page, 6); | 544 NSEvent* mouse_at_page_centre = MouseEventInCell(page, 6); |
529 NSEvent* mouse_off_page = MouseEventInCell(page, kItemsPerPage * 2); | 545 NSEvent* mouse_off_page = MouseEventInCell(page, kItemsPerPage * 2); |
530 | 546 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 [drag_manager onMouseDownInPage:page | 634 [drag_manager onMouseDownInPage:page |
619 withEvent:mouse_at_cell_0]; | 635 withEvent:mouse_at_cell_0]; |
620 [drag_manager onMouseDragged:mouse_at_cell_1]; | 636 [drag_manager onMouseDragged:mouse_at_cell_1]; |
621 [drag_manager onMouseUp:mouse_at_cell_1]; | 637 [drag_manager onMouseUp:mouse_at_cell_1]; |
622 EXPECT_EQ(std::string(), model()->GetModelContent()); | 638 EXPECT_EQ(std::string(), model()->GetModelContent()); |
623 EXPECT_EQ(std::string("||"), GetViewContent()); | 639 EXPECT_EQ(std::string("||"), GetViewContent()); |
624 } | 640 } |
625 | 641 |
626 // Test item moves between pages. | 642 // Test item moves between pages. |
627 TEST_F(AppsGridControllerTest, DragAndDropMultiPage) { | 643 TEST_F(AppsGridControllerTest, DragAndDropMultiPage) { |
628 [AppsGridController setScrollAnimationDuration:0.0]; | |
629 const size_t kPagesToTest = 3; | 644 const size_t kPagesToTest = 3; |
630 // Put one item on the last page to hit more edge cases. | 645 // Put one item on the last page to hit more edge cases. |
631 ReplaceTestModel(kItemsPerPage * (kPagesToTest - 1) + 1); | 646 ReplaceTestModel(kItemsPerPage * (kPagesToTest - 1) + 1); |
632 NSCollectionView* page[kPagesToTest]; | 647 NSCollectionView* page[kPagesToTest]; |
633 for (size_t i = 0; i < kPagesToTest; ++i) | 648 for (size_t i = 0; i < kPagesToTest; ++i) |
634 page[i] = [apps_grid_controller_ collectionViewAtPageIndex:i]; | 649 page[i] = [apps_grid_controller_ collectionViewAtPageIndex:i]; |
635 | 650 |
636 const std::string kSecondItemMovedToSecondPage = | 651 const std::string kSecondItemMovedToSecondPage = |
637 "|Item 0,Item 2,Item 3,Item 4,Item 5,Item 6,Item 7,Item 8," | 652 "|Item 0,Item 2,Item 3,Item 4,Item 5,Item 6,Item 7,Item 8," |
638 "Item 9,Item 10,Item 11,Item 12,Item 13,Item 14,Item 15,Item 16|" | 653 "Item 9,Item 10,Item 11,Item 12,Item 13,Item 14,Item 15,Item 16|" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 EXPECT_EQ(2u, GetPageIndexForItem(33)); | 704 EXPECT_EQ(2u, GetPageIndexForItem(33)); |
690 | 705 |
691 // Scroll to end again, and keep dragging (should be ignored). | 706 // Scroll to end again, and keep dragging (should be ignored). |
692 [apps_grid_controller_ scrollToPage:2]; | 707 [apps_grid_controller_ scrollToPage:2]; |
693 [drag_manager onMouseDragged:mouse_at_cell_0]; | 708 [drag_manager onMouseDragged:mouse_at_cell_0]; |
694 EXPECT_EQ(0u, GetPageIndexForItem(1)); | 709 EXPECT_EQ(0u, GetPageIndexForItem(1)); |
695 [drag_manager onMouseUp:mouse_at_cell_0]; | 710 [drag_manager onMouseUp:mouse_at_cell_0]; |
696 EXPECT_EQ(0u, GetPageIndexForItem(1)); | 711 EXPECT_EQ(0u, GetPageIndexForItem(1)); |
697 } | 712 } |
698 | 713 |
| 714 // Test scrolling when dragging past edge or over the pager. |
| 715 TEST_F(AppsGridControllerTest, ScrollingWhileDragging) { |
| 716 scoped_nsobject<TestPaginationObserver> observer( |
| 717 [[TestPaginationObserver alloc] init]); |
| 718 [apps_grid_controller_ setPaginationObserver:observer]; |
| 719 |
| 720 ReplaceTestModel(kItemsPerPage * 3); |
| 721 // Start on the middle page. |
| 722 [apps_grid_controller_ scrollToPage:1]; |
| 723 NSCollectionView* page = [apps_grid_controller_ collectionViewAtPageIndex:1]; |
| 724 NSEvent* mouse_at_cell_0 = MouseEventInCell(page, 0); |
| 725 |
| 726 NSEvent* at_center = MouseEventForScroll([apps_grid_controller_ view], 0.0); |
| 727 NSEvent* at_left = MouseEventForScroll([apps_grid_controller_ view], -1.1); |
| 728 NSEvent* at_right = MouseEventForScroll([apps_grid_controller_ view], 1.1); |
| 729 |
| 730 AppsCollectionViewDragManager* drag_manager = |
| 731 [apps_grid_controller_ dragManager]; |
| 732 [drag_manager onMouseDownInPage:page |
| 733 withEvent:mouse_at_cell_0]; |
| 734 [drag_manager onMouseDragged:at_center]; |
| 735 |
| 736 // Nothing should be scheduled: target page is visible page. |
| 737 EXPECT_EQ(1u, [apps_grid_controller_ visiblePage]); |
| 738 EXPECT_EQ(1u, [apps_grid_controller_ scheduledScrollPage]); |
| 739 |
| 740 // Drag to the left, should go to first page and no further. |
| 741 [drag_manager onMouseDragged:at_left]; |
| 742 EXPECT_EQ(1u, [apps_grid_controller_ visiblePage]); |
| 743 EXPECT_EQ(0u, [apps_grid_controller_ scheduledScrollPage]); |
| 744 [apps_grid_controller_ scrollToPage:0]; // Commit without timer for testing. |
| 745 [drag_manager onMouseDragged:at_left]; |
| 746 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); |
| 747 EXPECT_EQ(0u, [apps_grid_controller_ scheduledScrollPage]); |
| 748 |
| 749 // Drag to the right, should go to last page and no futher. |
| 750 [drag_manager onMouseDragged:at_right]; |
| 751 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); |
| 752 EXPECT_EQ(1u, [apps_grid_controller_ scheduledScrollPage]); |
| 753 [apps_grid_controller_ scrollToPage:1]; |
| 754 [drag_manager onMouseDragged:at_right]; |
| 755 EXPECT_EQ(1u, [apps_grid_controller_ visiblePage]); |
| 756 EXPECT_EQ(2u, [apps_grid_controller_ scheduledScrollPage]); |
| 757 [apps_grid_controller_ scrollToPage:2]; |
| 758 [drag_manager onMouseDragged:at_right]; |
| 759 EXPECT_EQ(2u, [apps_grid_controller_ visiblePage]); |
| 760 EXPECT_EQ(2u, [apps_grid_controller_ scheduledScrollPage]); |
| 761 |
| 762 // Simulate a hover over the first pager segment. |
| 763 [observer setHoveredSegmentForTest:0]; |
| 764 [drag_manager onMouseDragged:at_center]; |
| 765 EXPECT_EQ(2u, [apps_grid_controller_ visiblePage]); |
| 766 EXPECT_EQ(0u, [apps_grid_controller_ scheduledScrollPage]); |
| 767 |
| 768 // Drag it back, should cancel schedule. |
| 769 [observer setHoveredSegmentForTest:-1]; |
| 770 [drag_manager onMouseDragged:at_center]; |
| 771 EXPECT_EQ(2u, [apps_grid_controller_ visiblePage]); |
| 772 EXPECT_EQ(2u, [apps_grid_controller_ scheduledScrollPage]); |
| 773 |
| 774 // Hover again, now over middle segment, and ensure a release also cancels. |
| 775 [observer setHoveredSegmentForTest:1]; |
| 776 [drag_manager onMouseDragged:at_center]; |
| 777 EXPECT_EQ(2u, [apps_grid_controller_ visiblePage]); |
| 778 EXPECT_EQ(1u, [apps_grid_controller_ scheduledScrollPage]); |
| 779 [drag_manager onMouseUp:at_center]; |
| 780 EXPECT_EQ(2u, [apps_grid_controller_ visiblePage]); |
| 781 EXPECT_EQ(2u, [apps_grid_controller_ scheduledScrollPage]); |
| 782 |
| 783 [apps_grid_controller_ setPaginationObserver:nil]; |
| 784 } |
| 785 |
699 } // namespace test | 786 } // namespace test |
700 } // namespace app_list | 787 } // namespace app_list |
OLD | NEW |