#include "gdbus-tests.h"
#include "gdbus-sessionbus.h"
+#if 0
+/* These tests are racy -- there is no guarantee about the order of data
+ * arriving over D-Bus.
+ *
+ * They're also a bit ridiculous -- GApplication was never meant to be
+ * abused in this way...
+ *
+ * We need new tests.
+ */
static gint outstanding_watches;
static GMainLoop *main_loop;
g_main_loop_unref (main_loop);
}
+static void
+test_remote_actions (void)
+{
+ GDBusConnection *c;
+
+ g_assert (outstanding_watches == 0);
+
+ session_bus_up ();
+ c = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+
+ main_loop = g_main_loop_new (NULL, 0);
+
+ /* spawn the master */
+ spawn ("got ./cmd 0\n"
+ "activate action1\n"
+ "change action2 1\n"
+ "exit status: 0\n", NULL,
+ "./cmd", NULL);
+
+ spawn ("actions quit new action1 action2\n"
+ "exit status: 0\n", NULL,
+ "./actions", "list", NULL);
+
+ spawn ("exit status: 0\n", NULL,
+ "./actions", "activate", NULL);
+
+ spawn ("exit status: 0\n", NULL,
+ "./actions", "set-state", NULL);
+
+ g_main_loop_run (main_loop);
+
+ g_object_unref (c);
+ session_bus_down ();
+
+ g_main_loop_unref (main_loop);
+}
+#endif
+
#if 0
/* Now that we register non-unique apps on the bus we need to fix the
* following test not to assume that it's safe to create multiple instances
}
static void
-test_actions (void)
+test_local_actions (void)
{
char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
gchar *argv[] = { binpath, NULL };
g_free (binpath);
}
+static void
+test_resource_path (void)
+{
+ GApplication *app;
+
+ app = g_application_new ("x.y.z", 0);
+ g_assert_cmpstr (g_application_get_resource_base_path (app), ==, "/x/y/z");
+
+ /* this should not change anything */
+ g_application_set_application_id (app, "a.b.c");
+ g_assert_cmpstr (g_application_get_resource_base_path (app), ==, "/x/y/z");
+
+ /* but this should... */
+ g_application_set_resource_base_path (app, "/x");
+ g_assert_cmpstr (g_application_get_resource_base_path (app), ==, "/x");
+
+ /* ... and this */
+ g_application_set_resource_base_path (app, NULL);
+ g_assert_cmpstr (g_application_get_resource_base_path (app), ==, NULL);
+
+ g_object_unref (app);
+
+ /* Make sure that overriding at construction time works properly */
+ app = g_object_new (G_TYPE_APPLICATION, "application-id", "x.y.z", "resource-base-path", "/a", NULL);
+ g_assert_cmpstr (g_application_get_resource_base_path (app), ==, "/a");
+ g_object_unref (app);
+
+ /* ... particularly if we override to NULL */
+ app = g_object_new (G_TYPE_APPLICATION, "application-id", "x.y.z", "resource-base-path", NULL, NULL);
+ g_assert_cmpstr (g_application_get_resource_base_path (app), ==, NULL);
+ g_object_unref (app);
+}
+
int
main (int argc, char **argv)
{
g_test_dbus_unset ();
g_test_add_func ("/gapplication/no-dbus", test_nodbus);
- g_test_add_func ("/gapplication/basic", basic);
+/* g_test_add_func ("/gapplication/basic", basic); */
g_test_add_func ("/gapplication/no-appid", test_noappid);
/* g_test_add_func ("/gapplication/non-unique", test_nonunique); */
g_test_add_func ("/gapplication/properties", properties);
g_test_add_func ("/gapplication/app-id", appid);
g_test_add_func ("/gapplication/quit", test_quit);
- g_test_add_func ("/gapplication/actions", test_actions);
+ g_test_add_func ("/gapplication/local-actions", test_local_actions);
+/* g_test_add_func ("/gapplication/remote-actions", test_remote_actions); */
g_test_add_func ("/gapplication/local-command-line", test_local_command_line);
- g_test_add_func ("/gapplication/remote-command-line", test_remote_command_line);
+/* g_test_add_func ("/gapplication/remote-command-line", test_remote_command_line); */
+ g_test_add_func ("/gapplication/resource-path", test_resource_path);
return g_test_run ();
}