diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 20:10:48 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 20:10:48 +0000 |
commit | 5bfafb06880152214274bb43ee82dd1ea2edfdb2 (patch) | |
tree | ec9b49d2ec194ee612e1cd2370c31d05f6752f80 /skia/ext/platform_canvas_unittest.cc | |
parent | 19cbbd980d6c206782f3c4ea7ed9b1a730a91895 (diff) | |
download | chromium_src-5bfafb06880152214274bb43ee82dd1ea2edfdb2.zip chromium_src-5bfafb06880152214274bb43ee82dd1ea2edfdb2.tar.gz chromium_src-5bfafb06880152214274bb43ee82dd1ea2edfdb2.tar.bz2 |
Add back convolver_unittest.cc and image_operations_unittest.cc.
Fix a TODO in platform_canvas_unittest.cc.
Make vector_canvas_unittest.cc slightly less dependent on base/.
Remove Windows 2000 checks.
(Same as r8458 with platform_canvas_unittest.cc and SConscript fixed)
BUG=5113
Review URL: http://codereview.chromium.org/18511
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8498 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/platform_canvas_unittest.cc')
-rw-r--r-- | skia/ext/platform_canvas_unittest.cc | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/skia/ext/platform_canvas_unittest.cc b/skia/ext/platform_canvas_unittest.cc index d382477..e1f1eee 100644 --- a/skia/ext/platform_canvas_unittest.cc +++ b/skia/ext/platform_canvas_unittest.cc @@ -6,9 +6,7 @@ #include "build/build_config.h" -#if defined(OS_WIN) -#include <windows.h> -#else +#if !defined(OS_WIN) #include <unistd.h> #endif @@ -18,6 +16,9 @@ #include "SkColor.h" +// TODO(maruel): Removes once notImplemented() is not necessary anymore. +#include "NotImplemented.h" + namespace skia { namespace { @@ -50,8 +51,7 @@ bool VerifyRect(const PlatformCanvas& canvas, // Checks whether there is a white canvas with a black square at the given // location in pixels (not in the canvas coordinate system). -// TODO(ericroman): rename Square to Rect -bool VerifyBlackSquare(const PlatformCanvas& canvas, int x, int y, int w, int h) { +bool VerifyBlackRect(const PlatformCanvas& canvas, int x, int y, int w, int h) { return VerifyRect(canvas, SK_ColorWHITE, SK_ColorBLACK, x, y, w, h); } @@ -88,7 +88,7 @@ void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) { } #else void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) { - NOTIMPLEMENTED(); + notImplemented(); } #endif @@ -116,7 +116,9 @@ class LayerSaver { } ~LayerSaver() { +#if defined(OS_WIN) canvas_.getTopPlatformDevice().fixupAlphaBeforeCompositing(); +#endif canvas_.restore(); } @@ -161,7 +163,7 @@ TEST(PlatformCanvas, SkLayer) { LayerSaver layer(canvas, kLayerX, kLayerY, kLayerW, kLayerH); canvas.drawColor(SK_ColorBLACK); } - EXPECT_TRUE(VerifyBlackSquare(canvas, kLayerX, kLayerY, kLayerW, kLayerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kLayerX, kLayerY, kLayerW, kLayerH)); } // Test native clipping. @@ -175,7 +177,9 @@ TEST(PlatformCanvas, ClipRegion) { // with a black rectangle. // Note: Don't use LayerSaver, since internally it sets a clip region. DrawNativeRect(canvas, 0, 0, 16, 16); +#if defined(OS_WIN) canvas.getTopPlatformDevice().fixupAlphaBeforeCompositing(); +#endif EXPECT_TRUE(VerifyCanvasColor(canvas, SK_ColorBLACK)); // Test that intersecting disjoint clip rectangles sets an empty clip region @@ -202,7 +206,7 @@ TEST(PlatformCanvas, FillLayer) { LayerSaver layer(canvas, kLayerX, kLayerY, kLayerW, kLayerH); DrawNativeRect(canvas, 0, 0, 100, 100); } - EXPECT_TRUE(VerifyBlackSquare(canvas, kLayerX, kLayerY, kLayerW, kLayerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kLayerX, kLayerY, kLayerW, kLayerH)); // Make a layer and fill it partially to make sure the translation is correct. canvas.drawColor(SK_ColorWHITE); @@ -210,7 +214,7 @@ TEST(PlatformCanvas, FillLayer) { LayerSaver layer(canvas, kLayerX, kLayerY, kLayerW, kLayerH); DrawNativeRect(canvas, kInnerX, kInnerY, kInnerW, kInnerH); } - EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX, kInnerY, kInnerW, kInnerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kInnerX, kInnerY, kInnerW, kInnerH)); // Add a clip on the layer and fill to make sure clip is correct. canvas.drawColor(SK_ColorWHITE); @@ -221,7 +225,7 @@ TEST(PlatformCanvas, FillLayer) { DrawNativeRect(canvas, 0, 0, 100, 100); canvas.restore(); } - EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX, kInnerY, kInnerW, kInnerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kInnerX, kInnerY, kInnerW, kInnerH)); // Add a clip and then make the layer to make sure the clip is correct. canvas.drawColor(SK_ColorWHITE); @@ -232,7 +236,7 @@ TEST(PlatformCanvas, FillLayer) { DrawNativeRect(canvas, 0, 0, 100, 100); } canvas.restore(); - EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX, kInnerY, kInnerW, kInnerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kInnerX, kInnerY, kInnerW, kInnerH)); } // Test that translation + make layer works properly. @@ -250,8 +254,8 @@ TEST(PlatformCanvas, TranslateLayer) { DrawNativeRect(canvas, 0, 0, 100, 100); } canvas.restore(); - EXPECT_TRUE(VerifyBlackSquare(canvas, kLayerX + 1, kLayerY + 1, - kLayerW, kLayerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kLayerX + 1, kLayerY + 1, + kLayerW, kLayerH)); // Translate then make the layer. canvas.drawColor(SK_ColorWHITE); @@ -262,8 +266,8 @@ TEST(PlatformCanvas, TranslateLayer) { DrawNativeRect(canvas, kInnerX, kInnerY, kInnerW, kInnerH); } canvas.restore(); - EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 1, kInnerY + 1, - kInnerW, kInnerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kInnerX + 1, kInnerY + 1, + kInnerW, kInnerH)); // Make the layer then translate. canvas.drawColor(SK_ColorWHITE); @@ -274,8 +278,8 @@ TEST(PlatformCanvas, TranslateLayer) { DrawNativeRect(canvas, kInnerX, kInnerY, kInnerW, kInnerH); } canvas.restore(); - EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 1, kInnerY + 1, - kInnerW, kInnerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kInnerX + 1, kInnerY + 1, + kInnerW, kInnerH)); // Translate both before and after, and have a clip. canvas.drawColor(SK_ColorWHITE); @@ -288,9 +292,8 @@ TEST(PlatformCanvas, TranslateLayer) { DrawNativeRect(canvas, 0, 0, 100, 100); } canvas.restore(); - EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 2, kInnerY + 2, - kInnerW, kInnerH)); + EXPECT_TRUE(VerifyBlackRect(canvas, kInnerX + 2, kInnerY + 2, + kInnerW, kInnerH)); } } // namespace skia - |