diff --git a/src/tests/color-management-tests.c b/src/tests/color-management-tests.c index c486fd2d6..932bb5908 100644 --- a/src/tests/color-management-tests.c +++ b/src/tests/color-management-tests.c @@ -589,6 +589,72 @@ meta_test_color_management_profile_device (void) g_assert_cmpfloat_with_epsilon (white->Z, 1.10479736, PRIMARY_EPSILON); } +static void +meta_test_color_management_profile_device_bogus (void) +{ + MetaBackend *backend = meta_context_get_backend (test_context); + MetaMonitorManager *monitor_manager = + meta_backend_get_monitor_manager (backend); + MetaMonitorManagerTest *monitor_manager_test = + META_MONITOR_MANAGER_TEST (monitor_manager); + MetaColorManager *color_manager = + meta_backend_get_color_manager (backend); + MetaEdidInfo edid_info; + MonitorTestCaseSetup test_case_setup = base_monitor_setup; + MetaMonitorTestSetup *test_setup; + MetaMonitor *monitor; + MetaColorDevice *color_device; + MetaColorProfile *color_profile; + + edid_info = CALTECH_MONITOR_EDID; + /* Decoding gamma is in [1, 4] */ + edid_info.gamma = 0.7; + test_case_setup.outputs[0].serial = "profile_device_bogus/gamma"; + test_case_setup.outputs[0].edid_info = edid_info; + test_case_setup.outputs[0].has_edid_info = TRUE; + test_setup = meta_create_monitor_test_setup (backend, &test_case_setup, + MONITOR_TEST_FLAG_NO_STORED); + meta_monitor_manager_test_emulate_hotplug (monitor_manager_test, test_setup); + + monitor = meta_monitor_manager_get_monitors (monitor_manager)->data; + color_device = meta_color_manager_get_color_device (color_manager, monitor); + g_assert_nonnull (color_device); + + g_test_expect_message ("libmutter", G_LOG_LEVEL_WARNING, + "Failed to create device color profile:*" + "contains bogus Display Transfer Characteristics " + "(GAMMA)"); + + while (!meta_color_device_is_ready (color_device)) + g_main_context_iteration (NULL, TRUE); + + color_profile = meta_color_device_get_device_profile (color_device); + g_assert_null (color_profile); + + edid_info = CALTECH_MONITOR_EDID; + edid_info.green_y = 0.0; + test_case_setup.outputs[0].serial = "profile_device_bogus/chromaticity"; + test_case_setup.outputs[0].edid_info = edid_info; + test_case_setup.outputs[0].has_edid_info = TRUE; + test_setup = meta_create_monitor_test_setup (backend, &test_case_setup, + MONITOR_TEST_FLAG_NO_STORED); + meta_monitor_manager_test_emulate_hotplug (monitor_manager_test, test_setup); + + monitor = meta_monitor_manager_get_monitors (monitor_manager)->data; + color_device = meta_color_manager_get_color_device (color_manager, monitor); + g_assert_nonnull (color_device); + + g_test_expect_message ("libmutter", G_LOG_LEVEL_WARNING, + "Failed to create device color profile:*" + "contains bogus Color Characteristics"); + + while (!meta_color_device_is_ready (color_device)) + g_main_context_iteration (NULL, TRUE); + + color_profile = meta_color_device_get_device_profile (color_device); + g_assert_null (color_profile); +} + static void meta_test_color_management_profile_system (void) { @@ -1347,6 +1413,8 @@ init_tests (void) meta_test_color_management_device_no_gamma); add_color_test ("/color-management/profile/device", meta_test_color_management_profile_device); + add_color_test ("/color-management/profile/device-bogus", + meta_test_color_management_profile_device_bogus); add_color_test ("/color-management/profile/system", meta_test_color_management_profile_system); add_color_test ("/color-management/profile/efivar",