ffi-efl 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@
4
4
  require 'efl/ecore'
5
5
  require 'efl/ecore_evas'
6
6
  require 'efl/eina_list'
7
+ require 'efl/eina_rectangle'
7
8
  require 'efl/ecore_getopt'
8
9
  #
9
10
  describe Efl::EcoreGetopt do
@@ -13,247 +14,233 @@ describe Efl::EcoreGetopt do
13
14
  end
14
15
  before(:all) do
15
16
  Efl::Ecore.init
17
+ end
18
+ #
19
+ before(:each) do
16
20
  #
17
21
  @p = Efl::EcoreGetopt::REcoreGetopt.new :prog =>"Prog", :usage => "Usage", :version => "0.0.0", :copyright => "less", :license => "MIT", :description => "description", :strict => 1
18
- @callback = Proc.new do |parser, desc, string, data, value|
22
+ #
23
+ @callback = Proc.new do |parser, desc, string, data, storage|
19
24
  parser.address.should == @p.to_ptr.address
20
- string.should == "my_data"
25
+ Efl::Native::EcoreGetoptDesc.new(desc)[:shortname].chr.should == 'b'
26
+ string.should == "user_arg"
21
27
  data.read_string.should == "cb_data"
22
- value.read_pointer.read_int.should == 99
28
+ storage.read_pointer.read_int.should == 69
29
+ storage.read_pointer.write_int 666
23
30
  true
24
31
  end
32
+ @g = Efl::Native::EinaRectangleStruct.new
33
+ @g[:x] = 100; @g[:y] = 200; @g[:w] = 300; @g[:h] = 400
25
34
  #
26
- @values = {
27
- :license => FFI::MemoryPointer.new(:uchar),
28
- :copyright => FFI::MemoryPointer.new(:uchar),
29
- :version => FFI::MemoryPointer.new(:uchar),
30
- :help => FFI::MemoryPointer.new(:uchar),
31
- :engines => FFI::MemoryPointer.new(:uchar),
32
- :int => FFI::MemoryPointer.new(:int),
33
- :double => FFI::MemoryPointer.new(:double),
34
- :short => FFI::MemoryPointer.new(:short),
35
- :long => FFI::MemoryPointer.new(:long),
36
- :const => FFI::MemoryPointer.new(:int),
37
- :true => FFI::MemoryPointer.new(:uchar),
38
- :false => FFI::MemoryPointer.new(:uchar),
39
- :choice => FFI::MemoryPointer.new(:pointer),
40
- :append => FFI::MemoryPointer.new(:pointer),
41
- :count => FFI::MemoryPointer.new(:int),
42
- :callback => FFI::MemoryPointer.new(:int),
43
- }
44
- @meta1 = FFI::MemoryPointer.from_string "My pretty"
45
- @meta2 = FFI::MemoryPointer.from_string "My precious"
46
- @cb_data = FFI::MemoryPointer.from_string "cb_data"
47
- #
48
- @p.license 'L', 'license'
49
- @p.value :boolp, @values[:license]
50
- @p.copyright 'C', 'copyright'
51
- @p.value :boolp, @values[:copyright]
35
+ # license and copyright share the same flag named quit
36
+ @p.license 'L', 'license', 'quit'
37
+ @p.copyright 'C', 'copyright', 'quit'
52
38
  @p.version 'V', 'version'
53
- @p.value :boolp, @values[:version]
54
39
  @p.help 'H', 'help'
