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



commit 67244bec3ba32eafe609795b0cf2bbdd3fa62578
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     |   38 +++++++++++++++++++++++++++++++-
 tests/functional-tests/directtest.vala |   23 +++++++++++++++++++
 3 files changed, 66 insertions(+), 2 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 c46f740..290f21f 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -2,6 +2,13 @@ include $(top_srcdir)/Makefile.decl
 
 SUBDIRS = data
 
+INCLUDES =									\
+	-I$(top_builddir)/src/libtracker-sparql	\
+	-I$(top_builddir)/src/libtracker-direct	\
+	$(WARN_CFLAGS)							\
+	$(GLIB2_CFLAGS)							\
+	$(GTHREAD_CFLAGS)
+
 configdir = $(datadir)/tracker-tests
 
 config_SCRIPTS =			\
@@ -39,9 +46,38 @@ bashscripts_SCRIPTS = 				\
 	@sed -e "s|@topsrcdir[ ]|${top_srcdir}|" \
 	     -e "s|@libexecdir[ ]|${libexecdir}|" $< > $@
 
+noinst_PROGRAMS = directtest
+
+directtest_VALASOURCES = directtest.vala
+
+directtest_SOURCES = \
+	directtest.vala.stamp \
+	$(directtest_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
+
+directtest.vala.stamp: $(directtest_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
+
+directtest_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 = directtest.vala.stamp
+
 EXTRA_DIST = 					\
 	$(config_SCRIPTS) 			\
 	$(bashscripts_SCRIPTS)			\
 	$(bashscripts_in_files)
 
-CLEANFILES = $(bashscripts_SCRIPTS)
+CLEANFILES = $(bashscripts_SCRIPTS) $(BUILD_SOURCES)
+
diff --git a/tests/functional-tests/directtest.vala b/tests/functional-tests/directtest.vala
new file mode 100644
index 0000000..3269396
--- /dev/null
+++ b/tests/functional-tests/directtest.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]