gir_ffi 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +8 -0
  3. data/Gemfile +2 -0
  4. data/README.md +2 -2
  5. data/Rakefile +3 -1
  6. data/TODO.md +7 -19
  7. data/lib/ffi-glib/byte_array.rb +1 -1
  8. data/lib/ffi-glib/list.rb +1 -1
  9. data/lib/ffi-glib/main_loop.rb +8 -8
  10. data/lib/ffi-glib/s_list.rb +1 -1
  11. data/lib/ffi-gobject/object.rb +8 -6
  12. data/lib/ffi-gobject/value.rb +2 -2
  13. data/lib/ffi-gobject.rb +5 -1
  14. data/lib/ffi-gobject_introspection/i_arg_info.rb +1 -1
  15. data/lib/ffi-gobject_introspection/i_base_info.rb +1 -1
  16. data/lib/ffi-gobject_introspection/i_callable_info.rb +2 -2
  17. data/lib/ffi-gobject_introspection/i_constant_info.rb +2 -2
  18. data/lib/ffi-gobject_introspection/i_enum_info.rb +2 -2
  19. data/lib/ffi-gobject_introspection/i_field_info.rb +1 -1
  20. data/lib/ffi-gobject_introspection/i_interface_info.rb +9 -9
  21. data/lib/ffi-gobject_introspection/i_object_info.rb +19 -14
  22. data/lib/ffi-gobject_introspection/i_property_info.rb +1 -1
  23. data/lib/ffi-gobject_introspection/i_repository.rb +1 -1
  24. data/lib/ffi-gobject_introspection/i_struct_info.rb +2 -2
  25. data/lib/ffi-gobject_introspection/i_type_info.rb +1 -1
  26. data/lib/ffi-gobject_introspection/i_union_info.rb +3 -3
  27. data/lib/ffi-gobject_introspection/i_vfunc_info.rb +2 -2
  28. data/lib/gir_ffi/builders/argument_builder.rb +2 -1
  29. data/lib/gir_ffi/builders/base_argument_builder.rb +1 -1
  30. data/lib/gir_ffi/builders/boxed_builder.rb +6 -0
  31. data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +7 -1
  32. data/lib/gir_ffi/builders/field_builder.rb +2 -4
  33. data/lib/gir_ffi/builders/object_builder.rb +20 -9
  34. data/lib/gir_ffi/builders/type_builder.rb +1 -1
  35. data/lib/gir_ffi/builders/unintrospectable_builder.rb +8 -0
  36. data/lib/gir_ffi/builders/with_layout.rb +0 -6
  37. data/lib/gir_ffi/core.rb +2 -1
  38. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
  39. data/lib/gir_ffi/info_ext/i_type_info.rb +10 -12
  40. data/lib/gir_ffi/object_base.rb +4 -2
  41. data/lib/gir_ffi/property_not_found_error.rb +12 -0
  42. data/lib/gir_ffi/signal_not_found_error.rb +12 -0
  43. data/lib/gir_ffi/sized_array.rb +4 -4
  44. data/lib/gir_ffi/type_map.rb +1 -1
  45. data/lib/gir_ffi/unintrospectable_boxed_info.rb +2 -1
  46. data/lib/gir_ffi/unintrospectable_signal_info.rb +39 -0
  47. data/lib/gir_ffi/version.rb +2 -1
  48. data/lib/gir_ffi-base/gobject/lib.rb +1 -1
  49. data/tasks/rubocop.rake +5 -0
  50. data/tasks/test.rake +7 -0
  51. data/test/ffi-gobject/object_test.rb +29 -1
  52. data/test/ffi-gobject_introspection/i_object_info_test.rb +16 -0
  53. data/test/ffi-gobject_test.rb +3 -6
  54. data/test/gir_ffi/builders/argument_builder_test.rb +2 -2
  55. data/test/gir_ffi/builders/object_builder_test.rb +25 -12
  56. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +21 -15
  57. data/test/integration/generated_gimarshallingtests_test.rb +16 -13
  58. data/test/integration/generated_gio_test.rb +2 -1
  59. data/test/integration/generated_gobject_test.rb +11 -1
  60. data/test/integration/generated_gst_test.rb +18 -0
  61. data/test/integration/generated_regress_test.rb +6 -8
  62. metadata +21 -2
@@ -730,11 +730,14 @@ describe GIMarshallingTests do
730
730
  result.must_equal 42
731
731
  end
732
732
 
