diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-20 14:01:09 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-20 14:01:09 +0200 |
| commit | 6dbcd09121fe266c7704a524b5cbd7f2754659c0 (patch) | |
| tree | 5ae0d16cec0cc61f576d51c57b3a4613c7e91e22 /Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp | |
| parent | 6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (diff) | |
| download | qtwebkit-6dbcd09121fe266c7704a524b5cbd7f2754659c0.tar.gz | |
Imported WebKit commit 080af0beaa6f0ba8ff8f44cb8bd8b5dcf75ac0af (http://svn.webkit.org/repository/webkit/trunk@129119)
New snapshot with prospective build fix for incorrect QtWebKit master module header file creation
Diffstat (limited to 'Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp')
| -rw-r--r-- | Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp b/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp index 38b0c9885..0cf82494b 100644 --- a/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp +++ b/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp @@ -29,6 +29,7 @@ #include "Color.h" #include "GraphicsContext.h" #include "IntRect.h" +#include "PlatformContextSkia.h" #include "skia/ext/platform_canvas.h" #include <public/WebFloatRect.h> #include <public/WebRect.h> @@ -100,6 +101,22 @@ struct PaintFillPartialOpaque : public PaintCallback { IntRect m_opaqueRect; }; +#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR) +struct HintingScaleCallback : public PaintCallback { + HintingScaleCallback() + : hintingScale(SK_Scalar1) + { + } + + virtual void operator()(GraphicsContext& context, const IntRect& contentRect) + { + hintingScale = context.platformContext()->hintingScaleFactor(); + } + + SkScalar hintingScale; +}; +#endif + #define EXPECT_EQ_RECT(a, b) \ EXPECT_EQ(a.x, b.x); \ EXPECT_EQ(a.width, b.width); \ @@ -194,4 +211,23 @@ TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testPartialOpaqueRectTranslat EXPECT_EQ_RECT(WebFloatRect(partialRect.x(), partialRect.y(), partialRect.width(), partialRect.height()), opaqueRect); } +#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR) +TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testHintingScaleFactorSet) +{ + HintingScaleCallback callback; + TestLayerPainterChromium painter(callback); + OpaqueRectTrackingContentLayerDelegate delegate(&painter); + + SkScalar hintingScale = SkIntToScalar(2); + SkCanvas canvas; + canvas.scale(hintingScale, hintingScale); + EXPECT_EQ(callback.hintingScale, SK_Scalar1); + + IntRect rectA; + WebFloatRect rectB; + delegate.paintContents(&canvas, rectA, rectB); + EXPECT_EQ(callback.hintingScale, hintingScale); +} +#endif + } // namespace |
