[Xfce4-commits] <midori:master> Re-implement search engine handling in magic URI test

Christian Dywan noreply at xfce.org
Fri Feb 12 02:22:01 CET 2010


Updating branch refs/heads/master
         to ca3e86cbce43636f4c73eb37f3ad463b64cdee77 (commit)
       from f19412bc709a474045021d756542d1c2a1289056 (commit)

commit ca3e86cbce43636f4c73eb37f3ad463b64cdee77
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Feb 12 02:06:53 2010 +0100

    Re-implement search engine handling in magic URI test

 tests/magic-uri.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/tests/magic-uri.c b/tests/magic-uri.c
index 7bbd9fa..74ee243 100644
--- a/tests/magic-uri.c
+++ b/tests/magic-uri.c
@@ -37,6 +37,8 @@ test_input (const gchar* input,
             const gchar* expected)
 {
     static KatzeArray* search_engines = NULL;
+    gchar* uri;
+
     if (G_UNLIKELY (!search_engines))
     {
         KatzeItem* item;
@@ -54,7 +56,30 @@ test_input (const gchar* input,
         g_object_unref (item);
     }
 
-    gchar* uri = sokoke_magic_uri (input, search_engines, NULL);
+    uri = sokoke_magic_uri (input);
+    if (!uri)
+    {
+        gchar** parts;
+        gchar* keywords = NULL;
+        const gchar* search_uri = NULL;
+
+        /* Do we have a keyword and a string? */
+        parts = g_strsplit (input, " ", 2);
+        if (parts[0])
+        {
+            KatzeItem* item;
+            if ((item = katze_array_find_token (search_engines, parts[0])))
+            {
+                keywords = g_strdup (parts[1] ? parts[1] : "");
+                search_uri = katze_item_get_uri (item);
+            }
+        }
+        g_strfreev (parts);
+
+        uri = keywords ? sokoke_search_uri (search_uri, keywords) : NULL;
+
+        g_free (keywords);
+    }
     sokoke_assert_str_equal (input, uri, expected);
     g_free (uri);
 }



More information about the Xfce4-commits mailing list