aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ColorSpaceTest.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-03-07 17:25:12 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-07 17:25:12 -0800
commit53add95b2e8d97e4dfe18b26e1f3a0d414706354 (patch)
tree78e2ea9c19a8f5ac0d2804bc3c6ec2397ba46c8f /tests/ColorSpaceTest.cpp
parent46752200009f70d708e37b413a2144b7aaa09ce1 (diff)
Disable color space test for old versions of libpng
Diffstat (limited to 'tests/ColorSpaceTest.cpp')
-rw-r--r--tests/ColorSpaceTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index cf7560228f..555f41ec6a 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -10,14 +10,18 @@
#include "SkColorSpace.h"
#include "Test.h"
+#include "png.h"
+
static SkStreamAsset* resource(const char path[]) {
SkString fullPath = GetResourcePath(path);
return SkStream::NewFromFile(fullPath.c_str());
}
+#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
static bool almost_equal(float a, float b) {
return SkTAbs(a - b) < 0.0001f;
}
+#endif
DEF_TEST(ColorSpaceParseICCProfile, r) {
SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png"));
@@ -26,6 +30,7 @@ DEF_TEST(ColorSpaceParseICCProfile, r) {
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
REPORTER_ASSERT(r, nullptr != codec);
+#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
SkColorSpace* colorSpace = codec->getColorSpace();
REPORTER_ASSERT(r, nullptr != colorSpace);
@@ -48,4 +53,5 @@ DEF_TEST(ColorSpaceParseICCProfile, r) {
REPORTER_ASSERT(r, almost_equal(0.143066f, xyz.fMat[6]));
REPORTER_ASSERT(r, almost_equal(0.0606079f, xyz.fMat[7]));
REPORTER_ASSERT(r, almost_equal(0.714096f, xyz.fMat[8]));
+#endif
}