Permalink
Browse files

Restore broken handling of array struct members

  • Loading branch information...
1 parent 2428883 commit b26b67f1f2f372647ae601cfd0784deba8dbf7b4 @mvz committed Jan 1, 2013
Showing with 16 additions and 2 deletions.
  1. +1 −2 lib/gir_ffi/type_map.rb
  2. +15 −0 test/ffi-gobject/value_test.rb
@@ -9,7 +9,6 @@ module TypeMap
:ghash => :pointer,
:glist => :pointer,
:gslist => :pointer,
- :array => :pointer,
:strv => :pointer,
:c => :pointer,
:object => :pointer,
@@ -40,7 +39,7 @@ def self.map_basic_type_or_string type
case type
when :gboolean
:int32
- when :utf8
+ when :utf8, :array
:pointer
else
map_basic_type(type)
@@ -3,6 +3,21 @@
require 'ffi-gobject'
describe GObject::Value do
+ describe "::Struct" do
+ describe "layout" do
+ let(:layout) { GObject::Value::Struct.layout }
+
+ it "consists of :g_type and :data" do
+ layout.members.must_equal [:g_type, :data]
+ end
+
+ it "has an array as its second element" do
+ types = layout.fields.map(&:type)
+ types[1].class.must_equal FFI::Type::Array
+ end
+ end
+ end
+
describe "::wrap_ruby_value" do
it "wraps a boolean false" do
gv = GObject::Value.wrap_ruby_value false

0 comments on commit b26b67f

Please sign in to comment.