[gjs] Port to new gobject-introspection tests



commit 7c5a7dba08839fbb093ecdbcee4877e21a004c2a
Author: Colin Walters <walters verbum org>
Date:   Thu Aug 19 17:36:38 2010 -0400

    Port to new gobject-introspection tests
    
    Everything is now Regress, and both it and GIMarshallingTests come
    in .c form.
    
    Disable the g_utf8_get_char test until gunichar becomes introspectable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=627435

 Makefile-test.am                      |   38 ++++++++++++++++++++++++++++++++-
 configure.ac                          |    3 ++
 test/js/testEverythingBasic.js        |    3 +-
 test/js/testEverythingEncapsulated.js |    3 +-
 test/js/testGI.js                     |    3 +-
 5 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index ff3cc42..f8ac767 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -62,6 +62,41 @@ CLEANFILES +=				\
 EXTRA_DIST +=			\
 	scripts/make-tests
 
+# noinst_ always builds a static library
+testlib_LTLIBRARIES = libregress.la libgimarshallingtests.la
+testlibdir = $(prefix)/unused
+install-testlibLTLIBRARIES: # prevent it from being installed
+
+libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+libregress_la_CFLAGS = $(GJS_CFLAGS) $(GJS_CAIRO_CFLAGS)
+libregress_la_LDFLAGS = -avoid-version $(GJS_LIBS) $(GJS_CAIRO_LIBS)
+libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
+libgimarshallingtests_la_CFLAGS = $(GJS_CFLAGS)
+libgimarshallingtests_la_LDFLAGS = -avoid-version $(GJS_LIBS)
+
+# g-i doesn't ship these as shared libraries anymore; we build them here
+Regress-1.0.gir: libregress.la Makefile
+	$(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \
+	--namespace=Regress --nsversion=1.0 \
+	--warn-all --warn-error \
+	--library=libregress.la \
+	--libtool="$(top_builddir)/libtool" \
+	--output $@ \
+	$(libregress_la_SOURCES)
+Regress-1.0.typelib: Regress-1.0.gir Makefile
+	$(AM_V_GEN) g-ir-compiler $< -o $@
+
+GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
+	$(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
+	--namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \
+	--warn-all --warn-error \
+	--library=libgimarshallingtests.la \
+	--libtool="$(top_builddir)/libtool" \
+	--output $@ \
+	$(libgimarshallingtests_la_SOURCES)
+GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
+	$(AM_V_GEN) g-ir-compiler $< -o $@
+
 ########################################################################
 TESTS_ENVIRONMENT =							\
 	TOP_SRCDIR=$(top_srcdir)					\
@@ -70,10 +105,11 @@ TESTS_ENVIRONMENT =							\
 	GJS_DEBUG_OUTPUT=test_user_data/logs/gjs.log			\
 	BUILDDIR=.							\
 	GJS_USE_UNINSTALLED_FILES=1					\
+	GI_TYPELIB_PATH=$(builddir)					\
 	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(FIREFOX_JS_LIBDIR)"	\
 	G_FILENAME_ENCODING=latin1	# ensure filenames are not utf8
 
-test:	$(gjsnative_LTLIBRARIES) ${TEST_PROGS}
+test:	$(gjsnative_LTLIBRARIES) ${TEST_PROGS} Regress-1.0.typelib GIMarshallingTests-1.0.typelib
 	@test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} ${TEST_PROGS_OPTIONS}
 
 check:	test
diff --git a/configure.ac b/configure.ac
index e0dd733..9996309 100644
--- a/configure.ac
+++ b/configure.ac
@@ -192,6 +192,9 @@ CFLAGS=$saved_CFLAGS
 LIBS=$saved_LIBS
 PKG_CHECK_MODULES([GJSTESTS], [$gjstests_packages])
 
+GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
+AC_SUBST(GI_DATADIR)
+
 if test x"$JS_PACKAGE" = x; then
     # if JS_PACKAGE is undefined, pkg-config modules don't include
     # SpiderMonkey and we need to deal with it ourselves
diff --git a/test/js/testEverythingBasic.js b/test/js/testEverythingBasic.js
index 03e0de0..a45a6da 100644
--- a/test/js/testEverythingBasic.js
+++ b/test/js/testEverythingBasic.js
@@ -1,4 +1,5 @@
-const Everything = imports.gi.Everything;
+// This used to be called "Everything"
+const Everything = imports.gi.Regress;
 if (!('assertEquals' in this)) { /* allow running this test standalone */
     imports.lang.copyPublicProperties(imports.jsUnit, this);
     gjstestRun = function() { return imports.jsUnit.gjstestRun(window); };
diff --git a/test/js/testEverythingEncapsulated.js b/test/js/testEverythingEncapsulated.js
index 76d5991..30008ce 100644
--- a/test/js/testEverythingEncapsulated.js
+++ b/test/js/testEverythingEncapsulated.js
@@ -1,4 +1,5 @@
-const Everything = imports.gi.Everything;
+// This used to be called "Everything"
+const Everything = imports.gi.Regress;
 if (!('assertEquals' in this)) { /* allow running this test standalone */
     imports.lang.copyPublicProperties(imports.jsUnit, this);
     gjstestRun = function() { return imports.jsUnit.gjstestRun(window); };
diff --git a/test/js/testGI.js b/test/js/testGI.js
index a800c41..08852ee 100644
--- a/test/js/testGI.js
+++ b/test/js/testGI.js
@@ -1,7 +1,8 @@
 function testUTF8() {
     const GLib = imports.gi.GLib;
 
-    assertEquals(0x2664, GLib.utf8_get_char("\u2664 utf8"));
+    // gunichar is temporarily not-introspectable
+    //assertEquals(0x2664, GLib.utf8_get_char("\u2664 utf8"));
 }
 
 function testThrows() {



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