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

Unified Diff: tests/ColorSpaceTest.cpp

Issue 2196743002: Add SkColorSpace::Equals() API (Closed) Base URL: https://skia.googlesource.com/skia.git@cscleanup
Patch Set: Fix logic Created 4 years, 5 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 | « src/core/SkColorSpace.cpp ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ColorSpaceTest.cpp
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index 62a898c2f72c1709eab2e942fcd579610bc83147..8837c380371a2b4a50f878bb77c2a70c39c3f18e 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -221,3 +221,34 @@ DEF_TEST(ColorSpace_Serialize, r) {
test_serialize(r, SkColorSpace::NewICC(monitorData->data(), monitorData->size()).get(), false);
}
+DEF_TEST(ColorSpace_Equals, r) {
+ sk_sp<SkColorSpace> srgb = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ sk_sp<SkColorSpace> adobe = SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named);
+ sk_sp<SkData> data = SkData::MakeFromFileName(
+ GetResourcePath("icc_profiles/HP_ZR30w.icc").c_str());
+ sk_sp<SkColorSpace> z30 = SkColorSpace::NewICC(data->data(), data->size());
+ data = SkData::MakeFromFileName( GetResourcePath("icc_profiles/HP_Z32x.icc").c_str());
+ sk_sp<SkColorSpace> z32 = SkColorSpace::NewICC(data->data(), data->size());
+ data = SkData::MakeFromFileName(GetResourcePath("icc_profiles/upperLeft.icc").c_str());
+ sk_sp<SkColorSpace> upperLeft = SkColorSpace::NewICC(data->data(), data->size());
+ data = SkData::MakeFromFileName(GetResourcePath("icc_profiles/upperRight.icc").c_str());
+ sk_sp<SkColorSpace> upperRight = SkColorSpace::NewICC(data->data(), data->size());
+
+ REPORTER_ASSERT(r, SkColorSpace::Equals(nullptr, nullptr));
+ REPORTER_ASSERT(r, SkColorSpace::Equals(srgb.get(), srgb.get()));
+ REPORTER_ASSERT(r, SkColorSpace::Equals(adobe.get(), adobe.get()));
+ REPORTER_ASSERT(r, SkColorSpace::Equals(z30.get(), z30.get()));
+ REPORTER_ASSERT(r, SkColorSpace::Equals(z32.get(), z32.get()));
+ REPORTER_ASSERT(r, SkColorSpace::Equals(upperLeft.get(), upperLeft.get()));
+ REPORTER_ASSERT(r, SkColorSpace::Equals(upperRight.get(), upperRight.get()));
+
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(nullptr, srgb.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(srgb.get(), nullptr));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(adobe.get(), srgb.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), srgb.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(z32.get(), z30.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), srgb.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), upperRight.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), upperRight.get()));
+ REPORTER_ASSERT(r, !SkColorSpace::Equals(upperRight.get(), adobe.get()));
+}
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698