diff options
author | Diego Escalante Urrelo <diegoe@src.gnome.org> | 2008-09-29 13:53:03 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <diegoe@src.gnome.org> | 2008-09-29 13:53:03 +0800 |
commit | 17f0f1a53b2fab996b735c6d3dc395c07699983c (patch) | |
tree | a48e60cb884903554fefd85217e2b7035f67d5d6 /tests/testephysearchentry.c | |
parent | f550b712fc1f930080fc240e2a30c60cd231d36f (diff) | |
download | gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.tar gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.tar.gz gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.tar.bz2 gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.tar.lz gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.tar.xz gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.tar.zst gsoc2013-epiphany-17f0f1a53b2fab996b735c6d3dc395c07699983c.zip |
Reindent to 2 spaces and improve the existing tests
Add vim modelines to the files.
svn path=/trunk/; revision=8553
Diffstat (limited to 'tests/testephysearchentry.c')
-rw-r--r-- | tests/testephysearchentry.c | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/tests/testephysearchentry.c b/tests/testephysearchentry.c index 32bd725fe..63ddfbe10 100644 --- a/tests/testephysearchentry.c +++ b/tests/testephysearchentry.c @@ -1,3 +1,4 @@ +/* vim: set sw=2 ts=2 sts=2 et: */ /* * testephysearchentry.c * This file is part of Epiphany @@ -25,29 +26,54 @@ #include "ephy-icon-entry.h" #include <gtk/gtk.h> -GtkWidget *entry; +static void +test_entry_new (void) +{ + + EphySearchEntry *entry; + entry = EPHY_SEARCH_ENTRY (ephy_search_entry_new ()); + + g_assert (GTK_IS_WIDGET (entry)); + g_assert (EPHY_IS_ICON_ENTRY (entry)); +} static void test_entry_clear (void) { - const char *text; + const char *set = "test"; + const char *get = NULL; + GtkWidget *internal_entry; + + EphySearchEntry *entry; + entry = EPHY_SEARCH_ENTRY (ephy_search_entry_new ()); - ephy_search_entry_clear (EPHY_SEARCH_ENTRY (entry)); - text = gtk_entry_get_text (GTK_ENTRY (ephy_icon_entry_get_entry - (EPHY_ICON_ENTRY (entry)))); - g_assert_cmpstr (text, ==, ""); + internal_entry = ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (entry)); + + gtk_entry_set_text (GTK_ENTRY (internal_entry), set); + get = gtk_entry_get_text (GTK_ENTRY (internal_entry)); + + g_assert_cmpstr (set, ==, get); + + /* At this point, the text in the entry is either 'vanilla' or the + * contents of 'set' char* + */ + ephy_search_entry_clear (EPHY_SEARCH_ENTRY (entry)); + get = gtk_entry_get_text (GTK_ENTRY (internal_entry)); + + g_assert_cmpstr ("", ==, get); } int main (int argc, char *argv[]) { - gtk_test_init (&argc, &argv); - - entry = ephy_search_entry_new (); - gtk_entry_set_text (GTK_ENTRY (ephy_icon_entry_get_entry - (EPHY_ICON_ENTRY (entry))), "Test"); - - g_test_add_func ("/lib/widgets/ephy-search-entry/clear", test_entry_clear); - - return g_test_run (); + gtk_test_init (&argc, &argv); + + g_test_add_func ( + "/lib/widgets/ephy-search-entry/new", + test_entry_new); + g_test_add_func ( + "/lib/widgets/ephy-search-entry/clear", + test_entry_clear); + + return g_test_run (); } |