gir_ffi 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/History.txt +7 -0
  2. data/{README.rdoc → README.md} +31 -25
  3. data/Rakefile +1 -1
  4. data/TODO.rdoc +1 -1
  5. data/lib/ffi-glib.rb +5 -5
  6. data/lib/ffi-glib/container_class_methods.rb +1 -2
  7. data/lib/ffi-glib/list_methods.rb +16 -6
  8. data/lib/ffi-gobject.rb +4 -7
  9. data/lib/ffi-gobject/helper.rb +6 -6
  10. data/lib/ffi-gobject/object.rb +4 -4
  11. data/lib/ffi-gobject_introspection.rb +0 -1
  12. data/lib/ffi-gobject_introspection/g_error.rb +15 -5
  13. data/lib/ffi-gobject_introspection/i_base_info.rb +7 -4
  14. data/lib/ffi-gobject_introspection/i_function_info.rb +3 -1
  15. data/lib/ffi-gobject_introspection/i_repository.rb +8 -15
  16. data/lib/ffi-gobject_introspection/i_struct_info.rb +5 -10
  17. data/lib/gir_ffi-base.rb +2 -0
  18. data/lib/gir_ffi-base/glib/strv.rb +43 -0
  19. data/lib/{ffi-gobject_introspection/gobject_lib.rb → gir_ffi-base/gobject/lib.rb} +4 -2
  20. data/lib/gir_ffi/arg_helper.rb +4 -2
  21. data/lib/gir_ffi/builder.rb +1 -7
  22. data/lib/gir_ffi/builder/argument.rb +34 -108
  23. data/lib/gir_ffi/builder/argument/base.rb +26 -20
  24. data/lib/gir_ffi/builder/type/object.rb +14 -2
  25. data/lib/gir_ffi/builder/type/registered_type.rb +1 -11
  26. data/lib/gir_ffi/class_base.rb +21 -26
  27. data/lib/gir_ffi/in_pointer.rb +11 -5
  28. data/lib/gir_ffi/info_ext/i_type_info.rb +26 -0
  29. data/lib/gir_ffi/interface_base.rb +10 -0
  30. data/lib/gir_ffi/module_base.rb +14 -4
  31. data/lib/gir_ffi/object_base.rb +39 -0
  32. data/lib/gir_ffi/type_map.rb +1 -3
  33. data/lib/gir_ffi/version.rb +1 -1
  34. data/tasks/test.rake +33 -44
  35. data/test/{test_helper.rb → base_test_helper.rb} +2 -11
  36. data/test/ffi-glib/array_test.rb +1 -1
  37. data/test/ffi-glib/byte_array_test.rb +1 -1
  38. data/test/ffi-glib/hash_table_test.rb +30 -1
  39. data/test/ffi-glib/list_test.rb +1 -1
  40. data/test/ffi-glib/ptr_array_test.rb +1 -1
  41. data/test/ffi-glib/ruby_closure_test.rb +54 -0
  42. data/test/ffi-glib/s_list_test.rb +1 -1
  43. data/test/ffi-gobject/gobject_test.rb +1 -1
  44. data/test/ffi-gobject/helper_test.rb +103 -0
  45. data/test/ffi-gobject/object_class_test.rb +1 -1
  46. data/test/ffi-gobject/object_test.rb +1 -1
  47. data/test/ffi-gobject/ruby_style_test.rb +1 -1
  48. data/test/ffi-gobject/value_test.rb +1 -1
  49. data/test/ffi-gobject_introspection/i_base_info_test.rb +1 -1
  50. data/test/ffi-gobject_introspection/i_constant_info_test.rb +1 -1
  51. data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -1
  52. data/test/ffi-gobject_introspection/i_object_info_test.rb +1 -1
  53. data/test/ffi-gobject_introspection/i_repository_test.rb +1 -1
  54. data/test/ffi-gobject_introspection/lib_test.rb +1 -1
  55. data/test/ffi-gobject_test.rb +120 -0
  56. data/test/{ffi-glib → gir_ffi-base/glib}/strv_test.rb +8 -5
  57. data/test/{unit → gir_ffi}/arg_helper_test.rb +2 -2
  58. data/test/{unit/argument_builder_test.rb → gir_ffi/builder/argument/base_test.rb} +1 -13
  59. data/test/{unit/function_builder_test.rb → gir_ffi/builder/function_test.rb} +2 -2
  60. data/test/{unit/module_builder_test.rb → gir_ffi/builder/module_test.rb} +1 -1
  61. data/test/{unit/callback_builder_test.rb → gir_ffi/builder/type/callback_test.rb} +1 -1
  62. data/test/{unit/constant_builder_test.rb → gir_ffi/builder/type/constant_test.rb} +1 -1
  63. data/test/{unit/enum_builder_test.rb → gir_ffi/builder/type/enum_test.rb} +1 -1
  64. data/test/{unit/interface_builder_test.rb → gir_ffi/builder/type/interface_test.rb} +1 -4
  65. data/test/{unit/object_type_builder_test.rb → gir_ffi/builder/type/object_test.rb} +21 -2
  66. data/test/{unit/struct_builder_test.rb → gir_ffi/builder/type/struct_test.rb} +1 -1
  67. data/test/{unit/unintrospectable_type_builder_test.rb → gir_ffi/builder/type/unintrospectable_test.rb} +1 -1
  68. data/test/{unit/union_builder_test.rb → gir_ffi/builder/type/union_test.rb} +9 -3
  69. data/test/{unit/user_defined_type_builder_test.rb → gir_ffi/builder/type/user_defined_test.rb} +4 -2
  70. data/test/gir_ffi/builder_test.rb +398 -0
  71. data/test/{unit → gir_ffi}/callback_helper_test.rb +1 -1
  72. data/test/{unit → gir_ffi}/class_base_test.rb +1 -1
  73. data/test/{unit → gir_ffi}/in_out_pointer_test.rb +1 -1
  74. data/test/{unit → gir_ffi}/in_pointer_test.rb +24 -3
  75. data/test/{unit → gir_ffi/info_ext}/i_field_info_test.rb +1 -1
  76. data/test/gir_ffi/info_ext/i_type_info_test.rb +71 -0
  77. data/test/{unit/user_defined_object_info_test.rb → gir_ffi/user_defined/i_object_info_test.rb} +1 -1
  78. data/test/{unit/user_defined_property_info_test.rb → gir_ffi/user_defined/i_property_info_test.rb} +1 -1
  79. data/test/{unit/user_defined_registered_type_info_test.rb → gir_ffi/user_defined/i_registered_type_info_test.rb} +1 -1
  80. data/test/{unit → gir_ffi}/variable_name_generator_test.rb +1 -1
  81. data/test/{unit/gir_ffi_test.rb → gir_ffi_test.rb} +24 -4
  82. data/test/gir_ffi_test_helper.rb +1 -1
  83. data/test/integration/derived_classes_test.rb +1 -1
  84. data/test/integration/generated_gimarshallingtests_test.rb +1 -1
  85. data/test/integration/generated_gio_test.rb +1 -1
  86. data/test/integration/generated_gobject_test.rb +1 -1
  87. data/test/integration/generated_regress_test.rb +2 -3
  88. data/test/integration/method_lookup_test.rb +1 -1
  89. data/test/integration/pretty_print_test.rb +1 -1
  90. data/test/introspection_test_helper.rb +11 -0
  91. metadata +71 -77
  92. data/lib/ffi-glib/strv.rb +0 -31
  93. data/test/builder_test.rb +0 -264
  94. data/test/ffi-glib/glib_overrides_test.rb +0 -38
  95. data/test/ffi-gobject/g_object_overrides_test.rb +0 -274
  96. data/test/girffi_test.rb +0 -27
  97. data/test/integration/generated_pango_test.rb +0 -20
  98. data/test/type_builder_test.rb +0 -36
  99. data/test/unit/builder_test.rb +0 -143
  100. data/test/unit/hash_table_element_type_provider_test.rb +0 -16
  101. data/test/unit/i_type_info_test.rb +0 -23
  102. data/test/unit/list_element_type_provider_test.rb +0 -13
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::SList do
4
4
  it "knows its element type" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  require 'ffi-gobject'