55
- @p.value :boolp, @values[:help]
56
- # FIXME debug callback : ecore_getopt_callback_ecore_evas_list_engines
57
- # @p.callback_noargs 'E', 'list-engines', 'list ecore-evas available engines', @engines_cb, FFI::Pointer::NULL
58
- @p.callback_noargs 'E', 'list-engines', 'list ecore-evas available engines', Efl::Native.method(:ecore_getopt_callback_ecore_evas_list_engines), FFI::Pointer::NULL
59
- @p.value :boolp, @values[:engines]
60
- @p.store_type :int, 'i', 'int', 'store an integer'
61
- @p.value :intp, @values[:int]
62
- @p.store_meta_type :double, 'd', 'double', 'store an double+meta', @meta1
63
- @p.value :doublep, @values[:double]
64
- @p.store_def_type :short, 's', 'short', 'store an short+default', 6
65
- @p.value :shortp, @values[:short]
66
- @p.store_full_type :long, 'l', 'long', 'store a long+full', @meta2, :ecore_getopt_desc_arg_requirement_yes, 666
67
- @p.value :longp, @values[:long]
68
- @p.store_const 'c', 'const', 'store a constant', 123456
69
- @p.value :intp, @values[:const]
40
+ @p.store 'i', 'int', 'store an integer', :int, 2
41
+ @p.store_meta 'd', 'double', 'store an double+meta', "My pretty meta", :double, 3.1415926
42
+ @p.store_def 's', 'string', 'store an string+default', :string, "default"
43
+ @p.store_full 'l', 'long', 'store a long+full', "My precious meta", :ecore_getopt_desc_arg_requirement_yes, :long, 666
44
+ @p.store_const 'c', 'const', 'store a constant', -666, 123456
70
45
  @p.store_true 't', 'true', 'store true'
71
- @p.value :boolp, @values[:false]
72
46
  @p.store_false 'f', 'false', 'store false'
73
- @p.value :boolp, @values[:true]
47
+ @p.count 'k', 'count', 'store count', 664
48
+ @p.append 'a', 'append', 'store append', :int, [1,2,3]
74
49
  @p.choice 'm', 'many', 'store choice', ['ch1','ch2','ch3']
75
- @p.value :strp, @values[:choice]
76
- @p.append 'a', 'append', 'store append', :ecore_getopt_type_int
77
- @p.value :listp, @values[:append]
78
- @p.count 'k', 'count', 'store count'
79
- @p.value :intp, @values[:count]
80
- @p.callback_args 'b', 'callback', 'callback full', @meta1, @callback, @cb_data
81
- @p.value :intp, @values[:callback]
50
+ @p.callback_args 'b', 'callback', 'callback full', "Another meta", @callback, "cb_data", :int, 69
51
+ @p.callback_noargs 'E', 'list-engines', 'list ecore-evas available engines',
52
+ Efl::Native.method(:ecore_getopt_callback_ecore_evas_list_engines)
53
+ @p.callback_args 'g', 'geometry', 'x:y:w:h', "X:Y:W:H",
54
+ Efl::Native.method(:ecore_getopt_callback_geometry_parse), nil, :pointer, @g
82
55
  @p.create
83
- # puts @p.debug
84
56
  #
85
57
  end
86
- before(:each) do
87
- [ :license, :copyright, :version, :help, :engines ].each do |sym|
88
- @values[sym].write_char 0
89
- end
90
- @values[:int].write_int 0
91
- @values[:double].write_double 3.1415926
92
- @values[:short].write_short 9
93
- @values[:long].write_long 666
94
- @values[:const].write_int -666
95
- @values[:true].write_uchar 1
96
- @values[:false].write_uchar 0
97
- @values[:choice].write_pointer FFI::Pointer::NULL
98
- @values[:append].write_pointer FFI::Pointer::NULL
99
- @values[:count].write_int 664
100
- @values[:callback].write_int 99
101
- end
102
58
  #
103
59
  describe "license copyright version help" do
60
+ if ENV['DEBUG']
61
+ it "DEBUG" do
62
+ puts @p.debug
63
+ end
64
+ end
104
65
  it "should handle -L" do
105
66
  args = @p.parse ["My lovely prog name","-L"]
106
- @values[:license].read_char.should == 1
67
+ @p['quit'].should == 1
107
68
  end
108
69
  it "should handle --license" do
109
70
  args = @p.parse ["My lovely prog name","--license"]
110
- @values[:license].read_char.should == 1
71
+ @p['quit'].should == 1
111
72
  end
112
73
  it "should handle -C" do
