gir_ffi 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +11 -0
  3. data/README.md +8 -6
  4. data/TODO.md +3 -0
  5. data/lib/ffi-glib.rb +2 -1
  6. data/lib/ffi-gobject.rb +2 -1
  7. data/lib/ffi-gobject/object.rb +19 -9
  8. data/lib/ffi-gobject/value.rb +15 -3
  9. data/lib/gir_ffi-base.rb +9 -4
  10. data/lib/gir_ffi-base/glib.rb +8 -0
  11. data/lib/gir_ffi-base/glib/boolean.rb +1 -0
  12. data/lib/gir_ffi-base/glib/strv.rb +1 -0
  13. data/lib/gir_ffi-base/gobject.rb +5 -1
  14. data/lib/gir_ffi/boxed_base.rb +12 -0
  15. data/lib/gir_ffi/builder.rb +10 -1
  16. data/lib/gir_ffi/builders/argument_builder.rb +8 -4
  17. data/lib/gir_ffi/builders/base_return_value_builder.rb +38 -0
  18. data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -30
  19. data/lib/gir_ffi/builders/initializer_return_value_builder.rb +2 -6
  20. data/lib/gir_ffi/builders/module_builder.rb +2 -3
  21. data/lib/gir_ffi/builders/property_argument_builder.rb +23 -0
  22. data/lib/gir_ffi/builders/property_builder.rb +65 -46
  23. data/lib/gir_ffi/builders/property_return_value_builder.rb +14 -0
  24. data/lib/gir_ffi/builders/return_value_builder.rb +9 -33
  25. data/lib/gir_ffi/callback_base.rb +5 -0
  26. data/lib/gir_ffi/core.rb +3 -3
  27. data/lib/gir_ffi/in_pointer.rb +1 -1
  28. data/lib/gir_ffi/info_ext/i_signal_info.rb +2 -3
  29. data/lib/gir_ffi/info_ext/i_type_info.rb +22 -14
  30. data/lib/gir_ffi/interface_base.rb +12 -0
  31. data/lib/gir_ffi/user_defined_type_info.rb +8 -0
  32. data/lib/gir_ffi/version.rb +1 -1
  33. data/test/gir_ffi/builders/function_builder_test.rb +19 -0
  34. data/test/gir_ffi/builders/object_builder_test.rb +5 -11
  35. data/test/gir_ffi/builders/property_builder_test.rb +37 -5
  36. data/test/gir_ffi/builders/signal_closure_builder_test.rb +21 -0
  37. data/test/gir_ffi/builders/vfunc_builder_test.rb +20 -0
  38. data/test/gir_ffi/info_ext/i_type_info_test.rb +18 -0
  39. data/test/gir_ffi/user_defined_type_info_test.rb +25 -0
  40. data/test/gir_ffi_test_helper.rb +2 -6
  41. data/test/integration/generated_gimarshallingtests_test.rb +5 -5
  42. data/test/integration/generated_gio_test.rb +2 -3
  43. data/test/integration/generated_gst_test.rb +1 -0
  44. data/test/integration/generated_regress_test.rb +630 -189
  45. data/test/integration/generated_utility_test.rb +173 -0
  46. data/test/lib/Makefile.am +3 -5
  47. metadata +7 -2
