mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
tests/color: Test EDIDs with bogus data
Make sure the profile creation fails without crashing and that the device still becomes ready when we fail to create a profile. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2627>
This commit is contained in:
parent
19837796fe
commit
88504b96d0
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user