733
- it 'does not have field accessor methods' do
734
- assert_raises(NoMethodError) { instance.parent_instance }
735
- assert_raises(NoMethodError) { instance.parent_instance = nil }
736
- assert_raises(NoMethodError) { instance.long_ }
737
- assert_raises(NoMethodError) { instance.long_ = 1 }
733
+ it 'does not have accessors for its parent instance' do
734
+ instance.wont_respond_to :parent_instance
735
+ instance.wont_respond_to :parent_instance=
736
+ end
737
+
738
+ it 'has a readable field long_' do
739
+ instance.long_.must_equal 0
740
+ instance.wont_respond_to :long_=
738
741
  end
739
742
  end
740
743
 
@@ -1208,7 +1211,7 @@ describe GIMarshallingTests do
1208
1211
  it 'creates an instance using #new' do
1209
1212
  so = GIMarshallingTests::SubObject.new
1210
1213
  so.must_be_instance_of GIMarshallingTests::SubObject
1211
- GObject.type_name(GObject.type_from_instance so).
1214
+ GObject.type_name_from_instance(so).
1212
1215
  must_equal 'GIMarshallingTestsSubObject'
1213
1216
  end
1214
1217
 
@@ -1224,9 +1227,9 @@ describe GIMarshallingTests do
1224
1227
  pass
1225
1228
  end
1226
1229
 
1227
- it 'does not have field accessors' do
1228
- assert_raises(NoMethodError) { instance.parent_instance }
1229
- assert_raises(NoMethodError) { instance.parent_instance = nil }
1230
+ it 'does not have accessors for its parent instance' do
1231
+ instance.wont_respond_to :parent_instance
1232
+ instance.wont_respond_to :parent_instance=
1230
1233
  end
1231
1234
  end
1232
1235
 
@@ -1234,15 +1237,15 @@ describe GIMarshallingTests do
1234
1237
  it 'creates an instance using #new' do
1235
1238
  so = GIMarshallingTests::SubSubObject.new
1236
1239
  assert_instance_of GIMarshallingTests::SubSubObject, so
1237
- GObject.type_name(GObject.type_from_instance so).
1240
+ GObject.type_name_from_instance(so).
1238
1241
  must_equal 'GIMarshallingTestsSubSubObject'
1239
1242
  end
1240
1243
 
1241
1244
  let(:instance) { GIMarshallingTests::SubSubObject.new }
1242
1245
 
1243
- it 'does not have field accessors' do
1244
- assert_raises(NoMethodError) { instance.parent_instance }
1245
- assert_raises(NoMethodError) { instance.parent_instance = nil }
1246
+ it 'does not have accessors for its parent instance' do
1247
+ instance.wont_respond_to :parent_instance
1248
+ instance.wont_respond_to :parent_instance=
1246
1249
  end
1247
1250
  end
1248
1251
 
@@ -4,6 +4,7 @@ GirFFI.setup :Gio
4
4
 
5
5
  # Tests generated methods and functions in the Gio namespace.
6
6
  describe 'The generated Gio module' do
7
+ # TODO: Allow Gio::File.new_for_path
7
8
  describe '#file_new_for_path, a method returning an interface,' do
8
9
  it 'returns an object of a more specific class' do
9
10
  file = Gio.file_new_for_path('/')
@@ -109,7 +110,7 @@ describe 'The generated Gio module' do
109
110
  end
110
111
 
111
112
  it 'cannot write the property "state-type" with #state_type=' do
112
- proc { simple_action.state_type = nil }.must_raise NoMethodError
113
+ simple_action.wont_respond_to :state_type=
113
114
  end
114
115
  end
115
116
  end
@@ -97,8 +97,18 @@ describe GObject do
97
97
  end
98
98
 
99
99
  it 'cannot write the property "target-property" with #target_property=' do
100
- proc { binding.target_property = 'foo' }.must_raise NoMethodError
100
+ binding.wont_respond_to :target_property=
101
101
  end
102
102
  end
103
103
  end
104
+
105
+ describe GObject::ParamSpec do
106
+ it 'does not have a separate #name field accessor' do
107
+ pspec = GObject.param_spec_int('foo', 'foo bar',
108
+ 'The Foo Bar Property',
109
+ 10, 20, 15,
110
+ 3)
111
+ pspec.wont_respond_to :name
112
+ end
113
+ end
104
114
  end
