[glib] gapplication tests: test resource base path
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gapplication tests: test resource base path
- Date: Mon, 7 Jul 2014 18:47:02 +0000 (UTC)
commit 58250555224ffcd22be24b1da9025564090cdba0
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jul 4 19:18:40 2014 -0400
gapplication tests: test resource base path
Run some cases to make sure resource base path is behaving as we expect
it to.
https://bugzilla.gnome.org/show_bug.cgi?id=722092
gio/tests/gapplication.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/gapplication.c b/gio/tests/gapplication.c
index 69e4429..249aa6e 100644
--- a/gio/tests/gapplication.c
+++ b/gio/tests/gapplication.c
@@ -672,6 +672,39 @@ test_local_command_line (void)
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)
{
@@ -690,6 +723,7 @@ main (int argc, char **argv)
/* 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/resource-path", test_resource_path);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]