[gnome-builder] tests: improve navigation-list tests.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] tests: improve navigation-list tests.
- Date: Wed, 24 Sep 2014 08:46:00 +0000 (UTC)
commit a2b8a313e7f56d35a6d4ae215208cd86aef4eca0
Author: Christian Hergert <christian hergert me>
Date: Wed Sep 24 01:45:49 2014 -0700
tests: improve navigation-list tests.
tests/test-navigation-list.c | 40 +++++++++++++++++++++++++++++++++-------
1 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/tests/test-navigation-list.c b/tests/test-navigation-list.c
index 608a473..922a742 100644
--- a/tests/test-navigation-list.c
+++ b/tests/test-navigation-list.c
@@ -2,24 +2,50 @@
#include "gb-navigation-item.h"
static void
-test_navigation_list_depth (void)
+test_navigation_list_basic (void)
{
GbNavigationList *list;
+ GbNavigationItem *item;
guint i;
-
+
list = gb_navigation_list_new ();
-
+
g_assert_cmpint (0, ==, gb_navigation_list_get_depth (list));
-
+
for (i = 0; i < 32; i++)
{
- GbNavigationItem *item;
-
item = gb_navigation_item_new ("test item");
gb_navigation_list_append (list, item);
g_assert (item == gb_navigation_list_get_current_item (list));
g_assert_cmpint (i + 1, ==, gb_navigation_list_get_depth (list));
+ g_assert_cmpint (0, ==, gb_navigation_list_get_can_go_forward (list));
+ g_assert_cmpint ((i>0), ==, gb_navigation_list_get_can_go_backward (list));
+ }
+
+ item = gb_navigation_item_new ("test item");
+ gb_navigation_list_append (list, item);
+ g_assert (item == gb_navigation_list_get_current_item (list));
+ g_assert_cmpint (32, ==, gb_navigation_list_get_depth (list));
+
+ for (i = 0; i < 31; i++)
+ {
+ g_assert_cmpint (TRUE, ==, gb_navigation_list_get_can_go_backward (list));
+ g_assert_cmpint ((i!=0), ==, gb_navigation_list_get_can_go_forward (list));
+ gb_navigation_list_go_backward (list);
}
+
+ g_assert_cmpint (FALSE, ==, gb_navigation_list_get_can_go_backward (list));
+
+ for (i = 0; i < 31; i++)
+ {
+ g_assert_cmpint (TRUE, ==, gb_navigation_list_get_can_go_forward (list));
+ g_assert_cmpint ((i!=0), ==, gb_navigation_list_get_can_go_backward (list));
+ gb_navigation_list_go_forward (list);
+ }
+
+ g_assert_cmpint (FALSE, ==, gb_navigation_list_get_can_go_forward (list));
+
+ g_clear_object (&list);
}
gint
@@ -27,6 +53,6 @@ main (gint argc,
gchar *argv[])
{
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/NavigationList/depth", test_navigation_list_depth);
+ g_test_add_func ("/NavigationList/basic", test_navigation_list_basic);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]