113
74
  args = @p.parse ["progname","-C"]
114
- @values[:copyright].read_char.should == 1
75
+ @p['quit'].should == 1
115
76
  end
116
77
  it "should handle --copyright" do
117
78
  args = @p.parse ["My lovely prog name","--copyright"]
118
- @values[:copyright].read_char.should == 1
79
+ @p['quit'].should == 1
119
80
  end
120
81
  it "should handle -V" do
121
82
  args = @p.parse ["My lovely prog name","-V"]
122
- @values[:version].read_char.should == 1
83
+ @p['V'].should == 1
123
84
  end
124
85
  it "should handle --version" do
125
86
  args = @p.parse ["progname","--version"]
126
- @values[:version].read_char.should == 1
87
+ @p['V'].should == 1
127
88
  end
128
89
  it "should handle -H" do
129
90
  args = @p.parse ["My lovely prog name","-H"]
130
- @values[:help].read_char.should == 1
91
+ @p['H'].should == 1
131
92
  end
132
93
  it "should handle --help" do
133
94
  args = @p.parse ["progname","--help"]
134
- @values[:help].read_char.should == 1
135
- end
136
- it "should handle -E" do
137
- args = @p.parse ["My lovely prog name","-E"]
138
- @values[:engines].read_char.should == 1
139
- end
140
- it "should handle --list-engines" do
141
- args = @p.parse ["My lovely prog name","--list-engines"]
142
- @values[:engines].read_char.should == 1
95
+ @p['H'].should == 1
143
96
  end
144
97
  end
145
98
  describe "simple short options" do
146
99
  it "should handle -i" do
147
- @values[:int].read_int.should == 0
100
+ @p['i'].should == 2
148
101
  args = @p.parse ["progname","-i 666"]
149
- @values[:int].read_int.should == 666
102
+ @p['i'].should == 666
150
103
  end
151
104
  it "should handle -d" do
152
- @values[:double].read_double.should == 3.1415926
105
+ @p['d'].should == 3.1415926
153
106
  args = @p.parse ["progname","-d 6.66"]
154
- @values[:double].read_double.should == 6.66
107
+ @p['d'].should == 6.66
155
108
  end
156
109
  it "should handle -s" do
157
- @values[:short].read_short.should == 9
158
- args = @p.parse ["progname","-s 125"]
159
- @values[:short].read_short.should == 125
110
+ @p['s'].should == 'default'
111
+ args = @p.parse ["progname","-sset"]
112
+ @p['s'].should == 'set'
160
113
  end
161
114
  it "should handle -l" do
162
- @values[:long].read_long.should == 666
115
+ @p['l'].should == 666
163
116
  args = @p.parse ["progname","-l 69"]
164
- @values[:long].read_long.should == 69
117
+ @p['l'].should == 69
165
118
  end
166
119
  it "should handle -c" do
167
- @values[:const].read_int.should == -666
120
+ @p['c'].should == -666
168
121
  args = @p.parse ["progname","-c"]
169
- @values[:const].read_int.should == 123456
122
+ @p['c'].should == 123456
170
123
  end
171
124
  it "should handle -t" do
172
- @values[:false].read_uchar.should == 0
125
+ @p['t'].should == 0
173
126
  args = @p.parse ["progname","-t"]
174
- @values[:false].read_uchar.should == 1
127
+ @p['t'].should == 1
175
128
  end
176
129
  it "should handle -f" do
177
- @values[:true].read_uchar.should == 1
130
+ @p['f'].should == 1
178
131
  args = @p.parse ["progname","-f"]
179
- @values[:true].read_uchar.should == 0
132
+ @p['f'].should == 0
180
133
  end
181
- it "should handle -m" do
182
- @values[:choice].read_pointer.should == FFI::Pointer::NULL
183
- args = @p.parse ["progname","-mch2"]
184
- @values[:choice].read_pointer.read_string.should == "ch2"
134
+ it "should handle -k" do
135
+ @p['k'].should == 664
136
+ args = @p.parse ["progname","-kk"]
137
+ @p['k'].should == 666
185
138
  end
