aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-17 13:32:06 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-17 13:32:06 +0000
commit72f3dca451f4739e20be0b4b198813677339205c (patch)
treef51ed037f1c660afea725bfec6357f0fef2678a7 /tests
parent85cade0a10217a50aebb495099ecc0435fe08b23 (diff)
Modify Read/WritePixelTests to print one pixel failure for each test case rather than every pixel
Review URL: http://codereview.appspot.com/6450154/ git-svn-id: http://skia.googlecode.com/svn/trunk@5147 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/ReadPixelsTest.cpp7
-rw-r--r--tests/WritePixelsTest.cpp9
2 files changed, 7 insertions, 9 deletions
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index a0eee04e5a..67bb65929b 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -181,7 +181,6 @@ bool checkRead(skiatest::Reporter* reporter,
if (!clippedSrcRect.intersect(srcRect)) {
clippedSrcRect.setEmpty();
}
- bool failed = false;
SkAutoLockPixels alp(bitmap);
intptr_t pixels = reinterpret_cast<intptr_t>(bitmap.getPixels());
for (int by = 0; by < bh; ++by) {
@@ -199,18 +198,18 @@ bool checkRead(skiatest::Reporter* reporter,
bool check;
REPORTER_ASSERT(reporter, check = checkPixel(pmPixel, canvasPixel, didPremul));
if (!check) {
- failed = true;
+ return false;
}
}
} else if (checkBitmapPixels) {
REPORTER_ASSERT(reporter, getBitmapColor(bx, by, bw, bh) == pixel);
if (getBitmapColor(bx, by, bw, bh) != pixel) {
- failed = true;
+ return false;
}
}
}
}
- return !failed;
+ return true;
}
enum BitmapInit {
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 5911b800bc..d5ce8af573 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -241,7 +241,6 @@ bool checkWrite(skiatest::Reporter* reporter,
intptr_t canvasPixels = reinterpret_cast<intptr_t>(devBmp.getPixels());
size_t canvasRowBytes = devBmp.rowBytes();
SkIRect writeRect = SkIRect::MakeXYWH(writeX, writeY, bitmap.width(), bitmap.height());
- bool success = true;
for (int cy = 0; cy < DEV_H; ++cy) {
const SkPMColor* canvasRow = reinterpret_cast<const SkPMColor*>(canvasPixels);
for (int cx = 0; cx < DEV_W; ++cx) {
@@ -255,14 +254,14 @@ bool checkWrite(skiatest::Reporter* reporter,
bool check;
REPORTER_ASSERT(reporter, check = checkPixel(bmpPMColor, canvasPixel, mul));
if (!check) {
- success = false;
+ return false;
}
} else {
bool check;
SkPMColor testColor = getCanvasColor(cx, cy);
REPORTER_ASSERT(reporter, check = (canvasPixel == testColor));
if (!check) {
- success = false;
+ return false;
}
}
}
@@ -272,14 +271,14 @@ bool checkWrite(skiatest::Reporter* reporter,
bool check;
REPORTER_ASSERT(reporter, check = (pad[px] == static_cast<char>(DEV_PAD)));
if (!check) {
- success = false;
+ return false;
}
}
}
canvasPixels += canvasRowBytes;
}
- return success;
+ return true;
}
enum DevType {