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

Unified Diff: tests/ImageDecodingTest.cpp

Issue 278033002: Revert "Flatten resources directory" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | « resources/randPixels.webp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageDecodingTest.cpp
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 86b96ae0f9327be1472c59b19109fc6c6a71f9e0..e9348fed991f5f4bf4e4a4c5f4851e519b90ffe2 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -512,8 +512,8 @@ static SkPixelRef* install_pixel_ref(SkBitmap* bitmap,
*/
DEF_TEST(ImprovedBitmapFactory, reporter) {
SkString resourcePath = skiatest::Test::GetResourcePath();
- SkString path = SkOSPath::SkPathJoin(
- resourcePath.c_str(), "randPixels.png");
+ SkString directory = SkOSPath::SkPathJoin(resourcePath.c_str(), "encoding");
+ SkString path = SkOSPath::SkPathJoin(directory.c_str(), "randPixels.png");
SkAutoTUnref<SkStreamRewindable> stream(
SkStream::NewFromFile(path.c_str()));
if (sk_exists(path.c_str())) {
@@ -531,10 +531,9 @@ DEF_TEST(ImprovedBitmapFactory, reporter) {
#if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX)
static inline bool check_rounding(int value, int dividend, int divisor) {
- // returns true if the value is greater than floor(dividend/divisor)
- // and less than SkNextPow2(ceil(dividend - divisor))
+ // returns true if (dividend/divisor) rounds up OR down to value
return (((divisor * value) > (dividend - divisor))
- && value <= SkNextPow2(((dividend - 1) / divisor) + 1));
+ && ((divisor * value) < (dividend + divisor)));
}
#endif // SK_BUILD_FOR_ANDROID || SK_BUILD_FOR_UNIX
@@ -622,11 +621,6 @@ static void test_options(skiatest::Reporter* reporter,
opts.fSampleSize));
REPORTER_ASSERT(reporter, check_rounding(bm.width(), kExpectedWidth,
opts.fSampleSize));
- // The ImageDecoder API doesn't guarantee that SampleSize does
- // anything at all, but the decoders that this test excercises all
- // produce an output size in the following range:
- // (((sample_size * out_size) > (in_size - sample_size))
- // && out_size <= SkNextPow2(((in_size - 1) / sample_size) + 1));
#endif // SK_BUILD_FOR_ANDROID || SK_BUILD_FOR_UNIX
SkAutoLockPixels alp(bm);
if (bm.getPixels() == NULL) {
@@ -688,7 +682,8 @@ DEF_TEST(ImageDecoderOptions, reporter) {
};
SkString resourceDir = skiatest::Test::GetResourcePath();
- if (!sk_exists(resourceDir.c_str())) {
+ SkString directory = SkOSPath::SkPathJoin(resourceDir.c_str(), "encoding");
+ if (!sk_exists(directory.c_str())) {
return;
}
@@ -705,7 +700,7 @@ DEF_TEST(ImageDecoderOptions, reporter) {
const bool useDataList[] = {true, false};
for (size_t fidx = 0; fidx < SK_ARRAY_COUNT(files); ++fidx) {
- SkString path = SkOSPath::SkPathJoin(resourceDir.c_str(), files[fidx]);
+ SkString path = SkOSPath::SkPathJoin(directory.c_str(), files[fidx]);
if (!sk_exists(path.c_str())) {
continue;
}
« no previous file with comments | « resources/randPixels.webp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698