186
139
  it "should handle -a" do
187
- @values[:append].read_pointer.should == FFI::Pointer::NULL
140
+ @p['a'].should == [1,2,3]
188
141
  args = @p.parse ["progname","-a10", "-a20"]
189
- l = Efl::EinaList::REinaList.new(@values[:append].read_pointer).to_a
190
- l[0].read_int.should==10
191
- l[1].read_int.should==20
142
+ @p['a'].should == [1,2,3,10,20]
192
143
  end
193
- it "should handle -k" do
194
- @values[:count].read_int.should == 664
195
- args = @p.parse ["progname","-kk"]
196
- @values[:count].read_int.should == 666
144
+ it "should handle -m" do
145
+ @p['m'].should == nil
146
+ args = @p.parse ["progname","-mch2"]
147
+ @p['m'].should == "ch2"
197
148
  end
198
149
  it "should handle -b" do
199
- args = @p.parse ["progname","-bmy_data"]
150
+ @p['b'].should == 69
151
+ args = @p.parse ["progname","-buser_arg"]
152
+ @p['b'].should == 666
153
+ end
154
+ it "should handle -E" do
155
+ args = @p.parse ["My lovely prog name","-E"]
156
+ @p['E'].should == 1
157
+ end
158
+ it "should handle -g" do
159
+ g = Efl::Native::EinaRectangleStruct.new @p['g']
160
+ g[:x].should == 100
161
+ g[:y].should == 200
162
+ g[:w].should == 300
163
+ g[:h].should == 400
164
+ args = @p.parse ["progname","-g=10:20:30:40"]
165
+ g = Efl::Native::EinaRectangleStruct.new @p['g']
166
+ g[:x].should == 10
167
+ g[:y].should == 20
168
+ g[:w].should == 30
169
+ g[:h].should == 40
200
170
  end
201
171
  end
202
172
  describe "simple long options" do
203
173
  it "should handle --int" do
204
- @values[:int].read_int.should == 0
174
+ @p['i'].should == 2
205
175
  args = @p.parse ["progname","--int=666"]
206
- @values[:int].read_int.should == 666
176
+ @p['i'].should == 666
207
177
  end
208
178
  it "should handle --double" do
209
- @values[:double].read_double.should == 3.1415926
179
+ @p['d'].should == 3.1415926
210
180
  args = @p.parse ["progname","--double=6.66"]
211
- @values[:double].read_double.should == 6.66
181
+ @p['d'].should == 6.66
212
182
  end
213
- it "should handle --short" do
214
- @values[:short].read_short.should == 9
215
- args = @p.parse ["progname","--short=125"]
216
- @values[:short].read_short.should == 125
183
+ it "should handle --string" do
184
+ @p['s'].should == 'default'
185
+ args = @p.parse ["progname","--string=set"]
186
+ @p['s'].should == 'set'
217
187
  end
218
188
  it "should handle --long" do
219
- @values[:long].read_long.should == 666
189
+ @p['l'].should == 666
220
190
  args = @p.parse ["progname","--long=69"]
221
- @values[:long].read_long.should == 69
191
+ @p['l'].should == 69
222
192
  end
223
193
  it "should handle --const" do
224
- @values[:const].read_int.should == -666
194
+ @p['c'].should == -666
225
195
  args = @p.parse ["progname","--const"]
226
- @values[:const].read_int.should == 123456
196
+ @p['c'].should == 123456
227
197
  end
228
198
  it "should handle --true" do
229
- @values[:false].read_uchar.should == 0
199
+ @p['t'].should == 0
230
200
  args = @p.parse ["progname","--true"]
231
- @values[:false].read_uchar.should == 1
201
+ @p['t'].should == 1
232
202
  end
233
203
  it "should handle --false" do
234
- @values[:true].read_uchar.should == 1
204
+ @p['f'].should == 1
235
205
  args = @p.parse ["progname","--false"]
