blob: f9e62ce95ae3a4f64314c0a63937b4a2d036f4f2 [file] [log] [blame]
Ravi Mistry113d05f2016-12-17 01:31:03 +00001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "include/core/SkTypes.h"
Ravi Mistry113d05f2016-12-17 01:31:03 +00009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/core/SkICC.h"
11#include "include/core/SkString.h"
Brian Osmanea236bf2019-04-29 10:28:22 -040012#include "include/third_party/skcms/skcms.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "src/core/SkColorSpacePriv.h"
14#include "tests/Test.h"
15#include "tools/Resources.h"
Hal Canary8a001442018-09-19 11:31:27 -040016
Brian Osman8dc68c62018-05-30 12:57:45 -040017DEF_TEST(AdobeRGB, r) {
18 if (sk_sp<SkData> profile = GetResourceAsData("icc_profiles/AdobeRGB1998.icc")) {
19 skcms_ICCProfile parsed;
20 REPORTER_ASSERT(r, skcms_Parse(profile->data(), profile->size(), &parsed));
Ravi Mistry113d05f2016-12-17 01:31:03 +000021
Brian Osman8dc68c62018-05-30 12:57:45 -040022 auto got = SkColorSpace::Make(parsed);
Brian Osman82ebe042019-01-04 17:03:00 -050023 auto want = SkColorSpace::MakeRGB(SkNamedTransferFn::k2Dot2, SkNamedGamut::kAdobeRGB);
Brian Osman8dc68c62018-05-30 12:57:45 -040024 REPORTER_ASSERT(r, SkColorSpace::Equals(got.get(), want.get()));
Matt Sarett1bfcf882016-12-19 18:37:34 -050025 }
Brian Osman8dc68c62018-05-30 12:57:45 -040026}