[maemo-commits] [maemo-commits] r12278 - in projects/haf/trunk/libhildonmime: . libhildonmime tests
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Jun 13 17:19:05 EEST 2007
- Previous message: [maemo-commits] r12277 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r12279 - projects/haf/trunk/osso-af-settings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: martyn Date: 2007-06-13 17:18:12 +0300 (Wed, 13 Jun 2007) New Revision: 12278 Modified: projects/haf/trunk/libhildonmime/ChangeLog projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c projects/haf/trunk/libhildonmime/tests/test-all.c projects/haf/trunk/libhildonmime/tests/test-mime-category.c projects/haf/trunk/libhildonmime/tests/test-mime-icon.c projects/haf/trunk/libhildonmime/tests/test-mime-patterns.c projects/haf/trunk/libhildonmime/tests/test-mime-types.c projects/haf/trunk/libhildonmime/tests/test-open.c projects/haf/trunk/libhildonmime/tests/test-service.c projects/haf/trunk/libhildonmime/tests/test-uri.c Log: Initiate GnomeVFS in all tests Modified: projects/haf/trunk/libhildonmime/ChangeLog =================================================================== --- projects/haf/trunk/libhildonmime/ChangeLog 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/ChangeLog 2007-06-13 14:18:12 UTC (rev 12278) @@ -1,3 +1,14 @@ +2007-06-13 Martyn Russell <martyn at imendio.com> + + * tests/test-all.c: (main): + * tests/test-mime-category.c: (main): + * tests/test-mime-icon.c: (main): + * tests/test-mime-patterns.c: (test_no_mime_type): + * tests/test-mime-types.c: (main): + * tests/test-open.c: (main): + * tests/test-service.c: (main): + * tests/test-uri.c: (main): Make sure we init and shutdown GnomeVFS. + 2007-06-07 Richard Hult <richard at imendio.com> * docs/hildon-uri-open-rev-1.txt: Modified: projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c =================================================================== --- projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/libhildonmime/hildon-uri.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -63,8 +63,8 @@ #define APP_LAUNCH_BANNER_METHOD "app_launch_banner" -#define DEBUG_MSG(x) -/* #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n"); */ +/* #define DEBUG_MSG(x) */ +#define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n"); /* The ID is the group name in the desktop file for this * action, the domain is the translation domain used for the @@ -1791,56 +1791,56 @@ action->scheme, default_action, default_action ? default_action->desktop_file : "", - action->desktop_file)) - - if (default_action && - default_action->desktop_file && - action->desktop_file) { - gchar *desktop_file1; - gchar *desktop_file2; - - /* Change all "/" to "-" since there may be some differences here */ - desktop_file1 = g_strdup (default_action->desktop_file); - g_strdelimit (desktop_file1, G_DIR_SEPARATOR_S, '-'); - desktop_file2 = g_strdup (action->desktop_file); - g_strdelimit (desktop_file2, G_DIR_SEPARATOR_S, '-'); - - /* Compare desktop files to know if this is the same - * action as the default action. - * - * We compare the desktop file and the method since - * these two are what the dbus service will use to - * identify what is done with the action. - */ - if (default_action->name && action->name && - default_action->method && action->method && - strcmp (desktop_file1, desktop_file2) == 0 && - strcmp (default_action->name, action->name) == 0 && - strcmp (default_action->method, action->method) == 0) { - equal = TRUE; - } + action->desktop_file)); - DEBUG_MSG (("URI: Checking desktop file is default:\n" - "\tfile1:'%s'\n" - "\tfile2:'%s'\n" - "\tname1:'%s'\n" - "\tname2:'%s'\n" - "\tmethod1:'%s'\n" - "\tmethod2:'%s'\n" - "\tEQUAL = %s", - desktop_file1, desktop_file2, - default_action->name, action->name, - default_action->method, action->method, - equal ? "YES" : "NO")) - - g_free (desktop_file1); - g_free (desktop_file2); + if (default_action && + default_action->desktop_file && + action->desktop_file) { + gchar *desktop_file1; + gchar *desktop_file2; + + /* Change all "/" to "-" since there may be some differences here */ + desktop_file1 = g_strdup (default_action->desktop_file); + g_strdelimit (desktop_file1, G_DIR_SEPARATOR_S, '-'); + desktop_file2 = g_strdup (action->desktop_file); + g_strdelimit (desktop_file2, G_DIR_SEPARATOR_S, '-'); + + /* Compare desktop files to know if this is the same + * action as the default action. + * + * We compare the desktop file and the method since + * these two are what the dbus service will use to + * identify what is done with the action. + */ + if (default_action->name && action->name && + default_action->method && action->method && + strcmp (desktop_file1, desktop_file2) == 0 && + strcmp (default_action->name, action->name) == 0 && + strcmp (default_action->method, action->method) == 0) { + equal = TRUE; } - + + DEBUG_MSG (("URI: Checking desktop file is default:\n" + "\tfile1:'%s'\n" + "\tfile2:'%s'\n" + "\tname1:'%s'\n" + "\tname2:'%s'\n" + "\tmethod1:'%s'\n" + "\tmethod2:'%s'\n" + "\tEQUAL = %s", + desktop_file1, desktop_file2, + default_action->name, action->name, + default_action->method, action->method, + equal ? "YES" : "NO")) + + g_free (desktop_file1); + g_free (desktop_file2); + } + if (default_action) { hildon_uri_action_unref (default_action); } - + return equal; } Modified: projects/haf/trunk/libhildonmime/tests/test-all.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-all.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-all.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -214,7 +214,7 @@ const gchar *action_name, const gchar *uri) { - GSList *l; + GSList *l; HildonURIAction *action; /* NOTE: uri is only used for the new API calls */ @@ -339,11 +339,18 @@ /* The browser should be the default for http. */ g_print ("For http\n"); - uri_str = "http://www.nokia.com"; + uri_str = "http://www.nokia.com/index.html"; actions = hildon_uri_get_actions_by_uri (uri_str, -1, NULL); - assert_int (g_slist_length (actions), 4); + assert_int (g_slist_length (actions), 3); /* The default. */ +#if 0 + { + HildonURIAction *action; + action = hildon_uri_get_default_action_by_uri (uri_str, NULL); + g_print ("*** default action is %p, %s\n", action, action ? hildon_uri_action_get_name (action):""); + } +#endif assert_bool (is_default_action (actions, "uri_link_open_link", uri_str)); /* Existing, non-default. */ @@ -606,6 +613,8 @@ GError *error = NULL; gboolean ret; + gnome_vfs_init (); + /* Use our custom data here. */ g_setenv ("XDG_DATA_DIRS", TEST_DATADIR, TRUE); g_setenv ("XDG_DATA_HOME", TEST_DATADIR "-local", TRUE); @@ -643,11 +652,6 @@ return 1; } - if (!gnome_vfs_init()) { - g_error ("Could not initialise GnomeVFS"); - return 1; - } - if (0) { test_get_mime_types (); test_get_actions (); Modified: projects/haf/trunk/libhildonmime/tests/test-mime-category.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-mime-category.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-mime-category.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -50,6 +50,8 @@ g_print ("The category is '%s' (%d)\n", str, category); } + gnome_vfs_shutdown (); + return 0; } Modified: projects/haf/trunk/libhildonmime/tests/test-mime-icon.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-mime-icon.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-mime-icon.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -38,6 +38,8 @@ return 1; } + gnome_vfs_init (); + file_info = NULL; if (argc > 2) { if (strcmp (argv[2], "dir") == 0) { @@ -59,6 +61,8 @@ if (file_info) { gnome_vfs_file_info_unref (file_info); } + + gnome_vfs_shutdown (); return 0; } Modified: projects/haf/trunk/libhildonmime/tests/test-mime-patterns.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-mime-patterns.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-mime-patterns.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -32,6 +32,8 @@ const gchar *mimetype; GSList *list; + gnome_vfs_init (); + mimetype = "doesntexistsmimetype/hgifff"; list = hildon_mime_patterns_get_for_mime_type (mimetype, &error); @@ -49,6 +51,8 @@ g_slist_foreach (list, (GFunc) g_free, NULL); g_slist_free (list); + gnome_vfs_shutdown (); + return -1; } Modified: projects/haf/trunk/libhildonmime/tests/test-mime-types.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-mime-types.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-mime-types.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -35,6 +35,8 @@ return 1; } + gnome_vfs_init (); + list = hildon_mime_application_get_mime_types (argv[1]); if (list) { g_print ("Supported mime types:\n"); @@ -46,5 +48,7 @@ g_print ("No supported mime types\n"); } + gnome_vfs_shutdown (); + return 0; } Modified: projects/haf/trunk/libhildonmime/tests/test-open.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-open.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-open.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -69,6 +69,8 @@ GMainLoop *main_loop; GOptionContext *context; gboolean success; + + gnome_vfs_init (); context = g_option_context_new ("- test the hildon-open API."); g_option_context_add_main_entries (context, entries, NULL); @@ -144,6 +146,8 @@ g_timeout_add (2000, (GSourceFunc) quit_cb, main_loop); g_main_loop_run (main_loop); g_main_loop_unref (main_loop); - + + gnome_vfs_shutdown (); + return EXIT_SUCCESS; } Modified: projects/haf/trunk/libhildonmime/tests/test-service.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-service.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-service.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -150,7 +150,7 @@ interface = argv[2]; path = argv[3]; method = argv[4]; - + dbus_error_init (&error); connection = dbus_bus_get (DBUS_BUS_SESSION, &error); Modified: projects/haf/trunk/libhildonmime/tests/test-uri.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-uri.c 2007-06-13 13:55:28 UTC (rev 12277) +++ projects/haf/trunk/libhildonmime/tests/test-uri.c 2007-06-13 14:18:12 UTC (rev 12278) @@ -472,6 +472,8 @@ } } + gnome_vfs_shutdown (); + return EXIT_SUCCESS; }
- Previous message: [maemo-commits] r12277 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r12279 - projects/haf/trunk/osso-af-settings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]