4
4
 
@@ -0,0 +1,103 @@
1
+ require 'gir_ffi_test_helper'
2
+
3
+ describe GObject::Helper do
4
+ before do
5
+ GirFFI.setup :Regress
6
+ end
7
+
8
+ describe "#signal_arguments_to_gvalue_array" do
9
+ describe "the result of wrapping test-with-static-scope-arg" do
10
+ setup do
11
+ o = Regress::TestSubObj.new
12
+ b = Regress::TestSimpleBoxedA.new
13
+
14
+ @gva =
15
+ GObject::Helper.signal_arguments_to_gvalue_array(
16
+ "test-with-static-scope-arg", o, b)
17
+ end
18
+
19
+ should "be a GObject::ValueArray" do
20
+ assert_instance_of GObject::ValueArray, @gva
21
+ end
22
+
23
+ should "contain two values" do
24
+ assert_equal 2, @gva.n_values
25
+ end
26
+
27
+ should "have a first value with GType for TestSubObj" do
28
+ assert_equal Regress::TestSubObj.get_gtype, (@gva.get_nth 0).current_gtype
29
+ end
30
+
31
+ should "have a second value with GType for TestSimpleBoxedA" do
32
+ assert_equal Regress::TestSimpleBoxedA.get_gtype, (@gva.get_nth 1).current_gtype
33
+ end
34
+ end
35
+ end
36
+
37
+ describe "#signal_argument_to_gvalue" do
38
+ it "maps a :utf8 argument to a string-valued GValue" do
39
+ stub(arg_t = Object.new).tag { :utf8 }
40
+ stub(info = Object.new).argument_type { arg_t }
41
+ val =
42
+ GObject::Helper.signal_argument_to_gvalue(
43
+ info, "foo")
44
+ assert_instance_of GObject::Value, val
45
+ assert_equal "foo", val.get_string
46
+ end
47
+ end
48
+
49
+ describe "#cast_back_signal_arguments" do
50
+ it "correctly casts back pointers for the test-with-static-scope-arg signal" do
51
+ o = Regress::TestSubObj.new
52
+ b = Regress::TestSimpleBoxedA.new
53
+ ud = GirFFI::ArgHelper.object_to_inptr "Hello!"
54
+
55
+ assert_equal "Hello!", GirFFI::ArgHelper::OBJECT_STORE[ud.address]
56
+
57
+ sig = o.class.find_signal "test-with-static-scope-arg"
58
+
59
+ gva =
60
+ GObject::Helper.cast_back_signal_arguments(
61
+ sig, o.class, o.to_ptr, b.to_ptr, ud)
62
+
63
+ klasses = gva.map {|it| it.class}
64
+ klasses.must_equal [ Regress::TestSubObj,
65
+ Regress::TestSimpleBoxedA,
66
+ String ]
67
+ gva[2].must_equal "Hello!"
68
+ end
69
+ end
70
+
71
+ describe "#cast_signal_argument" do
72
+ describe "with info for an enum" do
73
+ before do
74
+ enuminfo = get_introspection_data 'GLib', 'DateMonth'
75
+ stub(arg_t = Object.new).interface { enuminfo }
76
+ stub(arg_t).tag { :interface }
77
+ stub(@info = Object.new).argument_type { arg_t }
78
+ end
79
+
80
+ it "casts an integer to its enum symbol" do
81
+ res = GObject::Helper.cast_signal_argument @info, 7
82
+ assert_equal :july, res
83
+ end
84
+ end
85
+
86
+ describe "with info for an interface" do
87
+ before do
88
+ ifaceinfo = get_introspection_data 'Regress', 'TestInterface'
89
+ stub(arg_t = Object.new).interface { ifaceinfo }
90
+ stub(arg_t).tag { :interface }
91
+ stub(@info = Object.new).argument_type { arg_t }
92
+ end
93
+
94
+ it "casts the argument by calling #to_object on it" do
95
+ mock(ptr = Object.new).to_object { "good-result" }
96
+ res = GObject::Helper.cast_signal_argument @info, ptr
97
+ res.must_equal "good-result"
98
+ end
99
+ end
100
+ end
101
+
102
+ end
103
+
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  require 'ffi-gobject'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  require 'ffi-gobject'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  require 'ffi-gobject/ruby_style'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  require 'ffi-gobject'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require 'introspection_test_helper'
2
2
 
