[Xfce4-commits] <midori:master> Remove outdated and unmaintained unit tests

Christian Dywan noreply at xfce.org
Sun Jan 16 14:04:01 CET 2011


Updating branch refs/heads/master
         to cb52ab4fb420ec199102be86746e3bc50536541f (commit)
       from 75c81f21f02565f054aca9bf9b47bd0c4eb2e780 (commit)

commit cb52ab4fb420ec199102be86746e3bc50536541f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jan 16 13:40:25 2011 +0100

    Remove outdated and unmaintained unit tests

 tests/bookmarks.c  |  157 -------------------------
 tests/completion.c |  328 ----------------------------------------------------
 tests/history.c    |  221 -----------------------------------
 3 files changed, 0 insertions(+), 706 deletions(-)

diff --git a/tests/bookmarks.c b/tests/bookmarks.c
deleted file mode 100644
index b27138c..0000000
--- a/tests/bookmarks.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#if HAVE_CONFIG_H
-    #include <config.h>
-#endif
-
-#include "midori.h"
-#include "midori-bookmarks.h"
-
-static void
-bookmarks_panel_create (void)
-{
-    MidoriApp* app;
-    MidoriBookmarks* bookmarks;
-    gpointer value;
-
-    app = g_object_new (MIDORI_TYPE_APP, NULL);
-
-    bookmarks = g_object_new (MIDORI_TYPE_BOOKMARKS, NULL);
-    value = katze_object_get_object (bookmarks, "app");
-    g_assert (value == NULL);
-    gtk_widget_destroy (GTK_WIDGET (bookmarks));
-
-    bookmarks = g_object_new (MIDORI_TYPE_BOOKMARKS, "app", app, NULL);
-    value = katze_object_get_object (bookmarks, "app");
-    g_assert (value == app);
-    gtk_widget_destroy (GTK_WIDGET (bookmarks));
-
-    bookmarks = g_object_new (MIDORI_TYPE_BOOKMARKS, NULL);
-    g_object_set (bookmarks, "app", app, NULL);
-    value = katze_object_get_object (bookmarks, "app");
-    g_assert (value == app);
-    gtk_widget_destroy (GTK_WIDGET (bookmarks));
-}
-
-static KatzeItem*
-bookmark_new (const gchar* uri,
-              const gchar* title)
-{
-    return g_object_new (KATZE_TYPE_ITEM, "uri", uri, "name", title, NULL);
-}
-
-static KatzeArray*
-folder_new (const gchar* title)
-{
-    KatzeArray* folder;
-
-    folder = katze_array_new (KATZE_TYPE_ARRAY);
-    g_object_set (folder, "name", title, NULL);
-    return folder;
-}
-
-static void
-bookmarks_panel_fill (void)
-{
-    MidoriApp* app;
-    KatzeArray* array;
-    MidoriBookmarks* bookmarks;
-    GList* children;
-    GtkWidget* treeview;
-    GtkTreeModel* model;
-    GtkTreeIter iter;
-    KatzeItem* bookmark;
-    KatzeArray* folder;
-    guint n;
-    gpointer value;
-
-    app = g_object_new (MIDORI_TYPE_APP, NULL);
-    array = katze_array_new (KATZE_TYPE_ARRAY);
-    g_object_set (app, "bookmarks", array, NULL);
-    value = katze_object_get_object (app, "bookmarks");
-    g_assert (value == array);
-    bookmarks = g_object_new (MIDORI_TYPE_BOOKMARKS, "app", app, NULL);
-    children = gtk_container_get_children (GTK_CONTAINER (bookmarks));
-    treeview = g_list_nth_data (children, 0);
-    g_list_free (children);
-    g_assert (GTK_IS_TREE_VIEW (treeview));
-    model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
-    g_assert (GTK_IS_TREE_MODEL (model));
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-    bookmark = bookmark_new ("http://www.example.com", "Example");
-    katze_array_add_item (array, bookmark);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 1);
-    katze_array_remove_item (array, bookmark);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-    bookmark = bookmark_new ("http://www.example.com", "Example");
-    katze_array_add_item (array, bookmark);
-    folder = folder_new ("Empty");
-    katze_array_add_item (array, folder);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 2);
-    katze_array_remove_item (array, folder);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 1);
-    folder = folder_new ("Empty");
-    katze_array_add_item (array, folder);
-    folder = folder_new ("Kurioses");
-    katze_array_add_item (array, folder);
-    bookmark = bookmark_new ("http://www.ende.de", "Das Ende");
-    katze_array_add_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 3);
-    folder = folder_new ("Miscellaneous");
-    katze_array_add_item (array, folder);
-    gtk_tree_model_iter_nth_child (model, &iter, NULL, 3);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 0);
-    bookmark = bookmark_new ("http://thesaurus.reference.com/", "Thesaurus");
-    katze_array_add_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 1);
-    bookmark = bookmark_new ("http://en.wikipedia.org/", "Wikipedia");
-    katze_array_add_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 2);
-    katze_array_remove_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 1);
-    katze_array_remove_item (array, folder);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 3);
-    katze_array_add_item (array, folder);
-    /* katze_array_clear (folder);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 0); */
-    katze_array_clear (array);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-}
-
-int
-main (int    argc,
-      char** argv)
-{
-    /* libSoup uses threads, therefore if WebKit is built with libSoup
-       or Midori is using it, we need to initialize threads. */
-    if (!g_thread_supported ()) g_thread_init (NULL);
-    g_test_init (&argc, &argv, NULL);
-    gtk_init_check (&argc, &argv);
-
-    g_test_add_func ("/bookmarks/panel/create", bookmarks_panel_create);
-    g_test_add_func ("/bookmarks/panel/fill", bookmarks_panel_fill);
-
-    return g_test_run ();
-}
diff --git a/tests/completion.c b/tests/completion.c
deleted file mode 100644
index 26614db..0000000
--- a/tests/completion.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#if HAVE_CONFIG_H
-    #include <config.h>
-#endif
-
-#include "midori.h"
-
-/* This is a private function */
-GtkWidget*
-midori_location_action_entry_for_proxy (GtkWidget* proxy);
-
-static const gchar* compare_urls[] = {
- "http://en.wikipedia.org/wiki/Foul",
- "http://de.wikipedia.org/wiki/Düsseldorf",
- "http://de.wikipedia.org/wiki/Düsseldorf",
- "http://ja.wikipedia.org/wiki/若井はんじ・けんじ",
- "http://www.johannkönig.com",
- "http://şøñđëřżēıċħęŋđőmæîņĭśŧşũþėŗ.de",
- };
-
-static void
-completion_compare (void)
-{
-    const guint runs = 10000;
-    guint t;
-    gdouble elapsed = 0.0;
-
-    for (t = 0; t < runs; t++)
-    {
-        g_test_timer_start ();
-        guint i, j;
-        for (i = 0; i < G_N_ELEMENTS (compare_urls); i++)
-        {
-            gchar* url = katze_collfold (compare_urls[i]);
-            for (j = 0; j < G_N_ELEMENTS (compare_urls); j++)
-                katze_utf8_stristr (compare_urls[i], url);
-            g_free  (url);
-        }
-        elapsed += g_test_timer_elapsed ();
-    }
-    g_print ("%f seconds for comparison\n", elapsed / runs);
-}
-
-typedef struct
-{
-    const gchar* uri;
-    const gchar* name;
-} CompletionItem;
-
-static const CompletionItem items[] = {
- { "http://one.com", "One" },
- { "http://one.com/", "One" }, /* Duplicate */
- { "http://one.com/", "One One" }, /* Duplicate */
- { "http://one.com", "One Two" }, /* Duplicate */
- { "http://two.com", "Two" },
- { "http://three.com", "Three" },
- { "http://one.com/one/", "One off" },
- { "http://four.org", "One" },
- { "https://four.org", "Four" },
- { "ftp://four.org/", "ごオルゴ" },
- { "http://muenchen.de/weißwürste/", "Münchner Weißwürste" }, /* Umlauts */
- };
-static const guint items_n = 9;
-
-static void
-completion_count (void)
-{
-    MidoriLocationAction* action;
-    GtkWidget* toolitem;
-    GtkWidget* location_entry;
-    GtkWidget* entry;
-    GtkTreeModel* model;
-    guint n, i;
-
-    action = g_object_new (MIDORI_TYPE_LOCATION_ACTION, NULL);
-    toolitem = gtk_action_create_tool_item (GTK_ACTION (action));
-    location_entry = midori_location_action_entry_for_proxy (toolitem);
-    entry = gtk_bin_get_child (GTK_BIN (location_entry));
-    model = gtk_combo_box_get_model (GTK_COMBO_BOX (location_entry));
-
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-    midori_location_action_add_item (action, "http://one.com", NULL, "One");
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 1);
-    midori_location_action_clear (action);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-    for (i = 0; i < G_N_ELEMENTS (items); i++)
-        midori_location_action_add_item (action, items[i].uri,
-                                         NULL, items[i].name);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, items_n);
-    /* Adding the exact same items again shouldn't increase the total amount */
-    for (i = 0; i < G_N_ELEMENTS (items); i++)
-        midori_location_action_add_item (action, items[i].uri,
-                                         NULL, items[i].name);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, items_n);
-}
-
-/* Components to construct test addresses, the numbers take into account
-   how many items minus duplicates are unique. */
-static const gchar* protocols[] = {
- "http", "https", "ftp"
- };
-static const guint protocols_n = 3;
-static const gchar* subs[] = {
- "", "www.", "ww2.", "ftp."
- };
-static const guint subs_n = 4;
-static const gchar* slds[] = {
- "one", "two", "four", "six", "seven"/*, "Seven", "SEVEN"*/
- };
-static const guint slds_n = 5;
-static const gchar* tlds[] = {
- "com", "org", "net", "de", "co.uk", "com.au"/*, "Com.Au", "COM.AU"*/
- };
-static const guint tlds_n = 6;
-static const gchar* files[] = {
- "/", "/index.html", "/img.png", /*"/weißwürste",*/ "/images/"
- /*, "/Images", "/IMAGES/"*/
- };
-static const guint files_n = 4;
-
-static const gchar* inputs[] = {
- "http://www.one.com/index", "http://two.de/images", "http://six.com.au/img"/*,
- "http://muenchen.de/weißwürste/"*/
- };
-static const gchar* additions[] = {
- "http://www.one.com/invention", "http://two.de/island", "http://six.com.au/ish"
- };
-
-static void location_action_fill (MidoriLocationAction* action)
-{
-    guint i, j, k, l, m;
-
-    for (i = 0; i < G_N_ELEMENTS (protocols); i++)
-        for (j = 0; j < G_N_ELEMENTS (subs); j++)
-            for (k = 0; k < G_N_ELEMENTS (slds); k++)
-                for (l = 0; l < G_N_ELEMENTS (tlds); l++)
-                    for (m = 0; m < G_N_ELEMENTS (files); m++)
-                    {
-                        gchar* uri = g_strdup_printf ("%s://%s%s.%s%s",
-                            protocols[i], subs[j], slds[k], tlds[l], files[m]);
-                        midori_location_action_add_item (action, uri, NULL, uri);
-                        g_free (uri);
-                    }
-}
-
-static void
-completion_fill (void)
-{
-    MidoriLocationAction* action;
-    GtkWidget* toolitem;
-    GtkWidget* location_entry;
-    GtkWidget* entry;
-    GtkTreeModel* model;
-    guint i, items_added, items_added_effective, n;
-    gdouble elapsed;
-
-    action = g_object_new (MIDORI_TYPE_LOCATION_ACTION, NULL);
-    toolitem = gtk_action_create_tool_item (GTK_ACTION (action));
-    location_entry = midori_location_action_entry_for_proxy (toolitem);
-    entry = gtk_bin_get_child (GTK_BIN (location_entry));
-
-    g_print ("...\n");
-
-    items_added = G_N_ELEMENTS (protocols) * G_N_ELEMENTS (subs)
-        * G_N_ELEMENTS (slds) * G_N_ELEMENTS (tlds) * G_N_ELEMENTS (files);
-    items_added_effective = protocols_n * subs_n * slds_n * tlds_n * files_n;
-    g_print ("Adding %d items, effectively %d items:\n",
-             items_added, items_added_effective);
-
-    /* Since adding items when the action is frozen is very fast,
-       we run it 5 times and take the average time. */
-    elapsed = 0.0;
-    for (i = 0; i < 5; i++)
-    {
-        midori_location_action_clear (action);
-        midori_location_action_freeze (action);
-        g_test_timer_start ();
-        location_action_fill (action);
-        elapsed += g_test_timer_elapsed ();
-        midori_location_action_thaw (action);
-    }
-    model = gtk_combo_box_get_model (GTK_COMBO_BOX (location_entry));
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, items_added_effective);
-    g_print ("%f seconds, the action is frozen\n", elapsed / 5.0);
-
-    midori_location_action_clear (action);
-    g_test_timer_start ();
-    location_action_fill (action);
-    elapsed = g_test_timer_elapsed ();
-    model = gtk_combo_box_get_model (GTK_COMBO_BOX (location_entry));
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, items_added_effective);
-    g_print ("%f seconds, the action updates normally\n", elapsed);
-
-    /* We don't clear the action intentionally in order to see
-       how long adding only duplicates takes. */
-    g_test_timer_start ();
-    location_action_fill (action);
-    elapsed = g_test_timer_elapsed ();
-    model = gtk_combo_box_get_model (GTK_COMBO_BOX (location_entry));
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, items_added_effective);
-    g_print ("%f seconds, adding exact duplicates\n", elapsed);
-
-    g_print ("...");
-}
-
-static guint matches = 0;
-static guint matches_expected = 0;
-
-static gboolean
-entry_completion_insert_prefix_cb (GtkEntryCompletion*   completion,
-                                   const gchar*          prefix,
-                                   MidoriLocationAction* action)
-{
-    GtkWidget* entry = gtk_entry_completion_get_entry (completion);
-    const gchar* text = gtk_entry_get_text (GTK_ENTRY (entry));
-
-    if (!g_strrstr (prefix, text))
-        g_print ("Match failed, input: %s, result: %s\n",
-                 text, prefix);
-    g_assert (g_strrstr (prefix, text));
-    midori_location_action_delete_item_from_uri (action, text);
-    midori_location_action_add_uri (action, text);
-
-    matches++;
-
-    return FALSE;
-}
-
-static void
-completion_match (void)
-{
-    MidoriLocationAction* action;
-    GtkWidget* toolitem;
-    GtkWidget* location_entry;
-    GtkWidget* entry;
-    GtkEntryCompletion* completion;
-    guint i;
-
-    action = g_object_new (MIDORI_TYPE_LOCATION_ACTION, NULL);
-
-    midori_location_action_freeze (action);
-    location_action_fill (action);
-    midori_location_action_thaw (action);
-
-    toolitem = gtk_action_create_tool_item (GTK_ACTION (action));
-    location_entry = midori_location_action_entry_for_proxy (toolitem);
-    entry = gtk_bin_get_child (GTK_BIN (location_entry));
-    completion = gtk_entry_get_completion (GTK_ENTRY (entry));
-    g_signal_connect (completion, "insert-prefix",
-                      G_CALLBACK (entry_completion_insert_prefix_cb), action);
-    gtk_entry_completion_set_inline_completion (completion, TRUE);
-    gtk_entry_completion_set_popup_single_match (completion, FALSE);
-
-    for (i = 0; i < G_N_ELEMENTS (inputs); i++)
-    {
-        matches_expected++;
-        gtk_entry_set_text (GTK_ENTRY (entry), inputs[i]);
-        gtk_entry_completion_complete (completion);
-        gtk_entry_completion_insert_prefix (completion);
-        if (matches != matches_expected)
-            g_print ("Match failed, input: %s, result: %s\n",
-                inputs[i], gtk_entry_get_text (GTK_ENTRY (entry)));
-        g_assert_cmpint (matches, ==, matches_expected);
-    }
-    for (i = 0; i < G_N_ELEMENTS (additions); i++)
-    {
-        midori_location_action_add_uri (action, additions[i]);
-        midori_location_action_delete_item_from_uri (action, additions[i]);
-        midori_location_action_add_uri (action, additions[i]);
-    }
-    for (i = 0; i < G_N_ELEMENTS (inputs); i++)
-    {
-        matches_expected++;
-        gtk_entry_set_text (GTK_ENTRY (entry), inputs[i]);
-        gtk_entry_completion_complete (completion);
-        gtk_entry_completion_insert_prefix (completion);
-        if (matches != matches_expected)
-            g_print ("Match failed, input: %s, result: %s\n",
-                inputs[i], gtk_entry_get_text (GTK_ENTRY (entry)));
-        g_assert_cmpint (matches, ==, matches_expected);
-    }
-    for (i = 0; i < G_N_ELEMENTS (additions); i++)
-    {
-        matches_expected++;
-        gtk_entry_set_text (GTK_ENTRY (entry), additions[i]);
-        gtk_entry_completion_complete (completion);
-        gtk_entry_completion_insert_prefix (completion);
-        if (matches != matches_expected)
-            g_print ("Match failed, input: %s, result: %s\n",
-                additions[i], gtk_entry_get_text (GTK_ENTRY (entry)));
-        g_assert_cmpint (matches, ==, matches_expected);
-    }
-}
-
-int
-main (int    argc,
-      char** argv)
-{
-    /* libSoup uses threads, so we need to initialize threads. */
-    if (!g_thread_supported ()) g_thread_init (NULL);
-    g_test_init (&argc, &argv, NULL);
-    gtk_init_check (&argc, &argv);
-
-    g_test_add_func ("/completion/compare", completion_compare);
-    g_test_add_func ("/completion/count", completion_count);
-    g_test_add_func ("/completion/fill", completion_fill);
-    g_test_add_func ("/completion/match", completion_match);
-
-    return g_test_run ();
-}
diff --git a/tests/history.c b/tests/history.c
deleted file mode 100644
index dfc8348..0000000
--- a/tests/history.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#if HAVE_CONFIG_H
-    #include <config.h>
-#endif
-
-#include "midori.h"
-#include "midori-history.h"
-#include "sokoke.h"
-
-static void
-history_panel_create (void)
-{
-    MidoriApp* app;
-    MidoriHistory* history;
-    gpointer value;
-
-    app = g_object_new (MIDORI_TYPE_APP, NULL);
-
-    history = g_object_new (MIDORI_TYPE_HISTORY, NULL);
-    value = katze_object_get_object (history, "app");
-    g_assert (value == NULL);
-    gtk_widget_destroy (GTK_WIDGET (history));
-
-    history = g_object_new (MIDORI_TYPE_HISTORY, "app", app, NULL);
-    value = katze_object_get_object (history, "app");
-    g_assert (value == app);
-    gtk_widget_destroy (GTK_WIDGET (history));
-
-    history = g_object_new (MIDORI_TYPE_HISTORY, NULL);
-    g_object_set (history, "app", app, NULL);
-    value = katze_object_get_object (history, "app");
-    g_assert (value == app);
-    gtk_widget_destroy (GTK_WIDGET (history));
-}
-
-static KatzeItem*
-bookmark_new (const gchar* uri,
-              const gchar* title)
-{
-    return g_object_new (KATZE_TYPE_ITEM, "uri", uri, "name", title, NULL);
-}
-
-static KatzeArray*
-folder_new (const gchar* title)
-{
-    KatzeArray* folder;
-
-    folder = katze_array_new (KATZE_TYPE_ARRAY);
-    g_object_set (folder, "name", title, NULL);
-    return folder;
-}
-
-static void
-history_panel_fill (void)
-{
-    MidoriApp* app;
-    KatzeArray* array;
-    MidoriHistory* history;
-    GList* children;
-    GtkWidget* treeview;
-    GtkTreeModel* model;
-    GtkTreeIter iter;
-    KatzeItem* bookmark;
-    KatzeArray* folder;
-    guint n;
-    gpointer value;
-
-    app = g_object_new (MIDORI_TYPE_APP, NULL);
-    array = katze_array_new (KATZE_TYPE_ARRAY);
-    g_object_set (app, "history", array, NULL);
-    value = katze_object_get_object (app, "history");
-    g_assert (value == array);
-    history = g_object_new (MIDORI_TYPE_HISTORY, "app", app, NULL);
-    children = gtk_container_get_children (GTK_CONTAINER (history));
-    treeview = g_list_nth_data (children, 1);
-    g_list_free (children);
-    g_assert (GTK_IS_TREE_VIEW (treeview));
-    model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
-    g_assert (GTK_IS_TREE_MODEL (model));
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-    bookmark = bookmark_new ("http://www.example.com", "Example");
-    katze_array_add_item (array, bookmark);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 1);
-    katze_array_remove_item (array, bookmark);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-    bookmark = bookmark_new ("http://www.example.com", "Example");
-    katze_array_add_item (array, bookmark);
-    folder = folder_new ("Empty");
-    katze_array_add_item (array, folder);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 2);
-    katze_array_remove_item (array, folder);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 1);
-    folder = folder_new ("Empty");
-    katze_array_add_item (array, folder);
-    folder = folder_new ("Kurioses");
-    katze_array_add_item (array, folder);
-    bookmark = bookmark_new ("http://www.ende.de", "Das Ende");
-    katze_array_add_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 3);
-    folder = folder_new ("Miscellaneous");
-    katze_array_add_item (array, folder);
-    gtk_tree_model_iter_nth_child (model, &iter, NULL, 3);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 0);
-    bookmark = bookmark_new ("http://thesaurus.reference.com/", "Thesaurus");
-    katze_array_add_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 1);
-    bookmark = bookmark_new ("http://en.wikipedia.org/", "Wikipedia");
-    katze_array_add_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 2);
-    katze_array_remove_item (folder, bookmark);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 1);
-    katze_array_remove_item (array, folder);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 3);
-    katze_array_add_item (array, folder);
-    /* katze_array_clear (folder);
-    n = gtk_tree_model_iter_n_children (model, &iter);
-    g_assert_cmpint (n, ==, 0); */
-    katze_array_clear (array);
-    n = gtk_tree_model_iter_n_children (model, NULL);
-    g_assert_cmpint (n, ==, 0);
-}
-
-static void
-notify_load_status_cb (GtkWidget*  view,
-                       GParamSpec* pspec,
-                       guint*      done)
-{
-    MidoriLoadStatus status;
-
-    status = midori_view_get_load_status (MIDORI_VIEW (view));
-    if (*done == 2 && status == MIDORI_LOAD_COMMITTED)
-        *done = 1;
-    else if (*done == 1 && status == MIDORI_LOAD_FINISHED)
-        *done = 0;
-}
-
-static void
-history_browser_add (void)
-{
-    MidoriBrowser* browser;
-    MidoriWebSettings* settings;
-    KatzeArray* array;
-    GtkWidget* view;
-    guint done;
-    KatzeItem* date;
-    gsize i;
-    GtkActionGroup* action_group;
-    GtkAction* action;
-
-    browser = midori_browser_new ();
-    settings = midori_web_settings_new ();
-    array = katze_array_new (KATZE_TYPE_ARRAY);
-    g_object_set (browser, "settings", settings, "history", array, NULL);
-    view = midori_view_new (NULL);
-    midori_browser_add_tab (browser, view);
-    midori_view_set_uri (MIDORI_VIEW (view),
-        "data:text/html;charset=utf-8,<title>Test</title>Test");
-    g_signal_connect (view, "notify::load-status",
-        G_CALLBACK (notify_load_status_cb), &done);
-    done = 2;
-    while (done)
-        gtk_main_iteration ();
-    g_assert_cmpint (katze_array_get_length (array), ==, 1);
-    date = katze_array_get_nth_item (array, 0);
-    g_assert_cmpint (katze_array_get_length (KATZE_ARRAY (date)), ==, 1);
-    i = 0;
-    gtk_widget_show (view);
-    midori_browser_set_current_tab (browser, view);
-    g_assert (midori_browser_get_current_tab (browser) == view);
-    done = 2;
-    action_group = midori_browser_get_action_group (browser);
-    action = gtk_action_group_get_action (action_group, "Location");
-    midori_location_action_set_uri (MIDORI_LOCATION_ACTION (action),
-        "data:text/html;charset=utf-8,<title>Test</title>Test");
-    g_signal_emit_by_name (action, "submit-uri",
-        "data:text/html;charset=utf-8,<title>Test</title>Test", FALSE);
-    while (done)
-        gtk_main_iteration ();
-    g_assert_cmpint (katze_array_get_length (array), ==, 1);
-    date = katze_array_get_nth_item (array, 0);
-    g_assert_cmpint (katze_array_get_length (KATZE_ARRAY (date)), ==, 1);
-    i = 0;
-}
-
-int
-main (int    argc,
-      char** argv)
-{
-    /* libSoup uses threads, so we need to initialize threads. */
-    if (!g_thread_supported ()) g_thread_init (NULL);
-    g_test_init (&argc, &argv, NULL);
-    gtk_init_check (&argc, &argv);
-    sokoke_register_stock_items ();
-
-    g_test_add_func ("/history/panel/create", history_panel_create);
-    g_test_add_func ("/history/panel/fill", history_panel_fill);
-    g_test_add_func ("/history/browser/add", history_browser_add);
-
-    return g_test_run ();
-}



More information about the Xfce4-commits mailing list