Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp

Issue 1911973002: Fix scrollbar buttons at hidpi when enable-use-zoom-for-dsf is on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor edits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/scroll/ScrollbarThemeAura.h"
6
7 #include "platform/scroll/ScrollbarTestSuite.h"
8
9 namespace blink {
10
11 using testing::Return;
12
13 class ScrollbarThemeAuraTest : public ScrollbarTestSuite {
14 protected:
15 void setMockScrollableAreaExpectations(MockScrollableArea* mock)
16 {
17 EXPECT_CALL(*mock, layerForHorizontalScrollbar())
jbroman 2016/05/11 21:24:08 Is it important for these tests that this be a non
Bret 2016/05/12 00:18:12 Hmm, okay I deleted this block. I added it origina
18 .WillRepeatedly(Return(nullptr));
19 EXPECT_CALL(*mock, layerForVerticalScrollbar())
20 .WillRepeatedly(Return(nullptr));
21 }
22 };
23
24 TEST_F(ScrollbarThemeAuraTest, ButtonSizeHorizontal)
25 {
26 MockScrollableArea* mockScrollableArea = MockScrollableArea::create();
27 setMockScrollableAreaExpectations(mockScrollableArea);
28 ScrollbarThemeMock mockTheme;
29 Scrollbar* scrollbar = Scrollbar::createForTesting(
30 mockScrollableArea, HorizontalScrollbar, RegularScrollbar, &mockTheme);
31 ScrollbarThemeAura theme;
32
33 IntRect scrollbarSizeNormalDimensions(11, 22, 444, 66);
34 scrollbar->setFrameRect(scrollbarSizeNormalDimensions);
35 IntSize size1 = theme.buttonSize(*scrollbar);
36 EXPECT_EQ(66, size1.width());
37 EXPECT_EQ(66, size1.height());
38
39 IntRect scrollbarSizeSquashedDimensions(11, 22, 444, 666);
40 scrollbar->setFrameRect(scrollbarSizeSquashedDimensions);
41 IntSize size2 = theme.buttonSize(*scrollbar);
42 EXPECT_EQ(222, size2.width());
43 EXPECT_EQ(666, size2.height());
44
45 ThreadHeap::collectAllGarbage();
46 }
47
48 TEST_F(ScrollbarThemeAuraTest, ButtonSizeVertical)
49 {
50 MockScrollableArea* mockScrollableArea = MockScrollableArea::create();
51 setMockScrollableAreaExpectations(mockScrollableArea);
52 ScrollbarThemeMock mockTheme;
53 Scrollbar* scrollbar = Scrollbar::createForTesting(
54 mockScrollableArea, VerticalScrollbar, RegularScrollbar, &mockTheme);
55 ScrollbarThemeAura theme;
56
57 IntRect scrollbarSizeNormalDimensions(11, 22, 44, 666);
58 scrollbar->setFrameRect(scrollbarSizeNormalDimensions);
59 IntSize size1 = theme.buttonSize(*scrollbar);
60 EXPECT_EQ(44, size1.width());
61 EXPECT_EQ(44, size1.height());
62
63 IntRect scrollbarSizeSquashedDimensions(11, 22, 444, 666);
64 scrollbar->setFrameRect(scrollbarSizeSquashedDimensions);
65 IntSize size2 = theme.buttonSize(*scrollbar);
66 EXPECT_EQ(444, size2.width());
67 EXPECT_EQ(333, size2.height());
68
69 ThreadHeap::collectAllGarbage();
70 }
71
72 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698