3
3
  describe GObjectIntrospection::IBaseInfo do
4
4
  describe "#safe_name" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require 'introspection_test_helper'
2
2
 
3
3
  describe GObjectIntrospection::IConstantInfo do
4
4
  describe "for GLib::USEC_PER_SEC, a constant of type :gint32" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require 'introspection_test_helper'
2
2
 
3
3
  describe GObjectIntrospection::IFunctionInfo do
4
4
  describe "#safe_name" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require 'introspection_test_helper'
2
2
 
3
3
  module GirFFI
4
4
  class IObjectInfoTest < MiniTest::Spec
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require 'introspection_test_helper'
2
2
 
3
3
  describe GObjectIntrospection::IRepository do
4
4
  describe "an instance" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require 'introspection_test_helper'
2
2
 
3
3
  describe "loading the shared library" do
4
4
  before do
@@ -0,0 +1,120 @@
1
+ require 'gir_ffi_test_helper'
2
+
3
+ describe GObject do
4
+ before do
5
+ GirFFI.setup :Regress
6
+ end
7
+
8
+ describe "::signal_emit" do
9
+ should "emit a signal" do
10
+ a = 1
11
+ o = Regress::TestSubObj.new
12
+ ::GObject::Lib.g_signal_connect_data o, "test", Proc.new { a = 2 }, nil, nil, 0
13
+ GObject.signal_emit o, "test"
14
+ assert_equal 2, a
15
+ end
16
+
17
+ should "handle return values" do
18
+ s = Gio::SocketService.new
19
+
20
+ argtypes = [:pointer, :pointer, :pointer, :pointer]
21
+ callback = FFI::Function.new(:bool, argtypes) { |a,b,c,d| true }
22
+ ::GObject::Lib.g_signal_connect_data s, "incoming", callback, nil, nil, 0
23
+ rv = GObject.signal_emit s, "incoming"
24
+ assert_equal true, rv.get_boolean
25
+ end
26
+
27
+ should "pass in extra arguments" do
28
+ o = Regress::TestSubObj.new
29
+ sb = Regress::TestSimpleBoxedA.new
30
+ sb.some_int8 = 31
31
+ sb.some_double = 2.42
32
+ sb.some_enum = :value2
33
+ b2 = nil
34
+
35
+ argtypes = [:pointer, :pointer, :pointer]
36
+ callback = FFI::Function.new(:void, argtypes) do |a,b,c|
37
+ b2 = b
38
+ end
39
+ ::GObject::Lib.g_signal_connect_data o, "test-with-static-scope-arg", callback, nil, nil, 0
40
+ GObject.signal_emit o, "test-with-static-scope-arg", sb
41
+
42
+ sb2 = Regress::TestSimpleBoxedA.wrap b2
43
+ assert sb.equals(sb2)
44
+ end
45
+ end
46
+
47
+ describe "::signal_connect" do
48
+ should "install a signal handler" do
49
+ a = 1
50
+ o = Regress::TestSubObj.new
51
+ GObject.signal_connect(o, "test") { a = 2 }
52
+ GObject.signal_emit o, "test"
53
+ assert_equal 2, a
54
+ end
55
+
56
+ should "pass user data to handler" do
57
+ a = 1
58
+ o = Regress::TestSubObj.new
59
+ GObject.signal_connect(o, "test", 2) { |i, d| a = d }
60
+ GObject.signal_emit o, "test"
61
+ assert_equal 2, a
62
+ end
63
+
64
+ should "pass object to handler" do
65
+ o = Regress::TestSubObj.new
66
+ o2 = nil
67
+ GObject.signal_connect(o, "test") { |i, d| o2 = i }
68
+ GObject.signal_emit o, "test"
69
+ assert_instance_of Regress::TestSubObj, o2
70
+ assert_equal o.to_ptr, o2.to_ptr
71
+ end
72
+
73
+ should "not allow connecting an invalid signal" do
74
+ o = Regress::TestSubObj.new
75
+ assert_raises RuntimeError do
76
+ GObject.signal_connect(o, "not-really-a-signal") {}
77
+ end
78
+ end
79
+
80
+ should "handle return values" do
81
+ s = Gio::SocketService.new
82
+ GObject.signal_connect(s, "incoming") { true }
83
+ rv = GObject.signal_emit s, "incoming"
84
+ assert_equal true, rv.get_boolean
85
+ end
86
+
87
+ should "require a block" do
88
+ o = Regress::TestSubObj.new
89
+ assert_raises ArgumentError do
90
+ GObject.signal_connect o, "test"
91
+ end
92
+ end
93
+
94
+ describe "connecting a signal with extra arguments" do
95
+ setup do
96
+ @a = nil
97
+ @b = 2
98
+
99
+ o = Regress::TestSubObj.new
100
+ sb = Regress::TestSimpleBoxedA.new
101
+ sb.some_int = 23
102
+
103
+ GObject.signal_connect(o, "test-with-static-scope-arg", 2) { |i, object, d|
104
+ @a = d
105
+ @b = object
106
+ }
107
+ GObject.signal_emit o, "test-with-static-scope-arg", sb
108
+ end
109
+
110
+ should "move the user data argument" do
111
+ assert_equal 2, @a
112
+ end
113
+
114
+ should "pass on the extra arguments" do
115
+ assert_instance_of Regress::TestSimpleBoxedA, @b
116
+ assert_equal 23, @b.some_int
117
+ end
118
+ end
119
+ end
120
+ end
@@ -1,6 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
2
-
3
- require 'ffi-glib/strv'
1
+ require 'base_test_helper'
4
2
 