@@ -0,0 +1,173 @@
1
+ # frozen_string_literal: true
2
+ require 'gir_ffi_test_helper'
3
+
4
+ GirFFI.setup :Utility
5
+
6
+ describe Utility do
7
+ describe 'Utility::Buffer' do
8
+ let(:instance) { Utility::Buffer.new }
9
+
10
+ it 'has a writable field data' do
11
+ instance.data.must_equal FFI::Pointer::NULL
12
+ instance.data = FFI::Pointer.new 54_321
13
+ instance.data.must_equal FFI::Pointer.new 54_321
14
+ end
15
+
16
+ it 'has a writable field length' do
17
+ instance.length.must_equal 0
18
+ instance.length = 42
19
+ instance.length.must_equal 42
20
+ end
21
+ end
22
+
23
+ describe 'Utility::Byte' do
24
+ let(:instance) { Utility::Byte.new }
25
+
26
+ it 'has a writable field value' do
27
+ instance.value.must_equal 0
28
+ instance.value = 42
29
+ instance.value.must_equal 42
30
+ end
31
+
32
+ it 'has a writable field first_nibble' do
33
+ skip 'This field is not exposed in the GIR'
34
+ instance.value = 0xAB
35
+ instance.first_nibble.must_equal 0xA
36
+ instance.first_nibble = 0x4
37
+ instance.value.must_equal 0x4B
38
+ end
39
+
40
+ it 'has a writable field second_nibble' do
41
+ skip 'This field is not exposed in the GIR'
42
+ instance.value = 0xAB
43
+ instance.second_nibble.must_equal 0xB
44
+ instance.second_nibble = 0x4
45
+ instance.value.must_equal 0xA4
46
+ end
47
+ end
48
+
49
+ describe 'Utility::EnumType' do
50
+ it 'has the member :a' do
51
+ Utility::EnumType[:a].must_equal 0
52
+ end
53
+
54
+ it 'has the member :b' do
55
+ Utility::EnumType[:b].must_equal 1
56
+ end
57
+
58
+ it 'has the member :c' do
59
+ Utility::EnumType[:c].must_equal 2
60
+ end
61
+ end
62
+
63
+ describe 'Utility::FlagType' do
64
+ it 'has the member :a' do
65
+ Utility::FlagType[:a].must_equal 1
66
+ end
67
+
68
+ it 'has the member :b' do
69
+ Utility::FlagType[:b].must_equal 2
70
+ end
71
+
72
+ it 'has the member :c' do
73
+ Utility::FlagType[:c].must_equal 4
74
+ end
75
+ end
76
+
77
+ describe 'Utility::Object' do
78
+ let(:instance) { Utility::Object.new }
79
+
80
+ it 'has a working method #watch_dir' do
81
+ # This method doesn't actually do anything
82
+ instance.watch_dir('/') {}
83
+ pass
84
+ end
85
+ end
86
+
87
+ describe 'Utility::Struct' do
88
+ let(:instance) { Utility::Struct.new }
89
+
90
+ it 'has a writable field field' do
91
+ instance.field.must_equal 0
92
+ instance.field = 42
93
+ instance.field.must_equal 42
94
+ end
95
+
96
+ it 'has a writable field bitfield1' do
97
+ skip 'Bitfield bit width is not implemented yet'
98
+ instance.bitfield1.must_equal 0
99
+ instance.bitfield1 = 15
100
+ instance.bitfield1.must_equal 7
101
+ end
102
+
103
+ it 'has a writable field bitfield2' do
104
+ skip 'Bitfield bit width is not implemented yet'
105
+ instance.bitfield2.must_equal 0
106
+ instance.bitfield2 = 15
107
+ instance.bitfield2.must_equal 3
108
+ end
109
+
110
+ it 'has a writable field data' do
111
+ instance.data.to_a.must_equal [0] * 16
112
+ end
113
+ end
114
+
115
+ describe 'Utility::TaggedValue' do
116
+ let(:instance) { Utility::TaggedValue.new }
117
+
118
+ it 'has a writable field tag' do
119
+ instance.tag.must_equal 0
120
+ instance.tag = 42
121
+ instance.tag.must_equal 42
122
+ end
123
+
124
+ it 'has a writable field v_pointer' do
125
+ skip 'This field is not exposed in the GIR'
126
+ instance.v_pointer.must_equal FFI::Pointer::NULL
127
+ instance.v_pointer = FFI::Pointer.new(4321)
128
+ instance.v_pointer.must_equal FFI::Pointer.new(4321)
129
+ end
130
+
131
+ it 'has a writable field v_real' do
132
+ skip 'This field is not exposed in the GIR'
133
+ instance.v_real.must_equal 0.0
134
+ instance.v_real = 42.23
135
+ instance.v_real.must_equal 42.23
136
+ end
137
+
138
+ it 'has a writable field v_integer' do
139
+ skip 'This field is not exposed in the GIR'
140
+ instance.v_integer.must_equal 0
141
+ instance.v_integer = 42
142
+ instance.v_integer.must_equal 42
143
+ end
144
+ end
145
+
146
+ describe 'Utility::Union' do
147
+ let(:instance) { Utility::Union.new }
148
+
149
+ it 'has a writable field pointer' do
150
+ instance.pointer.must_be_nil
151
+ instance.pointer = 'hello 42'
152
+ instance.pointer.must_equal 'hello 42'
153
+ end
154
+
155
+ it 'has a writable field integer' do
156
+ instance.integer.must_equal 0
157
+ instance.integer = 42
158
+ instance.integer.must_equal 42
159
+ end
160
+
161
+ it 'has a writable field real' do
162
+ instance.real.must_equal 0.0
163
+ instance.real = 42.23
164
+ instance.real.must_equal 42.23
165
+ end
166
+ end
167
+
168
+ it 'has a working function #dir_foreach' do
169
+ # This method doesn't actually do anything
170
+ result = Utility.dir_foreach('/') {}
171
+ result.must_be_nil
172
+ end
173
+ end
@@ -32,13 +32,11 @@ libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
32
32
  libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS)