236
- @values[:true].read_uchar.should == 0
206
+ @p['f'].should == 0
237
207
  end
238
- it "should handle --many" do
239
- @values[:choice].read_pointer.should == FFI::Pointer::NULL
240
- args = @p.parse ["progname","--many=ch3"]
241
- @values[:choice].read_pointer.read_string.should == "ch3"
208
+ it "should handle --count" do
209
+ @p['k'].should == 664
210
+ args = @p.parse ["progname","--count","--count"]
211
+ @p['k'].should == 666
242
212
  end
243
- it "should handle -append" do
244
- @values[:append].read_pointer.should == FFI::Pointer::NULL
213
+ it "should handle --append" do
214
+ @p['a'].should == [1,2,3]
245
215
  args = @p.parse ["progname","--append=10", "--append=20"]
246
- l = Efl::EinaList::REinaList.new(@values[:append].read_pointer).to_a
247
- l[0].read_int.should==10
248
- l[1].read_int.should==20
216
+ @p['a'].should == [1,2,3,10,20]
249
217
  end
250
- it "should handle --count" do
251
- @values[:count].read_int.should == 664
252
- args = @p.parse ["progname","--count","--count"]
253
- @values[:count].read_int.should == 666
218
+ it "should handle --many" do
219
+ @p['m'].should == nil
220
+ args = @p.parse ["progname","--many=ch3"]
221
+ @p['m'].should == "ch3"
254
222
  end
255
223
  it "should handle --callback" do
256
- args = @p.parse ["progname","--callback=my_data"]
224
+ @p['b'].should == 69
225
+ args = @p.parse ["progname","--callback=user_arg"]
226
+ @p['b'].should == 666
227
+ end
228
+ it "should handle --list-engines" do
229
+ args = @p.parse ["My lovely prog name","--list-engines"]
230
+ @p['E'].should == 1
231
+ end
232
+ it "should handle --geometry" do
233
+ g = Efl::Native::EinaRectangleStruct.new @p['g']
234
+ g[:x].should == 100
235
+ g[:y].should == 200
236
+ g[:w].should == 300
237
+ g[:h].should == 400
238
+ args = @p.parse ["progname","--geometry=10:20:30:40"]
239
+ g = Efl::Native::EinaRectangleStruct.new @p['g']
240
+ g[:x].should == 10
241
+ g[:y].should == 20
242
+ g[:w].should == 30
243
+ g[:h].should == 40
257
244
  end
258
245
  end
259
246
  end
@@ -7,18 +7,22 @@ describe Efl::EcoreInput do
7
7
  #
8
8
  before(:all) do
9
9
  EcoreInput = Efl::EcoreInput
10
+ @init = EcoreInput.init
11
+ end
12
+ after(:all) do
13
+ EcoreInput.shutdown
10
14
  end
11
15
  #
12
16
  it "should init" do
13
- EcoreInput.init.should == 1
14
- EcoreInput.init.should == 2
15
- EcoreInput.init.should == 3
17
+ EcoreInput.init.should == @init+1
18
+ EcoreInput.init.should == @init+2
19
+ EcoreInput.init.should == @init+3
16
20
  end
17
21
  #
18
22
  it "should shutdown" do
19
- EcoreInput.shutdown.should == 2
20
- EcoreInput.shutdown.should == 1
21
- EcoreInput.shutdown.should == 0
23
+ EcoreInput.shutdown.should == @init+2
24
+ EcoreInput.shutdown.should == @init+1
25
+ EcoreInput.shutdown.should == @init
22
26
  end
23
27
  #
24
28
  end
data/spec/ecore_spec.rb CHANGED
@@ -22,22 +22,22 @@ describe "Efl::Ecore #{Efl::Ecore.version.full}" do
22
22
  OK = FFI::MemoryPointer.from_string "ok"
23
23
  KO = FFI::MemoryPointer.from_string "ko"
24
24
  NONE = FFI::MemoryPointer.from_string "none"
25
+ @init = Ecore.init
26
+ end
27
+ after(:all) do
28
+ Ecore.shutdown
25
29
  end
