From 312ccef24f7faaff3ba8dae178c915374ab6677f Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 30 Sep 2015 07:15:25 +0200 Subject: Add a test suite to check gobject-introspection data The test suite acts also as an example for downstream projects to generate gobject-introspection data. A known-good .gir file is checked in for checking results in the future. Lastly, a small python uses the gobject-introspection data to create a small editor window. The change to gtk/makefile is because scintilla needs to be in a shared library for the python program. Therefore scintilla.a has to be compiled with -fPIC. --- test/gi/Scintilla-0.1.gir.good | 138 +++++++++++++++++++++++++++++++++++++++++ test/gi/gi-test.py | 11 ++++ test/gi/makefile | 35 +++++++++++ 3 files changed, 184 insertions(+) create mode 100644 test/gi/Scintilla-0.1.gir.good create mode 100644 test/gi/gi-test.py create mode 100644 test/gi/makefile (limited to 'test') diff --git a/test/gi/Scintilla-0.1.gir.good b/test/gi/Scintilla-0.1.gir.good new file mode 100644 index 000000000..6c9595121 --- /dev/null +++ b/test/gi/Scintilla-0.1.gir.good @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/gi/gi-test.py b/test/gi/gi-test.py new file mode 100644 index 000000000..10cee8bc6 --- /dev/null +++ b/test/gi/gi-test.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +from gi.repository import Gtk +from gi.repository import Scintilla + +win = Gtk.Window() +win.connect("delete-event", Gtk.main_quit) +sci = Scintilla.Object() +win.add(sci) +win.show_all() +win.resize(400,300) +Gtk.main() diff --git a/test/gi/makefile b/test/gi/makefile new file mode 100644 index 000000000..41d200653 --- /dev/null +++ b/test/gi/makefile @@ -0,0 +1,35 @@ +all: Scintilla-0.1.typelib + +ifdef GTK3 +GTKVERSION=gtk+-3.0 +else +GTKVERSION=gtk+-2.0 +endif + +GI_SCANNER = g-ir-scanner +GI_COMPILER = g-ir-compiler +GTK_LIBS = $(shell pkg-config --libs $(GTKVERSION)) + +FORCE: + +../../bin/scintilla.a: FORCE + $(MAKE) -C ../../gtk all + +libscintilla.so: ../../bin/scintilla.a + $(CXX) -shared -o $@ -Wl,--whole-archive $^ -Wl,--no-whole-archive $(GTK_LIBS) + +Scintilla-0.1.gir: libscintilla.so + LDFLAGS=-Wl,-rpath=$(shell pwd) CFLAGS="-include gtk/gtk.h" \ + $(GI_SCANNER) --warn-all -i Gtk-3.0 -DG_IR_SCANNING -DGTK \ + --c-include Scintilla.h --c-include ScintillaWidget.h \ + -n Scintilla --nsversion 0.1 --library scintilla ../../include/ScintillaWidget.h \ + -o $@ + @echo Verifing Scintilla-0.1.gir file + @diff $@.good $@ || (echo "GIR FILE MISMATCH!"; exit 1) + + +Scintilla-0.1.typelib: Scintilla-0.1.gir + $(GI_COMPILER) $^ -o $@ + +clean: + rm -f libscintilla.so Scintilla-0.1.gir Scintilla-0.1.typelib -- cgit v1.2.3