33
33
 
34
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
35
+ libutility_la_SOURCES = $(GI_DATADIR)/tests/utility.c $(GI_DATADIR)/tests/utility.h
37
36
  libutility_la_CFLAGS = $(GLIB_CFLAGS)
38
37
  libutility_la_LDFLAGS = -module -avoid-version
39
38
 
40
- libwarnlib_la_SOURCES = $(GI_DATADIR)/tests/warnlib.c $(GI_DATADIR)/tests/warnlib.h \
41
- $(GI_DATADIR)/tests/gitestmacros.h
39
+ libwarnlib_la_SOURCES = $(GI_DATADIR)/tests/warnlib.c $(GI_DATADIR)/tests/warnlib.h
42
40
  libwarnlib_la_CFLAGS = $(GIO_CFLAGS)
43
41
  libwarnlib_la_LDFLAGS = -module -avoid-version
44
42
  endif
@@ -86,7 +84,7 @@ Regress-1.0.gir: Utility-1.0.gir
86
84
  regress_SCANNER_INCLUDES += --include-uninstalled=Utility-1.0.gir
87
85
 
88
86
  Utility-1.0.gir: libutility.la
89
- $(AM_V_GEN) g-ir-scanner --include=GLib-2.0 \
87
+ $(AM_V_GEN) g-ir-scanner --include=GLib-2.0 --include=GObject-2.0 \
90
88
  --namespace=$(@:-1.0.gir=) --nsversion=1.0 \
91
89
  --warn-all --warn-error \
92
90
  --library=$< --libtool="$(top_builddir)/libtool" \
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.9.4
4
+ version: 0.9.5
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: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -196,6 +196,7 @@ files:
196
196
  - lib/ffi-gobject_introspection/i_vfunc_info.rb
197
197
  - lib/ffi-gobject_introspection/lib.rb
198
198
  - lib/gir_ffi-base.rb
199
+ - lib/gir_ffi-base/glib.rb
199
200
  - lib/gir_ffi-base/glib/boolean.rb
200
201
  - lib/gir_ffi-base/glib/strv.rb
201
202
  - lib/gir_ffi-base/gobject.rb
@@ -210,6 +211,7 @@ files:
210
211
  - lib/gir_ffi/builders/argument_builder_collection.rb
211
212
  - lib/gir_ffi/builders/base_argument_builder.rb
212
213
  - lib/gir_ffi/builders/base_method_builder.rb
214
+ - lib/gir_ffi/builders/base_return_value_builder.rb
213
215
  - lib/gir_ffi/builders/base_type_builder.rb
214
216
  - lib/gir_ffi/builders/boxed_builder.rb
215
217
  - lib/gir_ffi/builders/c_to_ruby_convertor.rb
@@ -239,7 +241,9 @@ files:
239
241
  - lib/gir_ffi/builders/null_convertor.rb
240
242
  - lib/gir_ffi/builders/null_return_value_builder.rb
241
243
  - lib/gir_ffi/builders/object_builder.rb
244
+ - lib/gir_ffi/builders/property_argument_builder.rb
242
245
  - lib/gir_ffi/builders/property_builder.rb
246
+ - lib/gir_ffi/builders/property_return_value_builder.rb
243
247
  - lib/gir_ffi/builders/registered_type_builder.rb
244
248
  - lib/gir_ffi/builders/return_value_builder.rb
245
249
  - lib/gir_ffi/builders/ruby_to_c_convertor.rb
@@ -415,6 +419,7 @@ files:
415
419
  - test/integration/generated_pango_test.rb
416
420
  - test/integration/generated_regress_test.rb
417
421
  - test/integration/generated_secret_test.rb
422
+ - test/integration/generated_utility_test.rb
418
423
  - test/integration/generated_warnlib_test.rb
419
424
  - test/integration/method_lookup_test.rb
420
425
  - test/introspection_test_helper.rb