[gnome-builder] tests: move tests to toplevel



commit de5edad3babff2aa4b0630dd9f5a182eb8548ede
Author: Christian Hergert <christian hergert me>
Date:   Wed Sep 24 00:55:17 2014 -0700

    tests: move tests to toplevel
    
    This also includes a basic test for the navigation system. Mostly just
    because it was annoying to separate the commits.

 .gitignore                           |    9 +++++++++
 Makefile.am                          |    4 +++-
 build/autotools/automake/Defaults.mk |    5 -----
 configure.ac                         |    1 -
 src/gnome-builder.mk                 |   26 +++++++++++++-------------
 src/navigation/gb-navigation-list.c  |    9 +++++++++
 src/navigation/gb-navigation-list.h  |    1 +
 tests/.gitignore                     |    4 ----
 tests/Makefile.am                    |   15 ---------------
 tests/test-navigation-list.c         |   32 ++++++++++++++++++++++++++++++++
 tests/tests.mk                       |   12 ++++++++++++
 11 files changed, 79 insertions(+), 39 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index faedbb8..c59529f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,8 +9,10 @@ configure
 *.deps
 .dirstamp
 gnome-builder
+libgnome-builder.la
 *.libs
 libtool
+*.lo
 Makefile
 Makefile.in
 Makefile.in
@@ -18,3 +20,10 @@ Makefile.in
 stamp-h1
 *.swp
 test-c-parse-helper
+test-c-parse-helper
+test-c-parse-helper.log
+test-c-parse-helper.trs
+test-navigation-list
+test-navigation-list.log
+test-navigation-list.trs
+test-suite.log
diff --git a/Makefile.am b/Makefile.am
index 2aade1e..7a9b64b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,4 @@
+include build/autotools/automake/glib-tap.mk
 include build/autotools/automake/Defaults.mk
 include build/autotools/automake/ChangeLog.mk
 include build/autotools/automake/AutomakeDocs.mk
@@ -6,10 +7,11 @@ ACLOCAL_AMFLAGS = -I build/autotools/m4 ${ACLOCAL_FLAGS}
 
 include src/gnome-builder.mk
 include data/data.mk
+include tests/tests.mk
 
 # XXX: Not happy about this, need to come up with a good way to do
 # icon installation that doesn't require subdirs.
-SUBDIRS = . data/icons tests
+SUBDIRS = . data/icons
 
 EXTRA_DIST += \
        tap-driver.sh \
diff --git a/build/autotools/automake/Defaults.mk b/build/autotools/automake/Defaults.mk
index e5f1476..4792241 100644
--- a/build/autotools/automake/Defaults.mk
+++ b/build/autotools/automake/Defaults.mk
@@ -1,8 +1,3 @@
-CLEANFILES =
-DISTCLEANFILES =
-EXTRA_DIST =
 bin_PROGRAMS =
 lib_LTLIBRARIES =
-noinst_LTLIBRARIES =
-noinst_PROGRAMS =
 TEST_PROGS =
diff --git a/configure.ac b/configure.ac
index 3baa5a6..7d03ceb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,6 @@ AC_CONFIG_FILES([
        Makefile
        data/icons/Makefile
        data/org.gnome.Builder.service
-       tests/Makefile
 ])
 
 # Last change to configure things and write configuration files.
diff --git a/src/gnome-builder.mk b/src/gnome-builder.mk
index 5ad1d4e..c21589c 100644
--- a/src/gnome-builder.mk
+++ b/src/gnome-builder.mk
@@ -1,7 +1,8 @@
 bin_PROGRAMS += gnome-builder
+noinst_LTLIBRARIES += libgnome-builder.la
 
-gnome_builder_SOURCES = \
-       $(BUILT_FILES) \
+libgnome_builder_la_SOURCES = \
+       $(gnome_builder_built_sources) \
        src/animation/gb-animation.c \
        src/animation/gb-animation.h \
        src/animation/gb-frame-source.c \
@@ -104,10 +105,9 @@ gnome_builder_SOURCES = \
        src/workbench/gb-workbench-actions.c \
        src/workbench/gb-workbench-actions.h \
        src/workbench/gb-workspace.c \
-       src/workbench/gb-workspace.h \
-       src/main.c
+       src/workbench/gb-workspace.h
 
-gnome_builder_LDADD = \
+libgnome_builder_la_LIBADD = \
        $(DEVHELP_LIBS) \
        $(GIO_LIBS) \
        $(GTKSOURCEVIEW_LIBS) \
@@ -115,7 +115,7 @@ gnome_builder_LDADD = \
        $(WEBKIT_LIBS) \
        -lm
 
-gnome_builder_CFLAGS = \
+libgnome_builder_la_CFLAGS = \
        $(DEVHELP_CFLAGS) \
        $(GIO_CFLAGS) \
        $(GTKSOURCEVIEW_CFLAGS) \
