summaryrefslogtreecommitdiff
path: root/test/test-window.c
diff options
context:
space:
mode:
authorP. F. Chimento <philip.chimento@gmail.com>2013-04-29 16:21:43 +0200
committerP. F. Chimento <philip.chimento@gmail.com>2013-04-30 09:51:59 +0200
commit06da78e1eaad8ffc4b1dfbfac1421093755e364a (patch)
tree9ec55ee73b2fea878c67118cc94aa6fe0abaa50e /test/test-window.c
parent449b4d8e8d7c907020665a7a64324f46de67a8bb (diff)
Crash on eos_window_new (NULL)
Creating a window that is not tied to an application should be a serious programming error. [#42]
Diffstat (limited to 'test/test-window.c')
-rw-r--r--test/test-window.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/test-window.c b/test/test-window.c
index 9127120..c7641bd 100644
--- a/test/test-window.c
+++ b/test/test-window.c
@@ -7,8 +7,8 @@
#include "run-tests.h"
#define EXPECTED_NULL_APPLICATION_ERRMSG \
- "In order to create a window, you must have an application for it to " \
- "connect to."
+ "*In order to create a window, you must have an application for it to " \
+ "connect to.*"
static void
test_assign_application (GApplication *app)
@@ -24,18 +24,18 @@ test_assign_application (GApplication *app)
static void
test_application_not_null (GApplication *app)
{
- GtkWidget *win;
-
- g_test_expect_message (TEST_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
- EXPECTED_NULL_APPLICATION_ERRMSG);
-
- win = eos_window_new (NULL);
+ /* Unix-only test */
+ if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR))
+ {
+ GtkWidget *win = eos_window_new (NULL);
+ gtk_widget_destroy (win);
+ exit (0);
+ }
- g_test_assert_expected_messages ();
+ g_test_trap_assert_failed ();
+ g_test_trap_assert_stderr (EXPECTED_NULL_APPLICATION_ERRMSG);
- gtk_widget_destroy (win);
- g_application_release (app);
- g_application_quit (app); /* Doesn't quit when win is destroyed */
+ g_application_quit (app); /* No window, so otherwise won't quit */
}
static void