@@ -0,0 +1,18 @@
1
+ require 'gir_ffi_test_helper'
2
+
3
+ GirFFI.setup :Gst
4
+ Gst.init []
5
+
6
+ # Tests behavior of objects in the generated Gio namespace.
7
+ describe 'the generated Gst module' do
8
+ describe 'Gst::FakeSink' do
9
+ let(:instance) { Gst::ElementFactory.make('fakesink', 'sink') }
10
+
11
+ it 'allows the handoff signal to be connected and emitted' do
12
+ a = nil
13
+ instance.signal_connect('handoff') { a = 10 }
14
+ GObject.signal_emit(instance, 'handoff')
15
+ a.must_equal 10
16
+ end
17
+ end
18
+ end
@@ -1824,8 +1824,8 @@ describe Regress do
1824
1824
 
1825
1825
  it 'has a private field this_is_private' do
1826
1826
  skip 'This field is identified as readable in the typelib'
1827
- proc { instance.this_is_private }.must_raise NoMethodError
1828
- proc { instance.this_is_private = 42 }.must_raise NoMethodError
1827
+ instance.wont_respond_to :this_is_private
1828
+ instance.wont_respond_to :this_is_private=
1829
1829
  end
1830
1830
 
1831
1831
  it 'has a writable field this_is_public_after' do
@@ -2243,7 +2243,7 @@ describe Regress do
2243
2243
  end
2244
2244
 
2245
2245
  it 'does not have a field parent_instance' do
2246
- assert_raises(NoMethodError) { instance.parent_instance }
2246
+ instance.wont_respond_to :parent_instance
2247
2247
  end
2248
2248
  end
2249
2249
 
@@ -3314,10 +3314,8 @@ describe Regress do
3314
3314
  end
3315
3315
 
3316
3316
  it 'raises an appropriate NoMethodError when a function is not found' do
3317
- begin
3318
- Regress.this_method_does_not_exist
3319
- rescue => e
3320
- e.message.must_match(/^undefined method `this_method_does_not_exist' (for Regress:Module|on Regress \(Module\))$/)
3321
- end
3317
+ proc { Regress.this_method_does_not_exist }.
3318
+ must_raise(NoMethodError).
3319
+ message.must_match(/^undefined method `this_method_does_not_exist' (for Regress:Module|on Regress \(Module\))$/)
3322
3320
  end
3323
3321
  end
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.0
4
+ version: 0.9.1
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-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '10.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: aruba
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.12.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.12.0
111
125
  description: |2
112
126
  GirFFI creates bindings for GObject-based libraries at runtime based on introspection
113
127
  data provided by the GObject Introspection Repository (GIR) system. Bindings are created
@@ -274,15 +288,18 @@ files:
274
288
  - lib/gir_ffi/module_base.rb
275
289
  - lib/gir_ffi/object_base.rb
276
290
  - lib/gir_ffi/object_store.rb
291
+ - lib/gir_ffi/property_not_found_error.rb
277
292
  - lib/gir_ffi/receiver_argument_info.rb
278
293
  - lib/gir_ffi/receiver_type_info.rb
279
294
  - lib/gir_ffi/registered_type_base.rb
280
295
  - lib/gir_ffi/return_value_info.rb
296
+ - lib/gir_ffi/signal_not_found_error.rb
281
297
  - lib/gir_ffi/sized_array.rb
282
298
  - lib/gir_ffi/struct_base.rb
283
299
  - lib/gir_ffi/type_base.rb
284
300
  - lib/gir_ffi/type_map.rb
285
301
  - lib/gir_ffi/unintrospectable_boxed_info.rb
302
+ - lib/gir_ffi/unintrospectable_signal_info.rb
286
303
  - lib/gir_ffi/unintrospectable_type_info.rb
287
304
  - lib/gir_ffi/union_base.rb
288
305
  - lib/gir_ffi/user_data_argument_info.rb
@@ -293,6 +310,7 @@ files:
293
310
  - lib/gir_ffi/version.rb
294
311
  - lib/gir_ffi/vfunc_implementation.rb
295
312
  - lib/gir_ffi/zero_terminated.rb
313
+ - tasks/rubocop.rake
296
314
  - tasks/test.rake
297
315
  - test/base_test_helper.rb
298
316
  - test/ffi-glib/array_test.rb
@@ -390,6 +408,7 @@ files:
390
408
  - test/integration/generated_gio_test.rb
391
409
  - test/integration/generated_glib_test.rb
392
410
  - test/integration/generated_gobject_test.rb
411
+ - test/integration/generated_gst_test.rb
393
412
  - test/integration/generated_gtop_test.rb
394
413
  - test/integration/generated_pango_ft2_test.rb
395
414
  - test/integration/generated_pango_test.rb