26
- before(:each) {
27
- Ecore.init==1
28
- }
29
- after(:each) {
30
- Ecore.shutdown==0
31
- }
32
30
  #
33
31
  it "should init" do
34
- Ecore.init.should == 2
35
- Ecore.init.should == 3
32
+ Ecore.init.should == @init+1
33
+ Ecore.init.should == @init+2
34
+ Ecore.init.should == @init+3
36
35
  end
37
36
  #
38
37
  it "should shutdown" do
39
- Ecore.shutdown.should == 2
40
- Ecore.shutdown.should == 1
38
+ Ecore.shutdown.should == @init+2
39
+ Ecore.shutdown.should == @init+1
40
+ Ecore.shutdown.should == @init
41
41
  end
42
42
  #
43
43
  it "should run a single iteration of the mainloop" do
@@ -60,6 +60,7 @@ describe "Efl::Ecore #{Efl::Ecore.version.full}" do
60
60
  ecore_evt = Ecore.event_add Ecore::EVENT_SIGNAL_USER, evt, EVENT_FREE_CB, NONE
61
61
  ecore_evt.null?.should be_false
62
62
  Ecore.main_loop_begin # process event
63
+ Ecore.event_handler_del(evt_handler).address.should == OK.address
63
64
  end
64
65
  #
65
66
  it "should be able to get and set event handler data" do
@@ -73,6 +74,7 @@ describe "Efl::Ecore #{Efl::Ecore.version.full}" do
73
74
  ecore_evt = Ecore.event_add Ecore::EVENT_SIGNAL_USER, evt, EVENT_FREE_CB, NONE
74
75
  ecore_evt.null?.should be_false
75
76
  Ecore.main_loop_begin # process event
77
+ Ecore.event_handler_del(evt_handler).address.should == OK.address
76
78
  end
77
79
  #
78
80
  it "should be able to create new event type" do
@@ -111,17 +113,21 @@ describe "Efl::Ecore #{Efl::Ecore.version.full}" do
111
113
  loop_data.read_string.should == "loop_data"
112
114
  end
113
115
  filter = Ecore.event_filter_add start_cb, filter_cb, end_cb, OK
114
- Ecore.event_handler_add Ecore::EVENT_SIGNAL_USER, USER_SIGNAL_CB, OK
116
+ evt_handler = Ecore.event_handler_add Ecore::EVENT_SIGNAL_USER, USER_SIGNAL_CB, OK
115
117
  e1 = FFI::MemoryPointer.new(:int)
116
118
  e1.write_int 69
117
119
  evt1 = Ecore.event_add Ecore::EVENT_SIGNAL_USER, e1, event_free_cb, KO
118
120
  e2 = FFI::MemoryPointer.new(:int)
119
121
  e2.write_int 666
120
122
  evt2 = Ecore.event_add Ecore::EVENT_SIGNAL_USER, e2, EVENT_FREE_CB, NONE
121
- Ecore.main_loop_begin # process event
122
123
  Ecore.event_filter_del(filter).address.should == OK.address
123
124
  evt2 = Ecore.event_add Ecore::EVENT_SIGNAL_USER, e2, EVENT_FREE_CB, NONE
124
- Ecore.main_loop_begin # process event
125
+ Ecore.event_handler_del(evt_handler).address.should == OK.address
126
+ Ecore.main_loop_iterate
127
+ Ecore.main_loop_iterate
128
+ Ecore.main_loop_iterate
129
+ e1.free
130
+ e2.free
125
131
  end
126
132
  #
127
133
  describe Efl::Ecore::REcorePipe do
data/spec/edje_spec.rb CHANGED
@@ -23,22 +23,24 @@ require './spec/helper'
23
23
  #
24
24
  describe "Efl::Edje #{Efl::Edje.version.full}" do
25
25
  #
