summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Makefile.am.inc6
-rw-r--r--test/endless/run-tests.c1
-rw-r--r--test/endless/run-tests.h1
-rw-r--r--test/endless/test-application.c11
-rw-r--r--test/endless/test-hello.c59
-rw-r--r--test/endless/test-window.c6
-rw-r--r--test/smoke-tests/hello.c11
7 files changed, 9 insertions, 86 deletions
diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc
index e774c87..accb048 100644
--- a/test/Makefile.am.inc
+++ b/test/Makefile.am.inc
@@ -5,14 +5,12 @@ TEST_LIBS = @EOS_SDK_LIBS@ $(top_builddir)/libendless-@EOS_SDK_API_VERSION@.la
noinst_PROGRAMS = \
test/endless/run-tests \
- test/smoke-tests/hello \
$(NULL)
test_endless_run_tests_SOURCES = \
test/endless/run-tests.c \
test/endless/run-tests.h \
test/endless/test-init.c \
- test/endless/test-hello.c \
test/endless/test-application.c \
test/endless/test-page-manager.c \
test/endless/test-window.c \
@@ -23,10 +21,6 @@ test_endless_run_tests_SOURCES = \
test_endless_run_tests_CPPFLAGS = $(TEST_FLAGS)
test_endless_run_tests_LDADD = $(TEST_LIBS)
-test_smoke_tests_hello_SOURCES = test/smoke-tests/hello.c
-test_smoke_tests_hello_CPPFLAGS = $(TEST_FLAGS)
-test_smoke_tests_hello_LDADD = $(TEST_LIBS)
-
credits_resource_files = \
test/smoke-tests/images/test1.jpg \
test/smoke-tests/images/test2.jpg \
diff --git a/test/endless/run-tests.c b/test/endless/run-tests.c
index 2629932..7624ddc 100644
--- a/test/endless/run-tests.c
+++ b/test/endless/run-tests.c
@@ -102,7 +102,6 @@ main (int argc,
gtk_init (&argc, &argv);
add_init_tests ();
- add_hello_tests ();
add_application_tests ();
add_window_tests ();
add_page_manager_tests ();
diff --git a/test/endless/run-tests.h b/test/endless/run-tests.h
index a64046b..8ab5567 100644
--- a/test/endless/run-tests.h
+++ b/test/endless/run-tests.h
@@ -33,7 +33,6 @@ GtkWidget *container_find_descendant_with_type (GtkContainer *container,
GType type);
void add_init_tests (void);
-void add_hello_tests (void);
void add_application_tests (void);
void add_window_tests (void);
void add_page_manager_tests (void);
diff --git a/test/endless/test-application.c b/test/endless/test-application.c
index 13a53b4..9db6763 100644
--- a/test/endless/test-application.c
+++ b/test/endless/test-application.c
@@ -21,14 +21,14 @@ test_two_windows (EosApplication *app)
{
GtkWidget *win1 = eos_window_new (app);
- /* Unix-only test */
- if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR))
+ if (g_test_subprocess ())
{
GtkWidget *win2 = eos_window_new (app);
gtk_widget_destroy (win2);
- exit (0);
+ return;
}
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr (EXPECTED_TWO_WINDOW_ERRMSG);
@@ -155,12 +155,13 @@ test_config_dir_fails_if_not_writable (UniqueAppFixture *fixture,
set_writable (precreated_config_dir, FALSE);
- /* Unix-only test */
- if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR))
+ if (g_test_subprocess ())
{
GFile *config_dir = eos_application_get_config_dir (fixture->app);
+ return;
}
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr (EXPECTED_CONFIG_NOT_WRITABLE_ERRMSG);
diff --git a/test/endless/test-hello.c b/test/endless/test-hello.c
deleted file mode 100644
index 687f14d..0000000
--- a/test/endless/test-hello.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright 2013 Endless Mobile, Inc. */
-
-#include <stdlib.h>
-#include <glib.h>
-#include <endless/endless.h>
-
-#include "run-tests.h"
-
-#define EXPECTED_HELLO_STRING "Hello, world!\n"
-
-static void
-test_hello_stdout (void)
-{
- GError *error = NULL;
-
- /* Unix-only test */
- if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDOUT))
- {
- gboolean success = eos_hello_sample_function (NULL, &error);
- g_assert (success);
- g_assert_no_error (error);
- exit (0);
- }
-
- g_test_trap_assert_passed ();
- g_test_trap_assert_stdout (EXPECTED_HELLO_STRING);
-}
-
-static void
-test_hello_gfile (void)
-{
- GError *error = NULL;
- GFileIOStream *stream;
- GFile *file = g_file_new_tmp ("sdktestXXXXXX", &stream, &error);
- gboolean success;
- char *file_contents;
-
- g_assert_no_error (error);
- g_io_stream_close (G_IO_STREAM (stream), NULL, &error);
- g_assert_no_error (error);
-
- success = eos_hello_sample_function (file, &error);
- g_assert (success);
- g_assert_no_error (error);
-
- g_file_load_contents (file, NULL, &file_contents, NULL, NULL, &error);
- g_assert_no_error (error);
- g_assert_cmpstr (file_contents, ==, EXPECTED_HELLO_STRING);
-
- g_free (file_contents);
- g_object_unref (file);
-}
-
-void
-add_hello_tests (void)
-{
- g_test_add_func ("/hello/stdout", test_hello_stdout);
- g_test_add_func ("/hello/gfile", test_hello_gfile);
-}
diff --git a/test/endless/test-window.c b/test/endless/test-window.c
index a6fc28a..cb061b4 100644
--- a/test/endless/test-window.c
+++ b/test/endless/test-window.c
@@ -26,14 +26,14 @@ test_assign_application (GApplication *app)
static void
test_application_not_null (GApplication *app)
{
- /* Unix-only test */
- if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR))
+ if (g_test_subprocess ())
{
GtkWidget *win = eos_window_new (NULL);
gtk_widget_destroy (win);
- exit (0);
+ return;
}
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr (EXPECTED_NULL_APPLICATION_ERRMSG);
diff --git a/test/smoke-tests/hello.c b/test/smoke-tests/hello.c
deleted file mode 100644
index 4538835..0000000
--- a/test/smoke-tests/hello.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Copyright 2013 Endless Mobile, Inc. */
-
-#include <endless/endless.h>
-
-int
-main (int argc,
- char **argv)
-{
- eos_hello_sample_function (NULL, NULL);
- return 0;
-}