@@ -142,20 +142,20 @@ gnome_builder_CFLAGS = \
        -I$(top_srcdir)/src/workbench
 
 if ENABLE_TRACING
-gnome_builder_CFLAGS += -DGB_ENABLE_TRACE
+libgnome_builder_la_CFLAGS += -DGB_ENABLE_TRACE
 endif
 
+gnome_builder_SOURCES = src/main.c
+gnome_builder_CFLAGS = $(libgnome_builder_la_CFLAGS)
+gnome_builder_LDADD = libgnome-builder.la
+
 # XXX: Workaround for now, need to find a more automated way to do this
 # in how we build projects inside of Builder.
 gnome_builder_built_sources = \
        src/resources/gb-resources.c \
        src/resources/gb-resources.h
 
-BUILT_SOURCES = \
-       $(gnome_builder_built_sources) \
-       $(NULL)
-
-# src/app/gnome_builder-gb-application.$(OBJEXT): $(gnome_builder_built_sources)
+src/app/libgnome_builder_la-gb-application.$(OBJEXT): $(gnome_builder_built_sources)
 
 resource_files = $(shell glib-compile-resources --sourcedir=$(top_srcdir)/src/resources 
--generate-dependencies $(top_srcdir)/src/resources/gnome-builder.gresource.xml)
 src/resources/gb-resources.c: src/resources/gnome-builder.gresource.xml $(resource_files)
@@ -170,4 +170,4 @@ nodist_gnome_builder_SOURCES = \
 EXTRA_DIST += $(resource_files)
 EXTRA_DIST += src/resources/gnome-builder.gresource.xml
 
-CLEANFILES += $(BUILT_SOURCES)
+CLEANFILES += $(gnome_builder_built_sources)
diff --git a/src/navigation/gb-navigation-list.c b/src/navigation/gb-navigation-list.c
index af6f14f..15c4002 100644
--- a/src/navigation/gb-navigation-list.c
+++ b/src/navigation/gb-navigation-list.c
@@ -37,6 +37,7 @@ enum {
   PROP_CAN_GO_BACKWARD,
   PROP_CAN_GO_FORWARD,
   PROP_CURRENT_ITEM,
+  PROP_DEPTH,
   LAST_PROP
 };
 
@@ -48,6 +49,14 @@ gb_navigation_list_new (void)
   return g_object_new (GB_TYPE_NAVIGATION_LIST, NULL);
 }
 
+guint
+gb_navigation_list_get_depth (GbNavigationList *list)
+{
+  g_return_val_if_fail (GB_IS_NAVIGATION_LIST (list), 0);
+
+  return list->priv->items->len;
+}
+
 gboolean
 gb_navigation_list_get_can_go_backward (GbNavigationList *list)
 {
diff --git a/src/navigation/gb-navigation-list.h b/src/navigation/gb-navigation-list.h
index c2c62e9..68c6284 100644
--- a/src/navigation/gb-navigation-list.h
+++ b/src/navigation/gb-navigation-list.h
@@ -59,6 +59,7 @@ void                  gb_navigation_list_append              (GbNavigationList *
                                                               GbNavigationItem *item);
 void                  gb_navigation_list_go_backward         (GbNavigationList *list);
 void                  gb_navigation_list_go_forward          (GbNavigationList *list);
+guint                 gb_navigation_list_get_depth           (GbNavigationList *list);
 
 G_END_DECLS
 
diff --git a/tests/test-navigation-list.c b/tests/test-navigation-list.c
new file mode 100644
index 0000000..608a473
--- /dev/null
+++ b/tests/test-navigation-list.c
@@ -0,0 +1,32 @@
+#include "gb-navigation-list.h"
+#include "gb-navigation-item.h"
+
+static void
+test_navigation_list_depth (void)
+{
+  GbNavigationList *list;
+  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));
+    }
+}
+
+gint
+main (gint argc,
+      gchar *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+  g_test_add_func ("/NavigationList/depth", test_navigation_list_depth);
+  return g_test_run ();
+}
diff --git a/tests/tests.mk b/tests/tests.mk
new file mode 100644
index 0000000..ec7438b
--- /dev/null
+++ b/tests/tests.mk
@@ -0,0 +1,12 @@
+noinst_PROGRAMS += test-c-parse-helper
+TESTS += test-c-parse-helper
+test_c_parse_helper_SOURCES = tests/test-c-parse-helper.c
+test_c_parse_helper_CFLAGS = $(libgnome_builder_la_CFLAGS)
+test_c_parse_helper_LDADD = libgnome-builder.la
+
+
+noinst_PROGRAMS += test-navigation-list
+TESTS += test-navigation-list
+test_navigation_list_SOURCES = tests/test-navigation-list.c
+test_navigation_list_CFLAGS = $(libgnome_builder_la_CFLAGS)
+test_navigation_list_LDADD = libgnome-builder.la


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]