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

Unified Diff: tests/ColorSpaceTest.cpp

Issue 2035813003: add MakeS32 helper to SkImageInfo, fix named-gamma constructor bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 4 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 | « src/core/SkImageInfo.cpp ('k') | no next file » | 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 b26cec20aec254f461417efc6f64c0c14c6591fe..6dd4789a8e5f9b5da0e1ca87da141a878f59b455 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -138,3 +138,26 @@ DEF_TEST(ColorSpaceWriteICC, r) {
REPORTER_ASSERT(r, monitorSpace->xyz() == newMonitorSpace->xyz());
REPORTER_ASSERT(r, as_CSB(monitorSpace)->gammas() == as_CSB(newMonitorSpace)->gammas());
}
+
+DEF_TEST(ColorSpace_Named, r) {
+ const struct {
+ SkColorSpace::Named fNamed;
+ bool fExpectedToSucceed;
+ } recs[] {
+ { SkColorSpace::kUnknown_Named, false },
+ { SkColorSpace::kSRGB_Named, true },
+ { SkColorSpace::kAdobeRGB_Named, true },
+ };
+
+ for (auto rec : recs) {
+ auto cs = SkColorSpace::NewNamed(rec.fNamed);
+ REPORTER_ASSERT(r, !cs == !rec.fExpectedToSucceed);
+ if (cs) {
+ REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == cs->gammaNamed());
+ }
+ }
+
+ SkImageInfo info = SkImageInfo::MakeS32(10, 10, kPremul_SkAlphaType);
+ REPORTER_ASSERT(r, kSRGB_SkColorProfileType == info.profileType());
+ REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == info.colorSpace()->gammaNamed());
+}
« no previous file with comments | « src/core/SkImageInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698