monitor-unit-tests: Add basic tests for RGB range

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
This commit is contained in:
Sebastian Wick
2024-01-17 17:25:06 +01:00
committed by Marge Bot
parent 926f7ea26d
commit 23b30267b5
6 changed files with 215 additions and 18 deletions

View File

@ -49,6 +49,7 @@ typedef struct _MonitorStoreTestCaseMonitor
MonitorStoreTestCaseMonitorMode mode;
gboolean is_underscanning;
unsigned int max_bpc;
MetaOutputRGBRange rgb_range;
} MonitorStoreTestCaseMonitor;
typedef struct _MonitorStoreTestCaseLogicalMonitor
@ -203,6 +204,9 @@ check_monitor_store_configuration (MetaMonitorConfigStore *config_store,
g_assert_cmpint (monitor_config->max_bpc,
==,
test_monitor->max_bpc);
g_assert_cmpint (monitor_config->rgb_range,
==,
test_monitor->rgb_range);
}
}
}
@ -253,7 +257,8 @@ meta_test_monitor_store_single (void)
.width = 1920,
.height = 1080,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -297,7 +302,8 @@ meta_test_monitor_store_vertical (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -322,7 +328,8 @@ meta_test_monitor_store_vertical (void)
.width = 800,
.height = 600,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -366,7 +373,8 @@ meta_test_monitor_store_primary (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -391,7 +399,8 @@ meta_test_monitor_store_primary (void)
.width = 800,
.height = 600,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -436,7 +445,8 @@ meta_test_monitor_store_underscanning (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -481,7 +491,8 @@ meta_test_monitor_store_max_bpc (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -498,6 +509,51 @@ meta_test_monitor_store_max_bpc (void)
check_monitor_store_configurations (&expect);
}
static void
meta_test_monitor_store_rgb_range (void)
{
MonitorStoreTestExpect expect = {
.configurations = {
{
.logical_monitors = {
{
.layout = {
.x = 0,
.y = 0,
.width = 1024,
.height = 768
},
.scale = 1,
.is_primary = TRUE,
.is_presentation = FALSE,
.monitors = {
{
.connector = "DP-1",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.mode = {
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
},
.rgb_range = META_OUTPUT_RGB_RANGE_LIMITED,
}
},
.n_monitors = 1,
},
},
.n_logical_monitors = 1
}
},
.n_configurations = 1
};
meta_set_custom_monitor_config (test_context, "rgb-range.xml");
check_monitor_store_configurations (&expect);
}
static void
meta_test_monitor_store_scale (void)
{
@ -525,7 +581,8 @@ meta_test_monitor_store_scale (void)
.width = 1920,
.height = 1080,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -569,7 +626,8 @@ meta_test_monitor_store_fractional_scale (void)
.width = 1200,
.height = 900,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -613,7 +671,8 @@ meta_test_monitor_store_high_precision_fractional_scale (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -656,7 +715,8 @@ meta_test_monitor_store_mirrored (void)
.width = 800,
.height = 600,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
},
{
.connector = "DP-2",
@ -667,7 +727,8 @@ meta_test_monitor_store_mirrored (void)
.width = 800,
.height = 600,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 2,
@ -712,7 +773,8 @@ meta_test_monitor_store_first_rotated (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -738,7 +800,8 @@ meta_test_monitor_store_first_rotated (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -783,7 +846,8 @@ meta_test_monitor_store_second_rotated (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -809,7 +873,8 @@ meta_test_monitor_store_second_rotated (void)
.width = 1024,
.height = 768,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -854,7 +919,8 @@ meta_test_monitor_store_interlaced (void)
.height = 768,
.refresh_rate = 60.000495910644531,
.flags = META_CRTC_MODE_FLAG_INTERLACE,
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -898,7 +964,8 @@ meta_test_monitor_store_unknown_elements (void)
.width = 1920,
.height = 1080,
.refresh_rate = 60.000495910644531
}
},
.rgb_range = META_OUTPUT_RGB_RANGE_AUTO,
}
},
.n_monitors = 1,
@ -1049,6 +1116,8 @@ init_monitor_store_tests (void)
meta_test_monitor_store_underscanning);
g_test_add_func ("/backends/monitor-store/max-bpc",
meta_test_monitor_store_max_bpc);
g_test_add_func ("/backends/monitor-store/rgb-range",
meta_test_monitor_store_rgb_range);
g_test_add_func ("/backends/monitor-store/scale",
meta_test_monitor_store_scale);
g_test_add_func ("/backends/monitor-store/fractional-scale",