Home | History | Annotate | Download | only in tests
      1 /*
      2  * Copyright 2017 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 
      8 #include "SkColorSpace.h"
      9 #include "SkToSRGBColorFilter.h"
     10 #include "Test.h"
     11 
     12 
     13 DEF_TEST(SkToSRGBColorFilter, r) {
     14 
     15     // sRGB -> sRGB is a no-op.
     16     REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGB()));
     17 
     18     // The transfer function matters just as much as the gamut.
     19     REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGBLinear()));
     20 
     21     // We generally interpret nullptr source spaces as sRGB.  See also chromium:787718.
     22     REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(nullptr));
     23 
     24     // Here's a realistic conversion.
     25     auto dci_p3 = SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
     26                                         SkColorSpace::kDCIP3_D65_Gamut);
     27     REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(dci_p3));
     28 
     29 }
     30