@@ -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)
@@ -322,7 +322,7 @@ TEST_F(DisplayColorProfileTest, ctorSignalsHdrSupportForAnyWideColorGamutDevice)
322322TEST_F (DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHasNoSupport) {
323323 auto profile = ProfileFactory::createProfileWithNoColorModeSupport ();
324324
325- EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::COLORIMETRIC));
325+ EXPECT_TRUE (profile.hasRenderIntent (RenderIntent::COLORIMETRIC));
326326 EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::ENHANCE));
327327 EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_COLORIMETRIC));
328328 EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_ENHANCE));
@@ -339,6 +339,16 @@ TEST_F(DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHas
339339 EXPECT_FALSE (profile.hasRenderIntent (VendorRenderIntent));
340340}
341341
342+ TEST_F (DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHasSRGBSupport_NoWCG) {
343+ auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport (false );
344+
345+ EXPECT_TRUE (profile.hasRenderIntent (RenderIntent::COLORIMETRIC));
346+ EXPECT_TRUE (profile.hasRenderIntent (RenderIntent::ENHANCE));
347+ EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_COLORIMETRIC));
348+ EXPECT_FALSE (profile.hasRenderIntent (RenderIntent::TONE_MAP_ENHANCE));
349+ EXPECT_TRUE (profile.hasRenderIntent (VendorRenderIntent));
350+ }
351+
342352TEST_F (DisplayColorProfileTest, hasRenderIntentReturnsExpectedValueWhenOutputHasSRGBSupport) {
343353 auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport ();
344354
@@ -509,6 +519,40 @@ TEST_F(DisplayColorProfileTest, getBestColorModeReturnsExpectedModesWhenOutputHa
509519 checkGetBestColorMode (profile, expectedResults);
510520}
511521
522+ TEST_F (DisplayColorProfileTest,
523+ getBestColorModeReturnsExpectedModesWhenOutputHasSRGBSupport_NoWCG) {
524+ auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport (false );
525+
526+ // Note: This table of expected values goes with the table of arguments
527+ // used in checkGetBestColorMode.
528+ using Result = std::tuple<Dataspace, ColorMode, RenderIntent>;
529+ std::array<Result, 15 > expectedResults = {
530+ /* clang-format off */
531+ /* 0 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
532+ /* 1 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::ENHANCE},
533+ /* 2 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, VendorRenderIntent},
534+
535+ /* 3 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
536+ /* 4 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::ENHANCE},
537+ /* 5 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, VendorRenderIntent},
538+
539+ /* 6 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
540+ /* 7 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::ENHANCE},
541+ /* 8 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, VendorRenderIntent},
542+
543+ /* 9 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
544+ /* 10 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
545+ /* 11 */ Result{Dataspace::UNKNOWN, ColorMode::NATIVE, RenderIntent::COLORIMETRIC},
546+
547+ /* 12 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
548+ /* 13 */ Result{Dataspace::V0_SRGB, ColorMode::SRGB, RenderIntent::COLORIMETRIC},
549+ /* 14 */ Result{Dataspace::UNKNOWN, ColorMode::NATIVE, RenderIntent::COLORIMETRIC},
550+ /* clang-format on */
551+ };
552+
553+ checkGetBestColorMode (profile, expectedResults);
554+ }
555+
512556TEST_F (DisplayColorProfileTest, getBestColorModeReturnsExpectedModesWhenOutputHasSRGBSupport) {
513557 auto profile = ProfileFactory::createProfileWithSRGBColorModeSupport ();
514558
0 commit comments