Index: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp |
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp |
index 13487d835d657377cc8cd2af7d229436487fdd1a..ac80728789b86a04cf08729f922f21849d81794a 100644 |
--- a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp |
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp |
@@ -5,6 +5,8 @@ |
#include "config.h" |
#include "platform/scroll/ScrollableArea.h" |
+#include "platform/scroll/ScrollbarTheme.h" |
+#include "platform/scroll/ScrollbarThemeMock.h" |
#include "platform/testing/TestingPlatformSupport.h" |
#include "public/platform/Platform.h" |
#include "public/platform/WebScheduler.h" |
@@ -127,4 +129,36 @@ TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) |
EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); |
} |
+TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint) |
chrishtr
2015/11/24 21:15:12
This doesn't test the mac code...
ccameron
2015/11/25 00:23:02
You're referring to ScrollAnimatorMac? I put quite
|
+{ |
+ ScrollbarTheme::setMockScrollbarsEnabled(true); |
+ ScrollbarThemeMock::setShouldRepaintAllPartsOnInvalidation(true); |
+ |
+ OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(IntPoint(0, 100)); |
+ RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.get(), HorizontalScrollbar, RegularScrollbar); |
+ |
+ EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint()); |
+ EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); |
+ scrollbar->setNeedsPaintInvalidation(); |
+ EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint()); |
+ EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); |
+ |
+ scrollbar->setTrackBackgroundNeedsRepaint(false); |
+ scrollbar->setThumbNeedsRepaint(false); |
+ EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint()); |
+ EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); |
+ scrollbar->setNeedsPaintInvalidation(); |
+ EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint()); |
+ EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); |
+ |
+ ScrollbarThemeMock::setShouldRepaintAllPartsOnInvalidation(false); |
+ scrollbar->setTrackBackgroundNeedsRepaint(false); |
+ scrollbar->setThumbNeedsRepaint(false); |
+ EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint()); |
+ EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); |
+ scrollbar->setNeedsPaintInvalidation(); |
+ EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint()); |
+ EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); |
+} |
+ |
} // namespace blink |