From: Christian Dywan Date: Mon, 10 Sep 2012 22:38:09 +0000 (+0200) Subject: Fix build of unit tests: speed dial, hsts, bookmarks X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bae360e3f880a40d99e039bd42f1df7145f92038;p=midori Fix build of unit tests: speed dial, hsts, bookmarks --- diff --git a/katze/midori-hsts.vala b/katze/midori-hsts.vala index 989e95eb..76a800bc 100644 --- a/katze/midori-hsts.vala +++ b/katze/midori-hsts.vala @@ -22,10 +22,14 @@ namespace Midori { public Directive.from_header (string header) { var param_list = Soup.header_parse_param_list (header); + if (param_list == null) + return; + string? max_age = param_list.lookup ("max-age"); if (max_age != null) expires = new Soup.Date.from_now (max_age.to_int ()); - if (param_list.lookup_extended ("includeSubDomains", null, null)) + // if (param_list.lookup_extended ("includeSubDomains", null, null)) + if ("includeSubDomains" in header) sub_domains = true; Soup.header_free_param_list (param_list); } diff --git a/midori/midori-speeddial.vala b/midori/midori-speeddial.vala index 92f30dda..309f9f17 100644 --- a/midori/midori-speeddial.vala +++ b/midori/midori-speeddial.vala @@ -91,12 +91,12 @@ namespace Midori { foreach (string tile in keyfile.get_groups ()) { try { string img = keyfile.get_string (tile, "img"); + keyfile.remove_key (tile, "img"); string uri = keyfile.get_string (tile, "uri"); if (img != null && uri[0] != '\0' && uri[0] != '#') { uchar[] decoded = Base64.decode (img); FileUtils.set_data (build_thumbnail_path (uri), decoded); } - keyfile.remove_key (tile, "img"); } catch (GLib.Error img_error) { /* img and uri can be missing */ diff --git a/midori/sokoke.c b/midori/sokoke.c index ee3d4e4d..67841684 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -398,8 +398,9 @@ sokoke_prepare_command (const gchar* command, g_return_val_if_fail (command != NULL, FALSE); g_return_val_if_fail (argument != NULL, FALSE); - g_print ("Preparing command: %s %d %s %d\n", - command, quote_command, argument, quote_argument); + if (midori_debug ("paths")) + g_print ("Preparing command: %s %d %s %d\n", + command, quote_command, argument, quote_argument); { gchar* uri_format; diff --git a/midori/wscript_build b/midori/wscript_build index fb2ebef5..52c3337b 100644 --- a/midori/wscript_build +++ b/midori/wscript_build @@ -10,7 +10,7 @@ libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \ 'LIBNOTIFY WEBKIT JAVASCRIPTCOREGTK LIBXML X11 XSS WS2_32 HILDON' \ 'HILDON_FM GCR GRANITE ZEITGEIST' -if progressive or Options.commands['check']: +if progressive: obj = bld.new_task_gen ('cc', 'staticlib') obj.target = 'midori-core' obj.includes = '.. ../katze . ../toolbars' @@ -26,7 +26,6 @@ if progressive or Options.commands['check']: obj.packages += ' gtk+-2.0 webkit-1.0' bld.add_group () -if progressive: obj = bld.new_task_gen ('cc', 'program') obj.target = 'midori' obj.includes = '.. ../katze . ../panels' @@ -35,12 +34,3 @@ if progressive: obj.uselib_local = 'midori-core' if bld.env['WINRC']: obj.source += ' ../data/midori.rc' -else: - obj = bld.new_task_gen ('cc', 'program') - obj.target = 'midori' - obj.includes = '.. ../katze . ../panels ../toolbars' - obj.find_sources_in_dirs ('../katze . ../panels ../toolbars') - obj.add_marshal_file ('marshal.list', 'midori_cclosure_marshal') - obj.uselib = libs - if bld.env['WINRC']: - obj.source += ' ../data/midori.rc' diff --git a/tests/bookmarks.c b/tests/bookmarks.c index 68471646..eaf11dab 100644 --- a/tests/bookmarks.c +++ b/tests/bookmarks.c @@ -40,7 +40,7 @@ fixture_setup (BookmarksFixture* fixture, gchar *errmsg = NULL; fixture->db_bookmarks = katze_array_new (KATZE_TYPE_ARRAY); - db = midori_bookmarks_initialize (fixture->db_bookmarks, params->dbfile, &errmsg); + db = NULL; /* FIXME midori_bookmarks_initialize (fixture->db_bookmarks, params->dbfile, &errmsg); */ if (db == NULL) g_error ("Bookmarks couldn't be loaded: %s\n", errmsg); g_assert (errmsg == NULL); diff --git a/tests/hsts.vala b/tests/hsts.vala index a3306191..a71ec9da 100644 --- a/tests/hsts.vala +++ b/tests/hsts.vala @@ -8,6 +8,7 @@ See the file COPYING for the full license text. */ + static void http_hsts () { Midori.HSTS.Directive d; d = new Midori.HSTS.Directive.from_header ("max-age=31536000"); diff --git a/tests/magic-uri.c b/tests/magic-uri.c index d90e2b3f..f036feab 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -341,9 +341,9 @@ magic_uri_commands (void) for (j = 0; j < G_N_ELEMENTS (arguments); j++) { gchar* input = g_strconcat (commands[i].command, " ", arguments[j].command, NULL); - gchar* ce = commands[i].expected ? commands[i].expected + gchar* ce = commands[i].expected ? (gchar*)commands[i].expected : g_strconcat ("'", commands[i].command, "'", NULL); - gchar* ae = arguments[j].expected ? arguments[j].expected + gchar* ae = arguments[j].expected ? (gchar*)arguments[j].expected : (arguments[j].quote ? g_strconcat ("'", arguments[j].command, "'", NULL) : g_strdup (arguments[j].command)); gchar* expected = g_strconcat (ce, " ", ae, NULL); diff --git a/tests/speeddial.vala b/tests/speeddial.vala index 1da490da..00c49d1f 100644 --- a/tests/speeddial.vala +++ b/tests/speeddial.vala @@ -42,12 +42,18 @@ static void speeddial_load () { Katze.assert_str_equal (json, dial_data.keyfile.to_data (), dial_json.keyfile.to_data ()); Katze.assert_str_equal (json, dial_data.get_next_free_slot (), "Dial 2"); Katze.assert_str_equal (json, dial_json.get_next_free_slot (), "Dial 2"); + + dial_data.save_message ("speed_dial-save-rename s1 Lorem"); + Katze.assert_str_equal (data, dial_data.keyfile.get_string ("Dial 1", "title"), "Lorem"); + dial_data.save_message ("speed_dial-save-delete s1"); + Katze.assert_str_equal (data, dial_data.get_next_free_slot (), "Dial 1"); } void main (string[] args) { string temporary_cache = DirUtils.make_tmp ("cacheXXXXXX"); Environment.set_variable ("XDG_CACHE_HOME", temporary_cache, true); Test.init (ref args); + Midori.Paths.init (Midori.RuntimeMode.PRIVATE, null); Test.add_func ("/speeddial/load", speeddial_load); Test.run (); DirUtils.remove (temporary_cache); diff --git a/tests/wscript_build b/tests/wscript_build index 3ed6eecd..28b8c0c7 100644 --- a/tests/wscript_build +++ b/tests/wscript_build @@ -14,7 +14,7 @@ for test in tests: for fila in files: if fila[-2:] == '.c': source += ' ' + test + os.sep + fila - elif 'VALAC' in bld.env and file[-5:] == '.vala': + elif file[-5:] == '.vala': source += ' ' + test + os.sep + fila if not source: Utils.pprint ('RED', folder + ': No source files found') @@ -22,7 +22,7 @@ for test in tests: else: if test[-2:] == '.c': target = test[:-2] - elif 'VALAC' in bld.env and test[-5:] == '.vala': + elif test[-5:] == '.vala': target = test[:-5] else: continue @@ -34,7 +34,7 @@ for test in tests: obj.cflags = ['-DEXTENSION_PATH="' + os.path.abspath ('_build/default/extensions') + '"'] obj.source = source obj.vapi_dirs = '../midori ../katze' - obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 katze midori' + obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 katze midori midori-core' if bld.env['HAVE_GTK3']: obj.packages += ' gtk+-3.0 webkitgtk-3.0' else: