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/views/controls/scroll_view.h" | 5 #include "ui/views/controls/scroll_view.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/views/border.h" | 9 #include "ui/views/border.h" |
10 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h" | 10 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 contents->SetBounds(0, 0, 200, 200); | 469 contents->SetBounds(0, 0, 200, 200); |
470 scroll_view.Layout(); | 470 scroll_view.Layout(); |
471 EXPECT_EQ(&scroll_view, corner_view->parent()); | 471 EXPECT_EQ(&scroll_view, corner_view->parent()); |
472 EXPECT_TRUE(corner_view->visible()); | 472 EXPECT_TRUE(corner_view->visible()); |
473 } | 473 } |
474 | 474 |
475 #if defined(OS_MACOSX) | 475 #if defined(OS_MACOSX) |
476 // Tests the overlay scrollbars on Mac. Ensure that they show up properly and | 476 // Tests the overlay scrollbars on Mac. Ensure that they show up properly and |
477 // do not overlap each other. | 477 // do not overlap each other. |
478 TEST(ScrollViewTest, CocoaOverlayScrollBars) { | 478 TEST(ScrollViewTest, CocoaOverlayScrollBars) { |
479 scoped_ptr<ui::test::ScopedPreferredScrollerStyle> scroller_style_override; | 479 std::unique_ptr<ui::test::ScopedPreferredScrollerStyle> |
| 480 scroller_style_override; |
480 scroller_style_override.reset( | 481 scroller_style_override.reset( |
481 new ui::test::ScopedPreferredScrollerStyle(true)); | 482 new ui::test::ScopedPreferredScrollerStyle(true)); |
482 ScrollView scroll_view; | 483 ScrollView scroll_view; |
483 View* contents = new View; | 484 View* contents = new View; |
484 scroll_view.SetContents(contents); | 485 scroll_view.SetContents(contents); |
485 scroll_view.SetBoundsRect(gfx::Rect(0, 0, 100, 100)); | 486 scroll_view.SetBoundsRect(gfx::Rect(0, 0, 100, 100)); |
486 | 487 |
487 // Size the contents such that vertical scrollbar is needed. | 488 // Size the contents such that vertical scrollbar is needed. |
488 // Since it is overlaid, the ViewPort size should match the ScrollView. | 489 // Since it is overlaid, the ViewPort size should match the ScrollView. |
489 contents->SetBounds(0, 0, 50, 400); | 490 contents->SetBounds(0, 0, 50, 400); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 new ui::test::ScopedPreferredScrollerStyle(false)); | 526 new ui::test::ScopedPreferredScrollerStyle(false)); |
526 EXPECT_EQ(100 - scroll_view.GetScrollBarWidth(), contents->parent()->width()); | 527 EXPECT_EQ(100 - scroll_view.GetScrollBarWidth(), contents->parent()->width()); |
527 EXPECT_EQ(100 - scroll_view.GetScrollBarHeight(), | 528 EXPECT_EQ(100 - scroll_view.GetScrollBarHeight(), |
528 contents->parent()->height()); | 529 contents->parent()->height()); |
529 EXPECT_NE(0, scroll_view.GetScrollBarWidth()); | 530 EXPECT_NE(0, scroll_view.GetScrollBarWidth()); |
530 EXPECT_NE(0, scroll_view.GetScrollBarHeight()); | 531 EXPECT_NE(0, scroll_view.GetScrollBarHeight()); |
531 } | 532 } |
532 #endif | 533 #endif |
533 | 534 |
534 } // namespace views | 535 } // namespace views |
OLD | NEW |