gir_ffi 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 0.6.3 / 2013-06-15
2
+
3
+ * Make use of enums as element type for GHashTable and other containers
4
+ work
5
+
1
6
  == 0.6.2 / 2013-06-14
2
7
 
3
8
  * Handle introspectable types with introspectable parent types
@@ -25,7 +25,18 @@ module GirFFI
25
25
  @klass = optionally_define_constant namespace_module, @classname do
26
26
  lib.enum(enum_sym, value_spec)
27
27
  end
28
- setup_gtype_getter unless already_set_up
28
+ unless already_set_up
29
+ setup_gtype_getter
30
+ setup_inspect
31
+ end
32
+ end
33
+
34
+ def setup_inspect
35
+ @klass.instance_eval <<-EOS
36
+ def self.inspect
37
+ "#{@namespace}::#{@classname}"
38
+ end
39
+ EOS
29
40
  end
30
41
 
31
42
  def already_set_up
@@ -24,6 +24,8 @@ module GirFFI
24
24
  from_utf8 val
25
25
  when :gint32, :gint8
26
26
  self.new val
27
+ when FFI::Enum
28
+ self.new type[val]
27
29
  when :void
28
30
  ArgHelper.object_to_inptr val
29
31
  else
@@ -1,3 +1,3 @@
1
1
  module GirFFI
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -1,5 +1,21 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Type::Enum do
4
+ describe "creating Regress::TestEnum" do
5
+ before do
6
+ save_module :Regress
7
+ end
8
+
9
+ it "makes the created type know its proper name" do
10
+ info = get_introspection_data 'Regress', 'TestEnum'
11
+ builder = GirFFI::Builder::Type::Enum.new info
12
+ enum = builder.build_class
13
+ enum.inspect.must_equal "Regress::TestEnum"
14
+ end
15
+
16
+ after do
17
+ restore_module :Regress
18
+ end
19
+ end
4
20
  end
5
21
 
@@ -95,6 +95,12 @@ describe GirFFI::InPointer do
95
95
  result = GirFFI::InPointer.from :gint8, 23
96
96
  assert_equal 23, result.address
97
97
  end
98
+
99
+ it "handles enum types" do
100
+ e = FFI::Enum.new [:foo, :bar, :baz]
101
+ ptr = GirFFI::InPointer.from e, :bar
102
+ ptr.address.must_equal 1
103
+ end
98
104
  end
99
105
  end
100
106
 
@@ -0,0 +1,14 @@
1
+ require 'gir_ffi_test_helper'
2
+
3
+ describe "The generated Secret module" do
4
+ describe "Secret::Schema" do
5
+ it "has a working constructor" do
6
+ begin
7
+ GirFFI.setup :Secret
8
+ rescue
9
+ skip "No GIR data for Secret available"
10
+ end
11
+ Secret::Schema.new("foo", :none, "bar" => :string)
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-14 00:00:00.000000000 Z
12
+ date: 2013-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -234,6 +234,7 @@ files:
234
234
  - test/integration/generated_gimarshallingtests_test.rb
235
235
  - test/integration/generated_gio_test.rb
236
236
  - test/integration/generated_pango_test.rb
237
+ - test/integration/generated_secret_test.rb
237
238
  - test/integration/generated_gobject_test.rb
238
239
  - test/gir_ffi/builder/type/user_defined_test.rb
239
240
  - test/gir_ffi/builder/type/enum_test.rb
@@ -403,6 +404,7 @@ test_files:
403
404
  - test/integration/generated_pango_ft2_test.rb
404
405
  - test/integration/generated_pango_test.rb
405
406
  - test/integration/generated_regress_test.rb
407
+ - test/integration/generated_secret_test.rb
406
408
  - test/integration/method_lookup_test.rb
407
409
  - test/introspection_test_helper.rb
408
410
  - test/lib/Makefile.am