tests: Add more monitor config policy parsing tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2030>
This commit is contained in:
parent
c611b64c53
commit
85a3ca3d17
8
src/tests/monitor-configs/policy-duplicate.xml
Normal file
8
src/tests/monitor-configs/policy-duplicate.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<monitors version="2">
|
||||
<policy>
|
||||
<stores>
|
||||
<store>user</store>
|
||||
<store>user</store>
|
||||
</stores>
|
||||
</policy>
|
||||
</monitors>
|
7
src/tests/monitor-configs/policy-empty.xml
Normal file
7
src/tests/monitor-configs/policy-empty.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<monitors version="2">
|
||||
<policy>
|
||||
<stores>
|
||||
<store></store>
|
||||
</stores>
|
||||
</policy>
|
||||
</monitors>
|
8
src/tests/monitor-configs/policy-invalid.xml
Normal file
8
src/tests/monitor-configs/policy-invalid.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<monitors version="2">
|
||||
<policy>
|
||||
<stores>
|
||||
<store>user</store>
|
||||
<store>not-a-store</store>
|
||||
</stores>
|
||||
</policy>
|
||||
</monitors>
|
12
src/tests/monitor-configs/policy-multiple.xml
Normal file
12
src/tests/monitor-configs/policy-multiple.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<monitors version="2">
|
||||
<policy>
|
||||
<stores>
|
||||
<store>user</store>
|
||||
<store>system</store>
|
||||
</stores>
|
||||
<stores>
|
||||
<store>system</store>
|
||||
<store>user</store>
|
||||
</stores>
|
||||
</policy>
|
||||
</monitors>
|
@ -919,6 +919,42 @@ meta_test_monitor_store_policy (void)
|
||||
META_CONFIG_STORE_SYSTEM);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_store_policy_empty (void)
|
||||
{
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
||||
"*Invalid store*");
|
||||
set_custom_monitor_system_config ("policy-empty.xml");
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_store_policy_duplicate (void)
|
||||
{
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
||||
"*Multiple identical stores*");
|
||||
set_custom_monitor_system_config ("policy-duplicate.xml");
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_store_policy_invalid (void)
|
||||
{
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
||||
"*Invalid store*");
|
||||
set_custom_monitor_system_config ("policy-invalid.xml");
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_store_policy_multiple (void)
|
||||
{
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
||||
"*Multiple stores elements under policy*");
|
||||
set_custom_monitor_system_config ("policy-multiple.xml");
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
void
|
||||
init_monitor_store_tests (void)
|
||||
{
|
||||
@ -950,4 +986,12 @@ init_monitor_store_tests (void)
|
||||
meta_test_monitor_store_policy_not_allowed);
|
||||
g_test_add_func ("/backends/monitor-store/policy",
|
||||
meta_test_monitor_store_policy);
|
||||
g_test_add_func ("/backends/monitor-store/policy-empty",
|
||||
meta_test_monitor_store_policy_empty);
|
||||
g_test_add_func ("/backends/monitor-store/policy-duplicate",
|
||||
meta_test_monitor_store_policy_duplicate);
|
||||
g_test_add_func ("/backends/monitor-store/policy-invalid",
|
||||
meta_test_monitor_store_policy_invalid);
|
||||
g_test_add_func ("/backends/monitor-store/policy-multiple",
|
||||
meta_test_monitor_store_policy_multiple);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user