Commit a4ae29c3 authored by jmalonzo@webkit.org's avatar jmalonzo@webkit.org
Browse files

2009-03-20 Jan Michael Alonzo <jmalonzo@gmail.com>

        Reviewed by Holger Freyther.

        [GTK] Misc patches for WebKitWebHistoryItem
        https://bugs.webkit.org/show_bug.cgi?id=24493

        Added build support for build the WebKitWebHistoryItem unit test.

        * GNUmakefile.am:

2009-03-20  Jan Michael Alonzo  <jmalonzo@gmail.com>

        Reviewed by Holger Freyther.

        [GTK] Misc patches for WebKitWebHistoryItem
        https://bugs.webkit.org/show_bug.cgi?id=24493

        Add unit test for WebKitWebHistoryItem

        * tests/testwebhistoryitem.c: Added.
        (web_history_item_fixture_setup):
        (web_history_item_fixture_teardown):
        (test_webkit_web_history_item_get_data):
        (test_webkit_web_history_item_alternate_title):
        (main):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41866 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d740af6b
2009-03-20 Jan Michael Alonzo <jmalonzo@gmail.com>
Reviewed by Holger Freyther.
[GTK] Misc patches for WebKitWebHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=24493
Added build support for build the WebKitWebHistoryItem unit test.
* GNUmakefile.am:
2009-03-20 Jan Michael Alonzo <jmalonzo@gmail.com>
Reviewed by Holger Freyther.
......
......@@ -486,7 +486,8 @@ webkit_tests_ldadd = \
$(LIBSOUP_LIBS)
TEST_PROGS += Programs/unittests/testwebframe \
Programs/unittests/testwebbackforwardlist
Programs/unittests/testwebbackforwardlist \
Programs/unittests/testwebhistoryitem
# Add additional tests here
Programs_unittests_testwebframe_SOURCES = WebKit/gtk/tests/testwebframe.c
......@@ -497,6 +498,11 @@ Programs_unittests_testwebbackforwardlist_SOURCES = WebKit/gtk/tests/testwebback
Programs_unittests_testwebbackforwardlist_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testwebbackforwardlist_LDADD = $(webkit_tests_ldadd)
Programs_unittests_testwebhistoryitem_SOURCES = WebKit/gtk/tests/testwebhistoryitem.c
Programs_unittests_testwebhistoryitem_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testwebhistoryitem_LDADD = $(webkit_tests_ldadd)
# Autogenerated sources
BUILT_SOURCES := \
$(javascriptcore_built_sources) \
......
2009-03-20 Jan Michael Alonzo <jmalonzo@gmail.com>
Reviewed by Holger Freyther.
[GTK] Misc patches for WebKitWebHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=24493
Add unit test for WebKitWebHistoryItem
* tests/testwebhistoryitem.c: Added.
(web_history_item_fixture_setup):
(web_history_item_fixture_teardown):
(test_webkit_web_history_item_get_data):
(test_webkit_web_history_item_alternate_title):
(main):
2009-03-20 Jan Michael Alonzo <jmalonzo@gmail.com>
Reviewed by Holger Freyther.
......
/*
* Copyright (C) 2009 Jan Michael Alonzo
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <glib.h>
#include <gtk/gtk.h>
#include <webkit/webkit.h>
#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
typedef struct {
WebKitWebHistoryItem* item;
} WebHistoryItemFixture;
static void web_history_item_fixture_setup(WebHistoryItemFixture* fixture,
gconstpointer data)
{
fixture->item = webkit_web_history_item_new_with_data("http://example.com/", "Example1");
g_assert_cmpint(G_OBJECT(fixture->item)->ref_count, == , 2);
g_assert(fixture->item != NULL);
}
static void web_history_item_fixture_teardown(WebHistoryItemFixture* fixture,
gconstpointer data)
{
g_assert(fixture->item != NULL);
g_assert_cmpint(G_OBJECT(fixture->item)->ref_count, ==, 2);
g_object_unref(fixture->item);
g_assert_cmpint(G_OBJECT(fixture->item)->ref_count, ==, 1);
}
static void
test_webkit_web_history_item_get_data(WebHistoryItemFixture* fixture,
gconstpointer data)
{
g_assert_cmpstr(webkit_web_history_item_get_title(fixture->item), ==, "Example1");
g_assert_cmpstr(webkit_web_history_item_get_uri(fixture->item), ==, "http://example.com/");
}
static void
test_webkit_web_history_item_alternate_title(WebHistoryItemFixture* fixture,
gconstpointer data)
{
webkit_web_history_item_set_alternate_title(fixture->item, "Alternate title");
g_assert_cmpstr(webkit_web_history_item_get_alternate_title(fixture->item), ==, "Alternate title");
}
int main(int argc, char** argv)
{
g_thread_init(NULL);
gtk_test_init(&argc, &argv, NULL);
g_test_bug_base("https://bugs.webkit.org/");
g_test_add("/webkit/webhistoryitem/get_data",
WebHistoryItemFixture, 0, web_history_item_fixture_setup,
test_webkit_web_history_item_get_data, web_history_item_fixture_teardown);
g_test_add("/webkit/webhistoryitem/alternate_title",
WebHistoryItemFixture, 0, web_history_item_fixture_setup,
test_webkit_web_history_item_alternate_title, web_history_item_fixture_teardown);
return g_test_run ();
}
#else
int main(int argc, char** argv)
{
g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now.");
return 0;
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment