aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@src.gnome.org>2008-09-29 13:53:14 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2008-09-29 13:53:14 +0800
commit9557a60883d347029dbd29f433ab21eef2833ef1 (patch)
treedc1d721f86a38c0e3f727260f53011967218d06b
parent17f0f1a53b2fab996b735c6d3dc395c07699983c (diff)
downloadgsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.tar
gsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.tar.gz
gsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.tar.bz2
gsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.tar.lz
gsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.tar.xz
gsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.tar.zst
gsoc2013-epiphany-9557a60883d347029dbd29f433ab21eef2833ef1.zip
tephylocationentry.c: can_undo and can_redo tests
svn path=/trunk/; revision=8554
-rw-r--r--tests/testephylocationentry.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/testephylocationentry.c b/tests/testephylocationentry.c
index 85dbde84a..b840743c7 100644
--- a/tests/testephylocationentry.c
+++ b/tests/testephylocationentry.c
@@ -105,6 +105,41 @@ test_entry_get_location_empty (void)
g_assert_cmpstr ("", ==, get);
}
+static void
+test_entry_can_undo (void)
+{
+ const char *test = "test";
+
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+
+ g_assert_cmpint (ephy_location_entry_get_can_undo (entry), ==, FALSE);
+
+ /* Use gtk_* function or otherwise user_changed won't be correctly handled
+ * internally by the location entry (see editable_changed_cb and
+ * block_update) */
+ gtk_entry_set_text (GTK_ENTRY (ephy_location_entry_get_entry (entry)), test);
+ g_assert_cmpint (ephy_location_entry_get_can_undo (entry), ==, TRUE);
+}
+
+static void
+test_entry_can_redo (void)
+{
+ const char *test = "test";
+
+ EphyLocationEntry *entry;
+ entry = EPHY_LOCATION_ENTRY (ephy_location_entry_new ());
+ g_assert_cmpint (ephy_location_entry_get_can_redo (entry), ==, FALSE);
+
+ /* Can't redo, in this point we can UNdo */
+ ephy_location_entry_set_location (entry, test, NULL);
+ g_assert_cmpint (ephy_location_entry_get_can_redo (entry), ==, FALSE);
+
+ /* Reset should set redo to TRUE */
+ ephy_location_entry_reset (entry);
+ g_assert_cmpint (ephy_location_entry_get_can_redo (entry), ==, TRUE);
+}
+
int
main (int argc, char *argv[])
{
@@ -130,6 +165,12 @@ main (int argc, char *argv[])
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/can_undo",
+ test_entry_can_undo);
+ g_test_add_func (
+ "/lib/widgets/ephy-location-entry/can_redo",
+ test_entry_can_redo);
return g_test_run ();
}