testsuite: Improve test coverage

This commit is contained in:
Matthias Clasen 2023-05-31 20:35:17 -04:00
parent 85bafbdff0
commit d427933c61
2 changed files with 27 additions and 0 deletions

View File

@ -65,6 +65,23 @@ test_bad_display (void)
g_test_trap_assert_stderr ("*Failed to open display*");
}
static void
test_debug_help (void)
{
if (g_test_subprocess ())
{
g_setenv ("GDK_DEBUG", "help", TRUE);
gtk_init_check ();
return;
}
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*Supported GDK_DEBUG values:*");
g_test_trap_assert_stderr ("*Multiple values can be given, separated by : or space.*");
}
int
main (int argc, char *argv[])
{
@ -78,6 +95,7 @@ main (int argc, char *argv[])
g_test_add_func ("/display/bad-display", test_bad_display);
g_test_add_func ("/display/bad-display/subprocess/1", test_bad_display_subprocess1);
g_test_add_func ("/display/bad-display/subprocess/2", test_bad_display_subprocess2);
g_test_add_func ("/debug/help", test_debug_help);
return g_test_run ();
}

View File

@ -40,6 +40,14 @@ test_set_default (void)
g_assert_true (d == d2);
}
static void
test_display_basic (void)
{
GdkDisplay *d = gdk_display_get_default ();
g_assert_false (gdk_display_is_closed (d));
}
int
main (int argc, char *argv[])
{
@ -48,6 +56,7 @@ main (int argc, char *argv[])
/* Open default display */
gdk_display_open (NULL);
g_test_add_func ("/display/basic", test_display_basic);
g_test_add_func ("/displaymanager/basic", test_basic);
g_test_add_func ("/displaymanager/set-default", test_set_default);