epiphany r8553 - trunk/tests
- From: diegoe svn gnome org
- To: svn-commits-list gnome org
- Subject: epiphany r8553 - trunk/tests
- Date: Mon, 29 Sep 2008 05:53:03 +0000 (UTC)
Author: diegoe
Date: Mon Sep 29 05:53:03 2008
New Revision: 8553
URL: http://svn.gnome.org/viewvc/epiphany?rev=8553&view=rev
Log:
Reindent to 2 spaces and improve the existing tests
Add vim modelines to the files.
Modified:
trunk/tests/testephyiconentry.c
trunk/tests/testephylocationentry.c
trunk/tests/testephysearchentry.c
Modified: trunk/tests/testephyiconentry.c
==============================================================================
--- trunk/tests/testephyiconentry.c (original)
+++ trunk/tests/testephyiconentry.c Mon Sep 29 05:53:03 2008
@@ -1,3 +1,4 @@
+/* vim: set sw=2 ts=2 sts=2 et: */
/*
* testephyiconentry.c
* This file is part of Epiphany
@@ -24,54 +25,74 @@
#include "ephy-icon-entry.h"
#include <gtk/gtk.h>
-GtkWidget *entry;
+static void
+test_entry_new (void)
+{
+ GtkWidget *entry;
+
+ entry = ephy_icon_entry_new ();
+
+ g_assert (GTK_IS_WIDGET (entry));
+ g_assert (EPHY_IS_ICON_ENTRY (entry));
+}
static void
test_entry_pack_widget (void)
{
- GtkWidget *first;
- GtkWidget *last;
- GList *hbox = NULL;
- GList *list = NULL;
- GList *l = NULL;
-
- first = gtk_button_new ();
- last = gtk_entry_new ();
-
- /* Add a widget to the start */
- ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (entry), first, TRUE);
- /* Add a widget to the end */
- ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (entry), last, FALSE);
-
- /* The first children is an hbox */
- hbox = gtk_container_get_children (GTK_CONTAINER (entry));
- list = gtk_container_get_children (GTK_CONTAINER (hbox->data));
- g_list_free (hbox);
-
- g_assert (list);
-
- /* Remember inside the hbox there's a GtkEntry + our widgets */
- g_assert_cmpuint (g_list_length (list), ==, 3);
-
- /* Get the first one */
- l = g_list_nth (list, 0);
- g_assert (l);
- g_assert (GTK_IS_BUTTON (l->data));
-
- /* Get the last one */
- l = g_list_nth (list, 2);
- g_assert (l);
- g_assert (GTK_IS_ENTRY (l->data));
+ GtkWidget *entry;
+
+ GtkWidget *first;
+ GtkWidget *last;
+
+ GList *hbox = NULL;
+ GList *list = NULL;
+ GList *l = NULL;
+
+ entry = ephy_icon_entry_new ();
+
+ first = gtk_button_new ();
+ last = gtk_entry_new ();
- g_list_free (list);
- g_list_free (l);
+ /* Add a widget to the start */
+ ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (entry), first, TRUE);
+ /* Add a widget to the end */
+ ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (entry), last, FALSE);
+
+ /* The first children is an hbox */
+ hbox = gtk_container_get_children (GTK_CONTAINER (entry));
+ list = gtk_container_get_children (GTK_CONTAINER (hbox->data));
+ g_list_free (hbox);
+
+ g_assert (list);
+
+ /* Remember inside the hbox there's a GtkEntry + our widgets */
+ g_assert_cmpuint (g_list_length (list), ==, 3);
+
+ /* Get the first one */
+ l = g_list_nth (list, 0);
+ g_assert (l);
+ g_assert (GTK_IS_BUTTON (l->data));
+
+ /* Get the last one */
+ l = g_list_nth (list, 2);
+ g_assert (l);
+ g_assert (GTK_IS_ENTRY (l->data));
+
+ g_list_free (list);
+ g_list_free (l);
}
static void
test_entry_get_entry (void)
{
- g_assert (GTK_IS_ENTRY (
- ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (entry))));
+ GtkWidget *internal;
+
+ GtkWidget *entry;
+
+ entry = ephy_icon_entry_new ();
+ internal = ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (entry));
+
+ g_assert (GTK_IS_ENTRY (internal));
}
int
Modified: trunk/tests/testephylocationentry.c
==============================================================================
--- trunk/tests/testephylocationentry.c (original)
+++ trunk/tests/testephylocationentry.c Mon Sep 29 05:53:03 2008
@@ -1,3 +1,4 @@
+/* vim: set sw=2 ts=2 sts=2 et: */
/*
* testephylocationentry.c
* This file is part of Epiphany
@@ -26,38 +27,37 @@
static void
test_entry_new (void)
{
- GtkWidget *entry;
- entry = ephy_location_entry_new ();
+ GtkWidget *entry;
+ entry = ephy_location_entry_new ();
- g_assert (GTK_IS_WIDGET (entry));
- g_assert (EPHY_IS_LOCATION_ENTRY (entry));
+ g_assert (GTK_IS_WIDGET (entry));
+ g_assert (EPHY_IS_LOCATION_ENTRY (entry));
}
static void
test_entry_get_entry (void)
{
- EphyLocationEntry *entry;
- entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
- g_assert (GTK_IS_ENTRY (
- ephy_location_entry_get_entry (entry)));
+ g_assert (GTK_IS_ENTRY (ephy_location_entry_get_entry (entry)));
}
static void
test_entry_set_location (void)
{
- const char *set = "test";
- const char *null;
- const char *get;
-
- EphyLocationEntry *entry;
- entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
-
- null = ephy_location_entry_get_location (entry);
-
- ephy_location_entry_set_location (entry, set, NULL);
- get = ephy_location_entry_get_location (entry);
- g_assert_cmpstr (set, ==, get);
+ const char *set = "test";
+ const char *null;
+ const char *get;
+
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+
+ null = ephy_location_entry_get_location (entry);
+
+ ephy_location_entry_set_location (entry, set, NULL);
+ get = ephy_location_entry_get_location (entry);
+ g_assert_cmpstr (set, ==, get);
}
/*
@@ -67,69 +67,69 @@
static void
test_entry_set_location_null (void)
{
- const char *set = "test";
- const char *get;
+ const char *set = "test";
+ const char *get;
- EphyLocationEntry *entry;
- entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
- ephy_location_entry_set_location (entry, NULL, NULL);
- get = ephy_location_entry_get_location (entry);
- g_assert_cmpstr (set, ==, get);
+ ephy_location_entry_set_location (entry, NULL, NULL);
+ get = ephy_location_entry_get_location (entry);
+ g_assert_cmpstr (set, ==, get);
}
*/
static void
test_entry_get_location (void)
{
- const char *set = "test";
- const char *get;
+ const char *set = "test";
+ const char *get;
- EphyLocationEntry *entry;
- entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
- ephy_location_entry_set_location (entry, set, NULL);
- get = ephy_location_entry_get_location (entry);
- g_assert_cmpstr (set, ==, get);
+ ephy_location_entry_set_location (entry, set, NULL);
+ get = ephy_location_entry_get_location (entry);
+ g_assert_cmpstr (set, ==, get);
}
static void
test_entry_get_location_empty (void)
{
- const char *get;
+ const char *get;
- EphyLocationEntry *entry;
- entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
- get = ephy_location_entry_get_location (entry);
- g_assert_cmpstr ("", ==, get);
+ get = ephy_location_entry_get_location (entry);
+ g_assert_cmpstr ("", ==, get);
}
int
main (int argc, char *argv[])
{
- gtk_test_init (&argc, &argv);
+ gtk_test_init (&argc, &argv);
- g_test_add_func (
- "/lib/widgets/ephy-location-entry/new",
- test_entry_new);
- g_test_add_func (
- "/lib/widgets/ephy-location-entry/get_entry",
- test_entry_get_entry);
- g_test_add_func (
- "/lib/widgets/ephy-location-entry/set_location",
- test_entry_set_location);
- g_test_add_func (
- "/lib/widgets/ephy-location-entry/get_location",
- test_entry_get_location);
- /*
- g_test_add_func (
- "/lib/widgets/ephy-location-entry/set_location_null",
- test_entry_set_location_null);
- */
- g_test_add_func (
- "/lib/widgets/ephy-location-entry/get_location_empty",
- test_entry_get_location_empty);
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/new",
+ test_entry_new);
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/get_entry",
+ test_entry_get_entry);
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/set_location",
+ test_entry_set_location);
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/get_location",
+ test_entry_get_location);
+ /*
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/set_location_null",
+ test_entry_set_location_null);
+ */
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/get_location_empty",
+ test_entry_get_location_empty);
- return g_test_run ();
+ return g_test_run ();
}
Modified: trunk/tests/testephysearchentry.c
==============================================================================
--- trunk/tests/testephysearchentry.c (original)
+++ trunk/tests/testephysearchentry.c Mon Sep 29 05:53:03 2008
@@ -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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]