[tracker/direct-access: 27/122] functional-tests: Added functional test, libtracker-direct: Added .vapi create



commit 33d01a87e3125a8a1d03d2dce3cc5f90015cfb4e
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Jul 7 15:56:45 2010 +0200

    functional-tests: Added functional test, libtracker-direct: Added .vapi create

 src/libtracker-direct/Makefile.am       |    7 ++++-
 tests/functional-tests/Makefile.am      |   40 +++++++++++++++++++++++++-----
 tests/functional-tests/direct-test.vala |   23 +++++++++++++++++
 3 files changed, 62 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-direct/Makefile.am b/src/libtracker-direct/Makefile.am
index 82f7181..e74309e 100644
--- a/src/libtracker-direct/Makefile.am
+++ b/src/libtracker-direct/Makefile.am
@@ -38,8 +38,13 @@ vapi_sources =						\
 	$(top_srcdir)/src/libtracker-data/libtracker-data.vapi	\
 	$(top_srcdir)/src/libtracker-data/tracker-sparql-query.vapi
 
+# Vala bindings
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = \
+	tracker-direct-$(TRACKER_API_VERSION).vapi
+
 libtracker-direct.vala.stamp: $(libtracker_direct_la_VALASOURCES) $(vapi_sources)
-	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-direct.h $^
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-direct.h --vapi tracker-direct-$(TRACKER_API_VERSION).vapi $^
 	$(AM_V_GEN)touch $@
 
 BUILT_SOURCES = 					\
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 99b4fd7..57afbd1 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -3,6 +3,8 @@ include $(top_srcdir)/Makefile.decl
 SUBDIRS = data
 
 INCLUDES =					\
+	-I$(top_builddir)/src/libtracker-sparql	\
+	-I$(top_builddir)/src/libtracker-direct	\
 	$(WARN_CFLAGS)				\
 	$(DBUS_CFLAGS)				\
 	$(GLIB2_CFLAGS)				\
@@ -47,7 +49,7 @@ bashscripts_SCRIPTS = 				\
 	@sed -e "s|@topsrcdir[ ]|${top_srcdir}|" \
 	     -e "s|@libexecdir[ ]|${libexecdir}|" $< > $@
 
-noinst_PROGRAMS = busy-handling-test
+noinst_PROGRAMS = busy-handling-test direct-test
 
 busy_handling_test_VALASOURCES = busy-handling-test.vala
 
@@ -64,12 +66,33 @@ busy_handling_test_LDADD = \
 	$(GLIB2_LIBS) \
 	$(DBUS_LIBS)
 
-BUILT_SOURCES = 				\
-	busy-handling-test.vala.stamp
+direct_test_VALASOURCES = direct-test.vala
 
-MAINTAINERCLEANFILES =					\
-	$(BUILT_SOURCES)				\
-	$(busy_handling_test_VALASOURCES:.vala=.c)
+direct_test_SOURCES = \
+	direct_test.vala.stamp \
+	$(direct_test_VALASOURCES:.vala=.c)
+
+vapi_sources = \
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi	\
+	$(top_srcdir)/src/libtracker-direct/tracker-direct-$(TRACKER_API_VERSION).vapi
+
+direct-test.vala.stamp: $(direct_test_VALASOURCES) $(vapi_sources)
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 $^
+	$(AM_V_GEN)touch $@
+
+# I need to add libtracker-data.la here, I don't understand yet why. I think
+# that means that something about libtracker-direct or libtracker-sparql is
+# wrong -- Philip
+
+direct_test_LDADD = \
+	$(top_builddir)/src/libtracker-data/libtracker-data.la \
+	$(top_builddir)/src/libtracker-direct/libtracker-direct-$(TRACKER_API_VERSION).la \
+	$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
+	$(GLIB2_LIBS)
+
+BUILT_SOURCES = \
+	busy-handling-test.vala.stamp \
+	direct-test.vala.stamp
 
 EXTRA_DIST = 					\
 	$(config_SCRIPTS) 			\
@@ -78,5 +101,8 @@ EXTRA_DIST = 					\
 	$(BUILT_SOURCES)			\
 	$(busy_handling_test_VALASOURCES)
 
-CLEANFILES = $(bashscripts_SCRIPTS)
+CLEANFILES = $(bashscripts_SCRIPTS) $(BUILD_SOURCES)
 
+MAINTAINERCLEANFILES =					\
+	$(BUILT_SOURCES)				\
+	$(busy_handling_test_VALASOURCES:.vala=.c)
diff --git a/tests/functional-tests/direct-test.vala b/tests/functional-tests/direct-test.vala
new file mode 100644
index 0000000..3269396
--- /dev/null
+++ b/tests/functional-tests/direct-test.vala
@@ -0,0 +1,23 @@
+using Tracker;
+using Tracker.Sparql;
+using Tracker.Direct;
+
+int
+main( string[] args )
+{
+	Sparql.Connection con = new Direct.Connection ();
+	Cursor cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
+
+	while (cursor.iter_next()) {
+		int i;
+
+		for (i = 0; i < cursor.n_columns; i++) {
+			print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
+		}
+
+		print ("\n");
+	}
+
+	return( 0 );
+}
+



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