26
- before(:all) {
26
+ before(:all) do
27
27
  Edje = Efl::Edje
28
- Edje.init.should == 1
29
- }
30
- after(:all) {
31
- Edje.shutdown == 0
32
- }
28
+ @init = Edje.init
29
+ end
30
+ after(:all) do
31
+ Edje.shutdown
32
+ end
33
33
  #
34
34
  it "should init" do
35
- Edje.init.should == 2
36
- Edje.init.should == 3
35
+ Edje.init.should == @init+1
36
+ Edje.init.should == @init+2
37
+ Edje.init.should == @init+3
37
38
  end
38
39
  #
39
40
  it "should shutdown" do
40
- Edje.shutdown.should == 2
41
- Edje.shutdown.should == 1
41
+ Edje.shutdown.should == @init+2
42
+ Edje.shutdown.should == @init+1
43
+ Edje.shutdown.should == @init
42
44
  end
43
45
  #
44
46
  it "frametime get/set " do
@@ -105,7 +107,7 @@ describe "Efl::Edje #{Efl::Edje.version.full}" do
105
107
  after(:all) do
106
108
  @e.free
107
109
  @pixels.free
108
- Efl::Evas.shutdown.should==0
110
+ Efl::Evas.shutdown
109
111
  end
110
112
  #
111
113
  it "scale get/set " do
data/spec/eet_spec.rb CHANGED
@@ -5,24 +5,28 @@ require 'efl/eet'
5
5
  #
6
6
  describe "Efl::Eet #{Efl::Eet.version.full}" do
7
7
  #
8
- before(:all) {
8
+ before(:all) do
9
9
  Eet = Efl::Eet
10
10
  Native = Efl::Native unless Kernel.const_defined? 'Native'
11
11
  REetFile = Efl::Eet::REetFile
12
- }
12
+ @init = Eet.init
13
+ end
14
+ after(:all) do
15
+ Eet.shutdown
16
+ end
13
17
  #
14
18
  FP = '/tmp/_eet.cfg'
15
19
  #
16
20
  it "should init" do
17
- Eet.init.should == 1
18
- Eet.init.should == 2
19
- Eet.init.should == 3
21
+ Eet.init.should == @init+1
22
+ Eet.init.should == @init+2
23
+ Eet.init.should == @init+3
20
24
  end
21
25
  #
22
26
  it "should shutdown" do
23
- Eet.shutdown.should == 2
24
- Eet.shutdown.should == 1
25
- Eet.shutdown.should == 0
27
+ Eet.shutdown.should == @init+2
28
+ Eet.shutdown.should == @init+1
29
+ Eet.shutdown.should == @init
26
30
  end
27
31
  #
28
32
  it "should clearcache" do
@@ -39,8 +43,6 @@ describe "Efl::Eet #{Efl::Eet.version.full}" do
39
43
  end
40
44
  #
41
45
  describe Efl::Eet::REetFile do
42
- before(:all) { Eet.init.should==1 }
43
- after(:all) { Eet.shutdown.should==0 }
44
46
  #
45
47
  it "should open and close" do
46
48
  f = REetFile.open FP, Native.enum_type(:eet_file_mode)[:eet_file_mode_write]
@@ -6,17 +6,17 @@ require 'efl/eina_hash'
6
6
  #
7
7
  describe Efl::EinaHash do
8
8
  #
9
- before(:all) {
9
+ before(:all) do
10
10
  REinaHash = Efl::EinaHash::REinaHash
11
- Efl::Eina.init.should == 1
11
+ Efl::Eina.init
12
12
  @d0 = FFI::MemoryPointer.from_string "D0"
13
13
  @d1 = FFI::MemoryPointer.from_string "D1"
14
14
  @d2 = FFI::MemoryPointer.from_string "D2"
15
15
  @d3 = FFI::MemoryPointer.from_string "D3"
16
- }
17
- after(:all) {
18
- Efl::Eina.shutdown.should == 0
19
- }
16
+ end
17
+ after(:all) do
18
+ Efl::Eina.shutdown
19
+ end
20
20
  #
21
21
  it "should append prepend and fetch" do
22
22
  h = REinaHash.new