@@ -123,10 +123,10 @@ class ProfileFactory {
123123 .build ();
124124 }
125125
126- static impl::DisplayColorProfile createProfileWithSRGBColorModeSupport () {
126+ static impl::DisplayColorProfile createProfileWithSRGBColorModeSupport (bool wcg = true ) {
127127 return ProfileFactory ()
128- .setHasWideColorGamut (true )
129128 .addHdrType (Hdr::HDR10)
129+ .setHasWideColorGamut (wcg)
130130 .addColorModeRenderIntent (ColorMode::SRGB, RenderIntent::COLORIMETRIC)
131131 .addColorModeRenderIntent (ColorMode::SRGB, RenderIntent::ENHANCE)
132132 .addColorModeRenderIntent (ColorMode::SRGB, VendorRenderIntent)
@@ -289,7 +289,7 @@ TEST_F(DisplayColorProfileTest, ctorUsesOrDefaultsLuminanceValuesFromInputArgs)
289289TEST_F (DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHasNoSupport) {
290290 auto profile = ProfileFactory::createProfileWithNoColorModeSupport ();
291291
292- EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::COLORIMETRIC));
292+ EXPECT_TRUE (profile.hasRenderIntent (RenderIntent::COLORIMETRIC));
293293 EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::ENHANCE));
294294 EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_COLORIMETRIC));
295295 EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_ENHANCE));
@@ -306,6 +306,16 @@ TEST_F(DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHas
306306 EXPECT_FALSE (profile.hasRenderIntent (VendorRenderIntent));
307307}
308308
309+ TEST_F (DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHasSRGBSupport_NoWCG) {
310+ auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport (false );
311+
312+ EXPECT_TRUE (profile.hasRenderIntent (RenderIntent::COLORIMETRIC));
313+ EXPECT_TRUE (profile.hasRenderIntent (RenderIntent::ENHANCE));
314+ EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_COLORIMETRIC));
315+ EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_ENHANCE));
316+ EXPECT_TRUE (profile.hasRenderIntent (VendorRenderIntent));
317+ }
318+
309319TEST_F (DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHasSRGBSupport) {
310320 auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport ();
311321
@@ -476,6 +486,40 @@ TEST_F(DisplayColorProfileTest, getBestColorModeReturnsExpectedModesWhenOutputHa
476486 checkGetBestColorMode (profile, expectedResults);
477487}
478488
489+ TEST_F (DisplayColorProfileTest,
490+ getBestColorModeReturnsExpectedModesWhenOutputHasSRGBSupport_NoWCG) {
491+ auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport (false );
492+
493+ // Note: This table of expected values goes with the table of arguments
494+ // used in checkGetBestColorMode.
495+ using Result = std::tuple<Dataspace, ColorMode, RenderIntent>;
496+ std::array<Result, 15 > expectedResults = {
497+ /* clang-format off */
498+ /* 0 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
499+ /* 1 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::ENHANCE},
500+ /* 2 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, VendorRenderIntent},
501+
502+ /* 3 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
503+ /* 4 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::ENHANCE},
504+ /* 5 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, VendorRenderIntent},
505+
506+ /* 6 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
507+ /* 7 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::ENHANCE},
508+ /* 8 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, VendorRenderIntent},
509+
510+ /* 9 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
511+ /* 10 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
512+ /* 11 */ Result{Dataspace::UNKNOWN, ColorMode::NATIVE, RenderIntent::COLORIMETRIC},
513+
514+ /* 12 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
515+ /* 13 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
516+ /* 14 */ Result{Dataspace::UNKNOWN, ColorMode::NATIVE, RenderIntent::COLORIMETRIC},
517+ /* clang-format on */
518+ };
519+
520+ checkGetBestColorMode (profile, expectedResults);
521+ }
522+
479523TEST_F (DisplayColorProfileTest, getBestColorModeReturnsExpectedModesWhenOutputHasSRGBSupport) {
480524 auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport ();
481525
0 commit comments