blob: 519ffb8a35ef6d5db24d457e80a9a896da25c6f7 [file] [log] [blame]
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkColorSpace.h"
#include "SkToSRGBColorFilter.h"
#include "Test.h"
DEF_TEST(SkToSRGBColorFilter, r) {
// sRGB -> sRGB is a no-op.
REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGB()));
// The transfer function matters just as much as the gamut.
REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGBLinear()));
// We generally interpret nullptr source spaces as sRGB. See also chromium:787718.
REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(nullptr));
// Here's a realistic conversion.
auto dci_p3 = SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, SkNamedGamut::kDCIP3);
REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(dci_p3));
}