gir_ffi 0.6.7 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{History.txt → Changelog.md} +93 -61
- data/{DESIGN.rdoc → DESIGN.md} +7 -7
- data/README.md +5 -7
- data/TODO.md +90 -0
- data/lib/ffi-glib.rb +0 -1
- data/lib/ffi-glib/array.rb +13 -29
- data/lib/ffi-glib/array_methods.rb +13 -0
- data/lib/ffi-glib/container_class_methods.rb +6 -1
- data/lib/ffi-glib/hash_table.rb +3 -2
- data/lib/ffi-glib/list.rb +3 -17
- data/lib/ffi-glib/list_methods.rb +22 -3
- data/lib/ffi-glib/ptr_array.rb +19 -19
- data/lib/ffi-glib/s_list.rb +3 -17
- data/lib/ffi-gobject.rb +10 -17
- data/lib/ffi-gobject/object.rb +19 -9
- data/lib/ffi-gobject/object_class.rb +14 -0
- data/lib/ffi-gobject/ruby_closure.rb +4 -5
- data/lib/ffi-gobject/value.rb +7 -5
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
- data/lib/gir_ffi-base.rb +0 -2
- data/lib/gir_ffi-base/gobject.rb +1 -0
- data/lib/gir_ffi-base/gobject/lib.rb +1 -1
- data/lib/gir_ffi.rb +2 -0
- data/lib/gir_ffi/arg_helper.rb +18 -8
- data/lib/gir_ffi/builders/argument_builder.rb +62 -55
- data/lib/gir_ffi/builders/base_argument_builder.rb +52 -106
- data/lib/gir_ffi/builders/base_type_builder.rb +3 -3
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +34 -0
- data/lib/gir_ffi/builders/callback_argument_builder.rb +73 -0
- data/lib/gir_ffi/builders/callback_builder.rb +19 -9
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +54 -0
- data/lib/gir_ffi/builders/closure_convertor.rb +9 -0
- data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +9 -0
- data/lib/gir_ffi/builders/constructor_result_convertor.rb +9 -0
- data/lib/gir_ffi/builders/enum_builder.rb +16 -16
- data/lib/gir_ffi/builders/field_builder.rb +36 -15
- data/lib/gir_ffi/builders/function_builder.rb +32 -27
- data/lib/gir_ffi/builders/interface_builder.rb +14 -4
- data/lib/gir_ffi/builders/mapping_method_builder.rb +95 -43
- data/lib/gir_ffi/builders/module_builder.rb +22 -35
- data/lib/gir_ffi/builders/null_convertor.rb +9 -0
- data/lib/gir_ffi/builders/object_builder.rb +11 -14
- data/lib/gir_ffi/builders/property_builder.rb +107 -9
- data/lib/gir_ffi/builders/registered_type_builder.rb +2 -2
- data/lib/gir_ffi/builders/return_value_builder.rb +42 -33
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +15 -0
- data/lib/gir_ffi/builders/signal_builder.rb +18 -58
- data/lib/gir_ffi/builders/struct_builder.rb +1 -2
- data/lib/gir_ffi/builders/type_builder.rb +1 -0
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +4 -4
- data/lib/gir_ffi/builders/user_defined_builder.rb +151 -26
- data/lib/gir_ffi/builders/vfunc_builder.rb +57 -0
- data/lib/gir_ffi/builders/with_layout.rb +10 -8
- data/lib/gir_ffi/builders/with_methods.rb +1 -1
- data/lib/gir_ffi/callback_base.rb +42 -8
- data/lib/gir_ffi/class_base.rb +1 -2
- data/lib/gir_ffi/enum_base.rb +26 -4
- data/lib/gir_ffi/error_argument_info.rb +21 -0
- data/lib/gir_ffi/{setter_argument_info.rb → field_argument_info.rb} +2 -1
- data/lib/gir_ffi/g_type.rb +25 -0
- data/lib/gir_ffi/in_out_pointer.rb +3 -14
- data/lib/gir_ffi/in_pointer.rb +20 -21
- data/lib/gir_ffi/info_ext.rb +2 -0
- data/lib/gir_ffi/info_ext/i_callable_info.rb +0 -9
- data/lib/gir_ffi/info_ext/i_callback_info.rb +17 -0
- data/lib/gir_ffi/info_ext/i_function_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_property_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_signal_info.rb +14 -16
- data/lib/gir_ffi/info_ext/i_type_info.rb +72 -34
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +12 -0
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +3 -2
- data/lib/gir_ffi/interface_base.rb +8 -3
- data/lib/gir_ffi/module_base.rb +3 -5
- data/lib/gir_ffi/object_base.rb +8 -0
- data/lib/gir_ffi/receiver_argument_info.rb +21 -0
- data/lib/gir_ffi/receiver_type_info.rb +27 -0
- data/lib/gir_ffi/return_value_info.rb +23 -0
- data/lib/gir_ffi/signal_base.rb +1 -1
- data/lib/{ffi-glib → gir_ffi}/sized_array.rb +10 -6
- data/lib/gir_ffi/struct_base.rb +10 -9
- data/lib/gir_ffi/type_base.rb +1 -0
- data/lib/gir_ffi/type_map.rb +3 -0
- data/lib/gir_ffi/unintrospectable_type_info.rb +4 -1
- data/lib/gir_ffi/union_base.rb +4 -21
- data/lib/gir_ffi/user_data_argument_info.rb +21 -0
- data/lib/gir_ffi/user_data_type_info.rb +17 -0
- data/lib/gir_ffi/user_defined_type_info.rb +18 -4
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/vfunc_base.rb +8 -0
- data/lib/gir_ffi/vfunc_implementation.rb +11 -0
- data/lib/gir_ffi/zero_terminated.rb +18 -24
- data/test/base_test_helper.rb +2 -3
- data/test/ffi-glib/array_test.rb +3 -3
- data/test/ffi-glib/ruby_closure_test.rb +3 -3
- data/test/ffi-gobject/value_test.rb +15 -1
- data/test/ffi-gobject_test.rb +2 -1
- data/test/gir_ffi/arg_helper_test.rb +21 -2
- data/test/gir_ffi/builders/argument_builder_test.rb +213 -287
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
- data/test/gir_ffi/builders/callback_builder_test.rb +26 -8
- data/test/gir_ffi/builders/field_builder_test.rb +18 -3
- data/test/gir_ffi/builders/function_builder_test.rb +30 -12
- data/test/gir_ffi/builders/interface_builder_test.rb +9 -0
- data/test/gir_ffi/builders/module_builder_test.rb +0 -39
- data/test/gir_ffi/builders/object_builder_test.rb +27 -27
- data/test/gir_ffi/builders/property_builder_test.rb +110 -0
- data/test/gir_ffi/builders/return_value_builder_test.rb +168 -200
- data/test/gir_ffi/builders/signal_builder_test.rb +58 -14
- data/test/gir_ffi/builders/struct_builder_test.rb +2 -41
- data/test/gir_ffi/builders/user_defined_builder_test.rb +88 -20
- data/test/gir_ffi/builders/vfunc_builder_test.rb +44 -0
- data/test/gir_ffi/g_type_test.rb +29 -0
- data/test/gir_ffi/in_pointer_test.rb +28 -9
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +0 -9
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +19 -0
- data/test/gir_ffi/info_ext/i_function_info_test.rb +9 -0
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -11
- data/test/gir_ffi/info_ext/i_type_info_test.rb +140 -16
- data/test/gir_ffi/interface_base_test.rb +9 -3
- data/test/gir_ffi/object_base_test.rb +1 -2
- data/test/{ffi-glib → gir_ffi}/sized_array_test.rb +28 -28
- data/test/gir_ffi/type_map_test.rb +1 -1
- data/test/gir_ffi/user_defined_type_info_test.rb +36 -4
- data/test/gir_ffi_test.rb +5 -5
- data/test/gir_ffi_test_helper.rb +4 -0
- data/test/integration/generated_gimarshallingtests_test.rb +163 -59
- data/test/integration/generated_gobject_test.rb +21 -8
- data/test/integration/generated_pango_test.rb +2 -2
- data/test/integration/generated_regress_test.rb +361 -101
- data/test/lib/autogen.sh +5 -1
- metadata +51 -35
- data/TODO.rdoc +0 -63
- data/lib/gir_ffi-base/gir_ffi/library.rb +0 -17
- data/lib/gir_ffi-base/gir_ffi/struct.rb +0 -27
@@ -0,0 +1,23 @@
|
|
1
|
+
module GirFFI
|
2
|
+
# Represents a return value with the same interface as IArgumentInfo
|
3
|
+
class ReturnValueInfo
|
4
|
+
attr_reader :argument_type
|
5
|
+
|
6
|
+
def initialize type, skip = false
|
7
|
+
@argument_type = type
|
8
|
+
@skip = skip
|
9
|
+
end
|
10
|
+
|
11
|
+
def skip?
|
12
|
+
@skip
|
13
|
+
end
|
14
|
+
|
15
|
+
def direction
|
16
|
+
:return
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/gir_ffi/signal_base.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
module GLib
|
1
|
+
module GirFFI
|
3
2
|
# Class representing an array with a determined size
|
4
3
|
class SizedArray
|
5
4
|
include Enumerable
|
@@ -34,6 +33,10 @@ module GLib
|
|
34
33
|
size * element_size
|
35
34
|
end
|
36
35
|
|
36
|
+
def self.get_value_from_pointer pointer
|
37
|
+
pointer
|
38
|
+
end
|
39
|
+
|
37
40
|
def self.copy_value_to_pointer value, pointer
|
38
41
|
size = value.size_in_bytes
|
39
42
|
pointer.put_bytes(0, value.to_ptr.read_bytes(size), 0, size)
|
@@ -70,14 +73,15 @@ module GLib
|
|
70
73
|
private
|
71
74
|
|
72
75
|
def from_sized_array size, sized_array
|
73
|
-
check_size
|
76
|
+
check_size size, sized_array.size
|
74
77
|
sized_array
|
75
78
|
end
|
76
79
|
|
77
|
-
def from_enumerable element_type,
|
78
|
-
|
80
|
+
def from_enumerable element_type, expected_size, arr
|
81
|
+
size = arr.size
|
82
|
+
check_size expected_size, size
|
79
83
|
ptr = GirFFI::InPointer.from_array element_type, arr
|
80
|
-
self.wrap element_type,
|
84
|
+
self.wrap element_type, size, ptr
|
81
85
|
end
|
82
86
|
|
83
87
|
def check_size(expected_size, size)
|
data/lib/gir_ffi/struct_base.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
+
require 'gir_ffi/class_base'
|
2
|
+
|
1
3
|
module GirFFI
|
4
|
+
# Base class for generated classes representing GLib structs.
|
2
5
|
class StructBase < ClassBase
|
3
6
|
extend FFI::DataConverter
|
4
|
-
def self.native_type
|
5
|
-
self::Struct.native_type
|
6
|
-
end
|
7
7
|
|
8
|
-
def self.
|
9
|
-
|
8
|
+
def self.native_type
|
9
|
+
FFI::Type::Struct.new(self::Struct)
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.to_ffitype
|
13
13
|
self
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.
|
17
|
-
|
16
|
+
def self.get_value_from_pointer pointer
|
17
|
+
pointer.to_ptr
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.
|
21
|
-
self::Struct.
|
20
|
+
def self.copy_value_to_pointer value, pointer, offset=0
|
21
|
+
size = self::Struct.size
|
22
|
+
pointer.put_bytes offset, value.to_ptr.read_bytes(size), 0, size
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
data/lib/gir_ffi/type_base.rb
CHANGED
data/lib/gir_ffi/type_map.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'gir_ffi/sized_array'
|
2
|
+
|
1
3
|
module GirFFI
|
2
4
|
module TypeMap
|
3
5
|
sz = FFI.type_size(:size_t) * 8
|
@@ -15,6 +17,7 @@ module GirFFI
|
|
15
17
|
:error => :pointer,
|
16
18
|
:ptr_array => :pointer,
|
17
19
|
:array => :pointer,
|
20
|
+
:c => GirFFI::SizedArray,
|
18
21
|
:utf8 => :pointer,
|
19
22
|
:GType => gtype_type,
|
20
23
|
:gboolean => GLib::Boolean,
|
@@ -21,10 +21,13 @@ module GirFFI
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def parent
|
24
|
-
parent_gtype = @gobject.type_parent(@g_type)
|
25
24
|
@gir.find_by_gtype(parent_gtype) || self.class.new(parent_gtype, @gir, @gobject)
|
26
25
|
end
|
27
26
|
|
27
|
+
def parent_gtype
|
28
|
+
@parent_gtype ||= @gobject.type_parent @g_type
|
29
|
+
end
|
30
|
+
|
28
31
|
def namespace
|
29
32
|
parent.namespace
|
30
33
|
end
|
data/lib/gir_ffi/union_base.rb
CHANGED
@@ -1,24 +1,7 @@
|
|
1
|
-
|
2
|
-
class UnionBase < ClassBase
|
3
|
-
extend FFI::DataConverter
|
4
|
-
|
5
|
-
def self.native_type
|
6
|
-
FFI::Type::Struct.new(self::Struct)
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.to_ffitype
|
10
|
-
self
|
11
|
-
end
|
1
|
+
require 'gir_ffi/struct_base'
|
12
2
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
# FIXME: Duplicate of GirFFI::Struct
|
19
|
-
def self.copy_value_to_pointer value, pointer, offset=0
|
20
|
-
size = self::Struct.size
|
21
|
-
pointer.put_bytes offset, value.to_ptr.read_bytes(size), 0, size
|
22
|
-
end
|
3
|
+
module GirFFI
|
4
|
+
# Base class for generated classes representing GLib unions.
|
5
|
+
class UnionBase < StructBase
|
23
6
|
end
|
24
7
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Class to represent the info for the user data argument of a signal handler.
|
2
|
+
# Implements the necessary parts of IArgumentInfo's interface.
|
3
|
+
class GirFFI::UserDataArgumentInfo
|
4
|
+
attr_reader :argument_type
|
5
|
+
|
6
|
+
def initialize type
|
7
|
+
@argument_type = type
|
8
|
+
end
|
9
|
+
|
10
|
+
def direction
|
11
|
+
:in
|
12
|
+
end
|
13
|
+
|
14
|
+
def skip?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
"_user_data"
|
20
|
+
end
|
21
|
+
end
|
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'gir_ffi/user_defined_property_info'
|
2
|
+
require 'gir_ffi/vfunc_implementation'
|
2
3
|
|
3
4
|
module GirFFI
|
4
5
|
# Represents a user defined type, conforming, as needed, to the interface of
|
5
6
|
# GObjectIntrospection::IObjectInfo.
|
6
7
|
class UserDefinedTypeInfo
|
7
|
-
|
8
|
+
attr_reader :properties, :vfunc_implementations
|
9
|
+
|
10
|
+
def initialize klass
|
8
11
|
@klass = klass
|
9
12
|
@properties = []
|
10
|
-
|
13
|
+
@vfunc_implementations = []
|
14
|
+
yield self if block_given?
|
11
15
|
end
|
12
16
|
|
13
17
|
def described_class
|
@@ -18,8 +22,18 @@ module GirFFI
|
|
18
22
|
@properties << UserDefinedPropertyInfo.new(property)
|
19
23
|
end
|
20
24
|
|
21
|
-
def
|
22
|
-
@
|
25
|
+
def install_vfunc_implementation name, implementation
|
26
|
+
@vfunc_implementations << VFuncImplementation.new(name, implementation)
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_instance_method _method
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
attr_writer :g_name
|
34
|
+
|
35
|
+
def g_name
|
36
|
+
@g_name ||= @klass.name
|
23
37
|
end
|
24
38
|
end
|
25
39
|
end
|
data/lib/gir_ffi/version.rb
CHANGED
@@ -27,10 +27,7 @@ module GirFFI
|
|
27
27
|
offset = 0
|
28
28
|
while val = read_value(offset)
|
29
29
|
offset += FFI.type_size(ffi_type)
|
30
|
-
|
31
|
-
val = element_class.wrap val
|
32
|
-
end
|
33
|
-
yield val
|
30
|
+
yield wrap_value(val)
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
@@ -41,39 +38,36 @@ module GirFFI
|
|
41
38
|
private
|
42
39
|
|
43
40
|
def read_value offset
|
44
|
-
val = @ptr.send(
|
45
|
-
return val unless is_null_value(val)
|
41
|
+
val = @ptr.send(getter_method, offset)
|
42
|
+
return val unless is_null_value?(val)
|
46
43
|
end
|
47
44
|
|
48
|
-
def
|
49
|
-
@
|
50
|
-
end
|
51
|
-
|
52
|
-
def complex_element_type?
|
53
|
-
Array === element_type
|
45
|
+
def getter_method
|
46
|
+
@getter_method ||= "get_#{ffi_type}"
|
54
47
|
end
|
55
48
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
49
|
+
def wrap_value(val)
|
50
|
+
case element_type
|
51
|
+
when Array
|
52
|
+
element_type.last.wrap val
|
53
|
+
when Class
|
54
|
+
element_type.wrap val
|
59
55
|
else
|
60
|
-
|
56
|
+
val
|
61
57
|
end
|
62
58
|
end
|
63
59
|
|
64
|
-
def
|
65
|
-
|
60
|
+
def ffi_type
|
61
|
+
@ffi_type ||= TypeMap.type_specification_to_ffitype element_type
|
62
|
+
end
|
63
|
+
|
64
|
+
def is_null_value? value
|
65
|
+
if ffi_type == :pointer
|
66
66
|
value.null?
|
67
67
|
else
|
68
68
|
value == 0
|
69
69
|
end
|
70
70
|
end
|
71
|
-
|
72
|
-
def element_class
|
73
|
-
if complex_element_type?
|
74
|
-
element_type.last
|
75
|
-
end
|
76
|
-
end
|
77
71
|
end
|
78
72
|
end
|
79
73
|
|
data/test/base_test_helper.rb
CHANGED
@@ -2,11 +2,12 @@ if RUBY_PLATFORM == 'java'
|
|
2
2
|
require 'rubygems'
|
3
3
|
end
|
4
4
|
|
5
|
-
|
5
|
+
begin
|
6
6
|
require 'simplecov'
|
7
7
|
SimpleCov.start do
|
8
8
|
add_filter "/test/"
|
9
9
|
end
|
10
|
+
rescue LoadError
|
10
11
|
end
|
11
12
|
|
12
13
|
require 'minitest/autorun'
|
@@ -37,8 +38,6 @@ end
|
|
37
38
|
Thread.abort_on_exception = true
|
38
39
|
|
39
40
|
class Minitest::Test
|
40
|
-
include RR::Adapters::TestUnit
|
41
|
-
|
42
41
|
def assert_defines_singleton_method klass, method, msg = nil
|
43
42
|
method = method.to_sym
|
44
43
|
methods = klass.singleton_methods(false).map { |name| name.to_sym }
|
data/test/ffi-glib/array_test.rb
CHANGED
@@ -70,18 +70,18 @@ describe GLib::Array do
|
|
70
70
|
describe ".from" do
|
71
71
|
it "creates a GArray from an array of :gint32" do
|
72
72
|
arr = GLib::Array.from :gint32, [3, 2, 1]
|
73
|
-
arr.
|
73
|
+
arr.data_ptr.read_array_of_int32(3).must_equal [3, 2, 1]
|
74
74
|
end
|
75
75
|
|
76
76
|
it "creates a GArray from an array of :gboolean" do
|
77
77
|
arr = GLib::Array.from :gboolean, [true, false, true]
|
78
|
-
arr.
|
78
|
+
arr.data_ptr.read_array_of_int(3).must_equal [1, 0, 1]
|
79
79
|
end
|
80
80
|
|
81
81
|
it "return its argument if given a GArray" do
|
82
82
|
arr = GLib::Array.new :gint32
|
83
83
|
arr.append_vals [3, 2, 1]
|
84
|
-
arr2 = GLib::Array.from :
|
84
|
+
arr2 = GLib::Array.from :gint32, arr
|
85
85
|
assert arr2.equal? arr
|
86
86
|
end
|
87
87
|
|
@@ -24,7 +24,7 @@ describe GObject::RubyClosure do
|
|
24
24
|
it "invokes its closure argument's block" do
|
25
25
|
a = 0
|
26
26
|
c = GObject::RubyClosure.new { a = 2 }
|
27
|
-
GObject::RubyClosure.marshaller(c, nil,
|
27
|
+
GObject::RubyClosure.marshaller(c, nil, nil, nil, nil)
|
28
28
|
assert_equal 2, a
|
29
29
|
end
|
30
30
|
|
@@ -32,14 +32,14 @@ describe GObject::RubyClosure do
|
|
32
32
|
a = 0
|
33
33
|
c = GObject::RubyClosure.new { a = 2 }
|
34
34
|
c2 = GObject::Closure.wrap(c.to_ptr)
|
35
|
-
GObject::RubyClosure.marshaller(c2, nil,
|
35
|
+
GObject::RubyClosure.marshaller(c2, nil, nil, nil, nil)
|
36
36
|
assert_equal 2, a
|
37
37
|
end
|
38
38
|
|
39
39
|
it "stores the closure's return value in the proper gvalue" do
|
40
40
|
c = GObject::RubyClosure.new { 2 }
|
41
41
|
gv = GObject::Value.new
|
42
|
-
GObject::RubyClosure.marshaller(c, gv,
|
42
|
+
GObject::RubyClosure.marshaller(c, gv, nil, nil, nil)
|
43
43
|
assert_equal 2, gv.get_value
|
44
44
|
end
|
45
45
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'gir_ffi_test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
GirFFI.setup :Regress
|
4
4
|
|
5
5
|
describe GObject::Value do
|
6
6
|
describe "::Struct" do
|
@@ -128,6 +128,20 @@ describe GObject::Value do
|
|
128
128
|
gv.get_value.must_equal value
|
129
129
|
end
|
130
130
|
|
131
|
+
it "unwraps an enum value" do
|
132
|
+
value = :value2
|
133
|
+
gv = GObject::Value.for_g_type Regress::TestEnum.get_gtype
|
134
|
+
gv.set_enum Regress::TestEnum[value]
|
135
|
+
gv.get_value.must_equal value
|
136
|
+
end
|
137
|
+
|
138
|
+
it "unwraps a flags value" do
|
139
|
+
value = Regress::TestFlags[:flag1] | Regress::TestFlags[:flag3]
|
140
|
+
gv = GObject::Value.for_g_type Regress::TestFlags.get_gtype
|
141
|
+
gv.set_flags value
|
142
|
+
gv.get_value.must_equal value
|
143
|
+
end
|
144
|
+
|
131
145
|
it "unwraps a GType" do
|
132
146
|
value = GObject::TYPE_STRING
|
133
147
|
gv = GObject::Value.for_g_type GObject::TYPE_GTYPE
|