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

Unified Diff: skia/ext/skia_utils_mac_unittest.mm

Issue 2001653002: Remove SkDevice, obsolete constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expect inverse CTM to avoid additional clipping Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/skia_utils_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/skia_utils_mac_unittest.mm
diff --git a/skia/ext/skia_utils_mac_unittest.mm b/skia/ext/skia_utils_mac_unittest.mm
index 9e4505667fabb3377141c66f1f10f4001f503862..9e0c0ae963e575416ce34cbb38e7852e28b018dd 100644
--- a/skia/ext/skia_utils_mac_unittest.mm
+++ b/skia/ext/skia_utils_mac_unittest.mm
@@ -33,10 +33,6 @@ class SkiaUtilsMacTest : public testing::Test {
TestTranslate = 1,
TestClip = 2,
TestXClip = TestTranslate | TestClip,
- TestNoBits = 4,
- TestTranslateNoBits = TestTranslate | TestNoBits,
- TestClipNoBits = TestClip | TestNoBits,
- TestXClipNoBits = TestXClip | TestNoBits,
};
void RunBitLockerTest(BitLockerTest test);
@@ -134,7 +130,6 @@ void SkiaUtilsMacTest::TestSkBitmap(const SkBitmap& bitmap) {
EXPECT_EQ(255u, SkColorGetA(color));
}
-// setBitmapDevice has been deprecated/removed. Is this test still useful?
void SkiaUtilsMacTest::RunBitLockerTest(BitLockerTest test) {
const unsigned width = 2;
const unsigned height = 2;
@@ -155,18 +150,14 @@ void SkiaUtilsMacTest::RunBitLockerTest(BitLockerTest test) {
canvas.clipRect(clipRect);
}
{
- skia::SkiaBitLocker bitLocker(&canvas);
+ SkIRect clip = SkIRect::MakeSize(canvas.getBaseLayerSize()).
+ makeOffset((test & TestTranslate) ? -width / 2 : 0, 0);
+ skia::SkiaBitLocker bitLocker(&canvas, SkIRect::MakeSize(canvas.getBaseLayerSize()));
f(malita) 2016/06/08 14:24:36 You meant to pass clip here :)
CGContextRef cgContext = bitLocker.cgContext();
CGColorRef testColor = CGColorGetConstantColor(kCGColorWhite);
CGContextSetFillColorWithColor(cgContext, testColor);
CGRect cgRect = {{0, 0}, {width, height}};
CGContextFillRect(cgContext, cgRect);
- if (test & TestNoBits) {
- if (test & TestClip) {
- SkRect clipRect = {0, height / 2, width, height};
- canvas.clipRect(clipRect);
- }
- }
}
const unsigned results[][storageSize] = {
{0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}, // identity
@@ -175,7 +166,7 @@ void SkiaUtilsMacTest::RunBitLockerTest(BitLockerTest test) {
{0xFF333333, 0xFF666666, 0xFF999999, 0xFFFFFFFF} // translate | clip
};
for (unsigned index = 0; index < storageSize; index++)
- EXPECT_EQ(results[test & ~TestNoBits][index], bits[index]);
+ EXPECT_EQ(results[test][index], bits[index]);
}
void SkiaUtilsMacTest::ShapeHelper(int width, int height,
@@ -249,21 +240,5 @@ TEST_F(SkiaUtilsMacTest, BitLocker_XClip) {
RunBitLockerTest(SkiaUtilsMacTest::TestXClip);
}
-TEST_F(SkiaUtilsMacTest, BitLocker_NoBits) {
- RunBitLockerTest(SkiaUtilsMacTest::TestNoBits);
-}
-
-TEST_F(SkiaUtilsMacTest, BitLocker_TranslateNoBits) {
- RunBitLockerTest(SkiaUtilsMacTest::TestTranslateNoBits);
-}
-
-TEST_F(SkiaUtilsMacTest, BitLocker_ClipNoBits) {
- RunBitLockerTest(SkiaUtilsMacTest::TestClipNoBits);
-}
-
-TEST_F(SkiaUtilsMacTest, BitLocker_XClipNoBits) {
- RunBitLockerTest(SkiaUtilsMacTest::TestXClipNoBits);
-}
-
} // namespace
« no previous file with comments | « skia/ext/skia_utils_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698