5
3
  describe GLib::Strv do
6
4
  it "wraps a pointer" do
@@ -18,8 +16,13 @@ describe GLib::Strv do
18
16
 
19
17
  describe "#each" do
20
18
  it "yields each string element" do
21
- ptr = GirFFI::InPointer.from_array :utf8, ["one", "two", "three"]
22
- strv = GLib::Strv.new ptr
19
+ ary = ["one", "two", "three"]
20
+ ptrs = ary.map {|a| FFI::MemoryPointer.from_string(a)}
21
+ ptrs << nil
22
+ block = FFI::MemoryPointer.new(:pointer, ptrs.length)
23
+ block.write_array_of_pointer ptrs
24
+
25
+ strv = GLib::Strv.new block
23
26
  arr = []
24
27
  strv.each do |str|
25
28
  arr << str
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::ArgHelper do
4
4
  describe "::ptr_to_typed_array" do
@@ -91,7 +91,7 @@ describe GirFFI::ArgHelper do
91
91
 
92
92
  describe "::object_pointer_to_object" do
93
93
  it "finds the wrapping class by gtype and wraps the pointer in it" do
94
- klsptr = GirFFI::InOutPointer.from :gtype, 0xdeadbeef
94
+ klsptr = GirFFI::InOutPointer.from :GType, 0xdeadbeef
95
95
  objptr = GirFFI::InOutPointer.from :pointer, klsptr
