gir_ffi 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -1
- data/Gemfile +1 -1
- data/README.md +3 -2
- data/lib/ffi-glib/bytes.rb +0 -14
- data/lib/ffi-glib/hash_table.rb +0 -1
- data/lib/ffi-gobject/object.rb +7 -0
- data/lib/ffi-gobject_introspection/i_base_info.rb +4 -0
- data/lib/ffi-gobject_introspection/lib.rb +1 -0
- data/lib/gir_ffi/boxed_base.rb +2 -2
- data/lib/gir_ffi/builders/callback_argument_builder.rb +3 -1
- data/lib/gir_ffi/builders/closure_return_value_builder.rb +0 -1
- data/lib/gir_ffi/builders/module_builder.rb +9 -2
- data/lib/gir_ffi/builders/null_class_builder.rb +1 -0
- data/lib/gir_ffi/builders/registered_type_builder.rb +5 -1
- data/lib/gir_ffi/callback_base.rb +2 -2
- data/lib/gir_ffi/enum_base.rb +2 -2
- data/lib/gir_ffi/in_out_pointer.rb +1 -1
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -1
- data/lib/gir_ffi/object_base.rb +24 -8
- data/lib/gir_ffi/sized_array.rb +2 -2
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/zero_terminated.rb +12 -1
- data/lib/gir_ffi-base/glib/boolean.rb +2 -2
- data/tasks/test.rake +25 -23
- data/test/base_test_helper.rb +3 -4
- data/test/ffi-gobject/object_test.rb +10 -4
- data/test/ffi-gobject_introspection/i_property_info_test.rb +3 -2
- data/test/gir_ffi/builders/module_builder_test.rb +26 -3
- data/test/gir_ffi/object_base_test.rb +2 -2
- data/test/integration/generated_everything_test.rb +428 -0
- data/test/integration/generated_gimarshallingtests_test.rb +17 -0
- data/test/integration/generated_gtop_test.rb +21 -0
- data/test/integration/generated_regress_test.rb +734 -0
- data/test/integration/generated_warnlib_test.rb +47 -0
- data/test/introspection_test_helper.rb +2 -0
- data/test/lib/Makefile.am +82 -16
- data/test/lib/configure.ac +3 -0
- metadata +5 -2
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'gir_ffi_test_helper'
|
2
|
+
|
3
|
+
describe 'The generated WarnLib module' do
|
4
|
+
before do
|
5
|
+
begin
|
6
|
+
GirFFI.setup :WarnLib
|
7
|
+
rescue
|
8
|
+
skip 'WarnLib GIR not available'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'WarnLib::Whatever' do
|
13
|
+
let(:derived_klass) do
|
14
|
+
Object.const_set("DerivedClass#{Sequence.next}", Class.new(GObject::Object))
|
15
|
+
end
|
16
|
+
|
17
|
+
before do
|
18
|
+
@result = nil
|
19
|
+
derived_klass.class_eval { include WarnLib::Whatever }
|
20
|
+
GirFFI.define_type derived_klass do |info|
|
21
|
+
info.install_vfunc_implementation :do_boo, proc { |obj, x, y| @result = "boo#{x}" }
|
22
|
+
info.install_vfunc_implementation :do_moo, proc { |obj, x, y| @result = "moo#{x}" }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:instance) { derived_klass.new }
|
27
|
+
|
28
|
+
it 'has a working method #do_boo' do
|
29
|
+
instance.do_boo 42, nil
|
30
|
+
@result.must_equal 'boo42'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'has a working method #do_moo' do
|
34
|
+
instance.do_moo 23, nil
|
35
|
+
@result.must_equal 'moo23'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'has a working function #throw_unpaired' do
|
40
|
+
proc { WarnLib.throw_unpaired }.must_raise GirFFI::GLibError
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'has a working function #unpaired_error_quark' do
|
44
|
+
result = WarnLib.unpaired_error_quark
|
45
|
+
GLib.quark_to_string(result).must_equal 'warnlib-unpaired-error'
|
46
|
+
end
|
47
|
+
end
|
data/test/lib/Makefile.am
CHANGED
@@ -3,32 +3,58 @@ AUTOMAKE_OPTIONS = 1.7
|
|
3
3
|
|
4
4
|
# We need to build a shared library, which can be dlopened
|
5
5
|
# it does not work with noinst_LTLIBRARIES
|
6
|
-
testlib_LTLIBRARIES =
|
6
|
+
testlib_LTLIBRARIES = \
|
7
|
+
libeverything.la \
|
8
|
+
libgimarshallingtests.la libregress.la libutility.la libwarnlib.la
|
7
9
|
|
8
10
|
testlibdir = $(prefix)/unused
|
11
|
+
GI_TESTDIR = $(GI_DATADIR)/tests
|
9
12
|
install-testlibLTLIBRARIES: # prevent it from being installed
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
libeverything_la_SOURCES = $(GI_DATADIR)/tests/everything.c $(GI_DATADIR)/tests/everything.h
|
15
|
+
libeverything_la_CFLAGS = $(GLIB_CFLAGS)
|
16
|
+
libeverything_la_LDFLAGS = -module -avoid-version
|
14
17
|
|
15
18
|
libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
|
16
19
|
libgimarshallingtests_la_CFLAGS = $(GIO_CFLAGS)
|
17
20
|
libgimarshallingtests_la_LDFLAGS = -module -avoid-version
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
libregress_la_SOURCES = $(GI_TESTDIR)/regress.c $(GI_TESTDIR)/regress.h
|
23
|
+
|
24
|
+
if HAVE_EXTRA_TEST_FILES
|
25
|
+
libregress_la_SOURCES += \
|
26
|
+
$(GI_TESTDIR)/annotation.c $(GI_TESTDIR)/annotation.h \
|
27
|
+
$(GI_TESTDIR)/foo.c $(GI_TESTDIR)/foo.h \
|
28
|
+
$(GI_TESTDIR)/drawable.c $(GI_TESTDIR)/drawable.h
|
29
|
+
endif
|
30
|
+
|
31
|
+
libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
|
32
|
+
libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS)
|
33
|
+
|
34
|
+
if HAVE_EXTRA_TEST_FILES
|
35
|
+
libutility_la_SOURCES = $(GI_DATADIR)/tests/utility.c $(GI_DATADIR)/tests/utility.h \
|
36
|
+
$(GI_DATADIR)/tests/gitestmacros.h
|
37
|
+
libutility_la_CFLAGS = $(GLIB_CFLAGS)
|
38
|
+
libutility_la_LDFLAGS = -module -avoid-version
|
39
|
+
|
40
|
+
libwarnlib_la_SOURCES = $(GI_DATADIR)/tests/warnlib.c $(GI_DATADIR)/tests/warnlib.h \
|
41
|
+
$(GI_DATADIR)/tests/gitestmacros.h
|
42
|
+
libwarnlib_la_CFLAGS = $(GIO_CFLAGS)
|
43
|
+
libwarnlib_la_LDFLAGS = -module -avoid-version
|
44
|
+
endif
|
45
|
+
|
46
|
+
GIRS = Everything-1.0.gir GIMarshallingTests-1.0.gir Regress-1.0.gir
|
47
|
+
|
48
|
+
Everything-1.0.gir: libeverything.la
|
49
|
+
$(AM_V_GEN) g-ir-scanner --include=GLib-2.0 \
|
50
|
+
--namespace=$(@:-1.0.gir=) --nsversion=1.0 \
|
23
51
|
--warn-all --warn-error \
|
24
|
-
--library=
|
25
|
-
--
|
26
|
-
|
27
|
-
$(libregress_la_SOURCES)
|
28
|
-
Regress-1.0.typelib: Regress-1.0.gir Makefile
|
52
|
+
--library=$< --libtool="$(top_builddir)/libtool" \
|
53
|
+
--output $@ $(libeverything_la_SOURCES)
|
54
|
+
Everything-1.0.typelib: Everything-1.0.gir
|
29
55
|
$(AM_V_GEN) g-ir-compiler $< -o $@
|
30
56
|
|
31
|
-
GIMarshallingTests-1.0.gir: libgimarshallingtests.la
|
57
|
+
GIMarshallingTests-1.0.gir: libgimarshallingtests.la
|
32
58
|
$(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
|
33
59
|
--namespace=GIMarshallingTests --nsversion=1.0 \
|
34
60
|
--symbol-prefix=gi_marshalling_tests \
|
@@ -37,10 +63,50 @@ GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
|
|
37
63
|
--libtool="$(top_builddir)/libtool" \
|
38
64
|
--output $@ \
|
39
65
|
$(libgimarshallingtests_la_SOURCES)
|
40
|
-
GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir
|
66
|
+
GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir
|
67
|
+
$(AM_V_GEN) g-ir-compiler $< -o $@
|
68
|
+
|
69
|
+
regress_SCANNER_INCLUDES= --include=cairo-1.0 --include=Gio-2.0
|
70
|
+
|
71
|
+
Regress-1.0.gir: libregress.la
|
72
|
+
$(AM_V_GEN) g-ir-scanner $(regress_SCANNER_INCLUDES) \
|
73
|
+
--namespace=Regress --nsversion=1.0 --pkg=cairo-gobject \
|
74
|
+
--warn-all --warn-error \
|
75
|
+
--library=libregress.la \
|
76
|
+
--libtool="$(top_builddir)/libtool" \
|
77
|
+
--output $@ \
|
78
|
+
$(libregress_la_SOURCES)
|
79
|
+
Regress-1.0.typelib: Regress-1.0.gir
|
80
|
+
$(AM_V_GEN) g-ir-compiler --includedir=. $< -o $@
|
81
|
+
|
82
|
+
if HAVE_EXTRA_TEST_FILES
|
83
|
+
|
84
|
+
GIRS += Utility-1.0.gir WarnLib-1.0.gir
|
85
|
+
Regress-1.0.gir: Utility-1.0.gir
|
86
|
+
regress_SCANNER_INCLUDES += --include-uninstalled=Utility-1.0.gir
|
87
|
+
|
88
|
+
Utility-1.0.gir: libutility.la
|
89
|
+
$(AM_V_GEN) g-ir-scanner --include=GLib-2.0 \
|
90
|
+
--namespace=$(@:-1.0.gir=) --nsversion=1.0 \
|
91
|
+
--warn-all --warn-error \
|
92
|
+
--library=$< --libtool="$(top_builddir)/libtool" \
|
93
|
+
--output $@ $(libutility_la_SOURCES)
|
94
|
+
Utility-1.0.typelib: Utility-1.0.gir
|
41
95
|
$(AM_V_GEN) g-ir-compiler $< -o $@
|
42
96
|
|
97
|
+
WarnLib-1.0.gir: libwarnlib.la
|
98
|
+
$(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
|
99
|
+
--namespace=$(@:-1.0.gir=) --nsversion=1.0 \
|
100
|
+
--symbol-prefix=warnlib \
|
101
|
+
--warn-all \
|
102
|
+
--library=$< --libtool="$(top_builddir)/libtool" \
|
103
|
+
--output $@ $(libwarnlib_la_SOURCES)
|
104
|
+
WarnLib-1.0.typelib: WarnLib-1.0.gir
|
105
|
+
$(AM_V_GEN) g-ir-compiler $< -o $@
|
106
|
+
|
107
|
+
endif
|
108
|
+
|
43
109
|
.la.so:
|
44
110
|
test -L $@ || $(LN_S) .libs/$@ $@
|
45
111
|
|
46
|
-
all: $(testlib_LTLIBRARIES:.la=.so)
|
112
|
+
all: $(testlib_LTLIBRARIES:.la=.so) $(GIRS:.gir=.typelib)
|
data/test/lib/configure.ac
CHANGED
@@ -22,10 +22,13 @@ if test "$GCC" = "yes"; then
|
|
22
22
|
fi
|
23
23
|
|
24
24
|
PKG_CHECK_MODULES(GIO, [gio-2.0])
|
25
|
+
PKG_CHECK_MODULES(GLIB, [glib-2.0])
|
25
26
|
PKG_CHECK_MODULES(CAIRO, [cairo])
|
26
27
|
|
27
28
|
GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
|
28
29
|
AC_SUBST(GI_DATADIR)
|
30
|
+
AC_CHECK_FILE($GI_DATADIR/tests/annotation.c, have_annotation=true, have_annotation=false)
|
31
|
+
AM_CONDITIONAL(HAVE_EXTRA_TEST_FILES, test x$have_annotation = xtrue)
|
29
32
|
|
30
33
|
AC_CONFIG_FILES([Makefile])
|
31
34
|
AC_OUTPUT
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -347,14 +347,17 @@ files:
|
|
347
347
|
- test/gir_ffi_test.rb
|
348
348
|
- test/gir_ffi_test_helper.rb
|
349
349
|
- test/integration/derived_classes_test.rb
|
350
|
+
- test/integration/generated_everything_test.rb
|
350
351
|
- test/integration/generated_gimarshallingtests_test.rb
|
351
352
|
- test/integration/generated_gio_test.rb
|
352
353
|
- test/integration/generated_glib_test.rb
|
353
354
|
- test/integration/generated_gobject_test.rb
|
355
|
+
- test/integration/generated_gtop_test.rb
|
354
356
|
- test/integration/generated_pango_ft2_test.rb
|
355
357
|
- test/integration/generated_pango_test.rb
|
356
358
|
- test/integration/generated_regress_test.rb
|
357
359
|
- test/integration/generated_secret_test.rb
|
360
|
+
- test/integration/generated_warnlib_test.rb
|
358
361
|
- test/integration/method_lookup_test.rb
|
359
362
|
- test/introspection_test_helper.rb
|
360
363
|
- test/lib/Makefile.am
|