96
96
 
97
97
  object_class = Class.new
@@ -1,18 +1,6 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Argument::Base do
4
- describe "#subtype_tag" do
5
- it "returns :gpointer if the param_type is a pointer with tag :void" do
6
- stub(subtype0 = Object.new).tag { :void }
7
- stub(subtype0).pointer? { true }
8
- stub(type = Object.new).param_type(0) { subtype0 }
9
-
10
- provider = GirFFI::Builder::Argument::Base.new nil, nil, type
11
-
12
- assert_equal :gpointer, provider.subtype_tag
13
- end
14
- end
15
-
16
4
  describe "#subtype_tag_or_class_name" do
17
5
  describe "for a simple type" do
18
6
  it "returns the string ':void'" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Function do
4
4
  describe "#pretty_print" do
@@ -56,7 +56,7 @@ describe GirFFI::Builder::Function do
56
56
  def self.test_callback_destroy_notify callback, user_data, notify
57
57
  _v1 = GirFFI::CallbackHelper.wrap_in_callback_args_mapper \"Regress\", \"TestCallbackUserData\", callback
58
58
  DummyLib::CALLBACKS << _v1
59
- _v2 = GirFFI::ArgHelper.object_to_inptr user_data
59
+ _v2 = GirFFI::InPointer.from :void, user_data
60
60
  _v3 = GirFFI::CallbackHelper.wrap_in_callback_args_mapper \"GLib\", \"DestroyNotify\", notify
61
61
  DummyLib::CALLBACKS << _v3
62
62
  _v4 = DummyLib.regress_test_callback_destroy_notify _v1, _v2, _v3
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Module do
4
4
  describe "#pretty_print" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Type::Callback do
4
4
  describe "#pretty_print" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Type::Constant do
4
4
  describe "#pretty_print" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Type::Enum do
4
4
  describe "#pretty_print" do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Type::Interface do
4
4
  describe "#pretty_print" do
@@ -28,6 +28,3 @@ describe GirFFI::Builder::Type::Interface do
28
28
  end
29
29
  end
30
30
  end
31
-
32
-
33
-
@@ -1,6 +1,26 @@
1
- require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
1
+ require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::Builder::Type::Object do
4
+ describe '#find_signal' do
5
+ it 'finds the signal "test" for TestObj' do
6
+ builder = GirFFI::Builder::Type::Object.new get_introspection_data('Regress', 'TestObj')
7
+ sig = builder.find_signal 'test'
8
+ assert_equal 'test', sig.name
9
+ end
10
+
11
+ it 'finds the signal "test" for TestSubObj' do
12
+ builder = GirFFI::Builder::Type::Object.new get_introspection_data('Regress', 'TestSubObj')
13
+ sig = builder.find_signal 'test'
14
+ assert_equal 'test', sig.name
15
+ end
16
+
17
+ it 'finds the signal "changed" for Gtk::Entry' do
18
+ builder = GirFFI::Builder::Type::Object.new get_introspection_data('Gtk', 'Entry')
19
+ sig = builder.find_signal 'changed'
20
+ assert_equal 'changed', sig.name
21
+ end
22
+ end
23
+
4
24
  describe "#find_property" do
5
25
  it "finds a property specified on the class itself" do
6
26
  builder = GirFFI::Builder::Type::Object.new(
@@ -38,5 +58,4 @@ describe GirFFI::Builder::Type::Object do
38
58
  end
39
59
 
40
60
  end
41
-
42
61
  end