ffi-efl 0.0.3 → 0.0.4

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.
Files changed (44) hide show
  1. data/Changelog +12 -0
  2. data/Rakefile +1 -1
  3. data/lib/efl/ecore.rb +17 -6
  4. data/lib/efl/ecore_evas.rb +78 -24
  5. data/lib/efl/ecore_getopt.rb +27 -23
  6. data/lib/efl/ecore_input.rb +1 -1
  7. data/lib/efl/edje.rb +11 -11
  8. data/lib/efl/eet.rb +20 -14
  9. data/lib/efl/eina.rb +1 -1
  10. data/lib/efl/eina_hash.rb +17 -30
  11. data/lib/efl/eina_list.rb +16 -25
  12. data/lib/efl/elementary.rb +8 -19
  13. data/lib/efl/evas.rb +167 -38
  14. data/lib/efl/ffi.rb +28 -17
  15. data/lib/efl/{ffi → native}/ecore.rb +9 -5
  16. data/lib/efl/{ffi → native}/ecore_evas.rb +27 -20
  17. data/lib/efl/{ffi → native}/ecore_getopt.rb +9 -5
  18. data/lib/efl/{ffi → native}/ecore_input.rb +9 -5
  19. data/lib/efl/{ffi → native}/edje.rb +14 -10
  20. data/lib/efl/{ffi → native}/eet.rb +9 -5
  21. data/lib/efl/{ffi → native}/eina.rb +9 -5
  22. data/lib/efl/{ffi → native}/eina_hash.rb +9 -5
  23. data/lib/efl/{ffi → native}/eina_list.rb +9 -5
  24. data/lib/efl/{ffi → native}/eina_types.rb +9 -5
  25. data/lib/efl/{ffi → native}/elementary.rb +70 -66
  26. data/lib/efl/{ffi → native}/evas.rb +11 -7
  27. data/lib/efl/native.rb +16 -0
  28. data/lib/efl.rb +1 -1
  29. data/spec/ecore_evas_spec.rb +325 -6
  30. data/spec/ecore_getopt_spec.rb +70 -104
  31. data/spec/ecore_input_spec.rb +6 -6
  32. data/spec/ecore_spec.rb +63 -60
  33. data/spec/edje_spec.rb +6 -6
  34. data/spec/eet_spec.rb +23 -22
  35. data/spec/eina_hash_spec.rb +53 -58
  36. data/spec/eina_list_spec.rb +28 -18
  37. data/spec/eina_spec.rb +6 -6
  38. data/spec/evas_spec.rb +371 -119
  39. data/tasks/constants.rb +4 -0
  40. data/test/test_edje.rb +1 -1
  41. data/test/test_elm_win-native.rb +38 -0
  42. data/test/test_evas.rb +4 -4
  43. metadata +32 -20
  44. data/test/test_elm_win.rb +0 -35
data/spec/evas_spec.rb CHANGED
@@ -1,76 +1,83 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl/ecore'
4
5
  require 'efl/evas'
5
6
  #
6
7
  describe Efl::Evas do
8
+ def realize_evas
9
+ @width = 800
10
+ @height = 600
11
+ @pixels = FFI::MemoryPointer.new :int, @width*@height
12
+ @e = Evas::REvas.new
13
+ @e.output_method_set Evas::render_method_lookup("buffer")
14
+ @e.output_viewport_set 0, 0, @width, @height
15
+ @e.output_size_set @width, @height
16
+ einfo = Native::EngineInfoBufferStruct.new @e.engine_info
17
+ einfo[:info][:depth_type] = Efl::Evas::EVAS_ENGINE_BUFFER_DEPTH_ARGB32
18
+ einfo[:info][:dest_buffer] = @pixels
19
+ einfo[:info][:dest_buffer_row_bytes] = @width * FFI::type_size(:int);
20
+ einfo[:info][:use_color_key] = 0;
21
+ einfo[:info][:alpha_threshold] = 0;
22
+ einfo[:info][:func][:new_update_region] = nil #FFI::Pointer::NULL;
23
+ einfo[:info][:func][:free_update_region] = nil #FFI::Pointer::NULL;
24
+ @e.engine_info_set einfo
25
+ end
7
26
  #
8
- before(:all) { Evas = Efl::Evas }
27
+ before(:all) {
28
+ Evas = Efl::Evas
29
+ Native = Efl::Native
30
+ }
9
31
  #
10
32
  it "should init" do
11
- Evas.init.should eql 1
12
- Evas.init.should eql 2
13
- Evas.init.should eql 3
33
+ Evas.init.should == 1
34
+ Evas.init.should == 2
35
+ Evas.init.should == 3
14
36
  end
15
37
  #
16
38
  it "should shutdown" do
17
- Evas.shutdown.should eql 2
18
- Evas.shutdown.should eql 1
19
- Evas.shutdown.should eql 0
39
+ Evas.shutdown.should == 2
40
+ Evas.shutdown.should == 1
41
+ Evas.shutdown.should == 0
20
42
  end
21
43
  #
22
44
  it "evas alloc error enum is ok" do
23
- Efl::Evas.enum_value(:evas_alloc_error_none).should eql 0
24
- Efl::Evas.enum_value(:evas_alloc_error_fatal).should eql 1
25
- Efl::Evas.enum_value(:evas_alloc_error_recovered).should eql 2
26
- Efl::Evas.enum_type(:evas_alloc_error)[0].should eql :evas_alloc_error_none
27
- Efl::Evas.enum_type(:evas_alloc_error)[1].should eql :evas_alloc_error_fatal
28
- Efl::Evas.enum_type(:evas_alloc_error)[2].should eql :evas_alloc_error_recovered
29
- Efl::Evas.enum_type(:evas_alloc_error)[:evas_alloc_error_none].should eql 0
30
- Efl::Evas.enum_type(:evas_alloc_error)[:evas_alloc_error_fatal].should eql 1
31
- Efl::Evas.enum_type(:evas_alloc_error)[:evas_alloc_error_recovered].should eql 2
45
+ Native.enum_value(:evas_alloc_error_none).should == 0
46
+ Native.enum_value(:evas_alloc_error_fatal).should == 1
47
+ Native.enum_value(:evas_alloc_error_recovered).should == 2
48
+ Native.enum_type(:evas_alloc_error)[0].should == :evas_alloc_error_none
49
+ Native.enum_type(:evas_alloc_error)[1].should == :evas_alloc_error_fatal
50
+ Native.enum_type(:evas_alloc_error)[2].should == :evas_alloc_error_recovered
51
+ Native.enum_type(:evas_alloc_error)[:evas_alloc_error_none].should == 0
52
+ Native.enum_type(:evas_alloc_error)[:evas_alloc_error_fatal].should == 1
53
+ Native.enum_type(:evas_alloc_error)[:evas_alloc_error_recovered].should == 2
32
54
  end
33
55
  #
34
56
  it "should have no memory allocation error occured" do
35
57
  Evas.init
36
- Evas.alloc_error.should eql :evas_alloc_error_none
58
+ Evas.alloc_error.should == :evas_alloc_error_none
37
59
  Evas.shutdown
38
60
  end
39
61
  #
40
62
  it "should process async events" do
41
63
  cb = Proc.new do |target,type,evt|
42
- target.read_string.should eql "target"
43
- type.should eql :evas_callback_show
44
- evt.read_string.should eql "work"
64
+ target.read_string.should == "target"
65
+ type.should == :evas_callback_show
66
+ evt.read_string.should == "work"
45
67
  end
46
68
  Evas.init
47
69
  target = FFI::MemoryPointer.from_string("target")
48
70
  work = FFI::MemoryPointer.from_string("work")
49
71
  Evas.async_events_put target, :evas_callback_show, work, cb
50
- Evas.async_events_process.should eql 1
51
- Evas.async_events_process.should eql 0
72
+ Evas.async_events_process.should == 1
73
+ Evas.async_events_process.should == 0
52
74
  Evas.shutdown
53
75
  end
54
76
  #
55
77
  describe Efl::Evas::REvas do
56
78
  before(:all) do
57
79
  Evas.init
58
- @width = 800
59
- @height = 600
60
- @pixels = FFI::MemoryPointer.new :int, @width*@height
61
- @e = Evas::REvas.new
62
- @e.output_method_set Evas::render_method_lookup("buffer")
63
- @e.output_viewport_set 0, 0, @width, @height
64
- @e.output_size_set @width, @height
65
- einfo = Efl::Evas::EngineInfoBufferStruct.new @e.engine_info_get
66
- einfo[:info][:depth_type] = Efl::Evas::EVAS_ENGINE_BUFFER_DEPTH_ARGB32
67
- einfo[:info][:dest_buffer] = @pixels
68
- einfo[:info][:dest_buffer_row_bytes] = @width * FFI::type_size(:int);
69
- einfo[:info][:use_color_key] = 0;
70
- einfo[:info][:alpha_threshold] = 0;
71
- einfo[:info][:func][:new_update_region] = nil #FFI::Pointer::NULL;
72
- einfo[:info][:func][:free_update_region] = nil #FFI::Pointer::NULL;
73
- @e.engine_info_set einfo
80
+ realize_evas
74
81
  end
75
82
  after(:all) do
76
83
  @e.free
@@ -79,45 +86,41 @@ describe Efl::Evas do
79
86
  end
80
87
  it "should be able to create and destroy evas" do
81
88
  e1 = Evas::REvas.new
82
- e1.address.should_not eql 0
83
- e2 = Evas::REvas.new e1
84
- e1.address.should eql e2.address
85
- e3 = Evas::REvas.new e1.to_ptr
86
- e1.address.should eql e3.address
87
- e2.address.should eql e3.address
89
+ e1.address.should_not == 0
90
+ e2 = Evas::REvas.new e1.to_ptr
91
+ e1.address.should == e2.address
88
92
  (e1==e2).should be_false
89
- (e2==e3).should be_false
90
- (e1==e3).should be_false
91
93
  (e1===e2).should be_true
92
- (e2===e3).should be_true
93
- (e1===e3).should be_true
94
+ e1.free
94
95
  e1.free
95
96
  e1.to_ptr.should be_nil
96
- e4 = Evas::REvas.new Evas.evas_new
97
- e4.address.should_not eql 0
97
+ e2.free
98
+ e2.free
99
+ e4 = Evas::REvas.new Native.evas_new
100
+ e4.address.should_not == 0
98
101
  e5 = e4.dup
99
- e4.address.should eql e5.address
102
+ e4.address.should == e5.address
100
103
  e6 = e4.clone
101
- e4.address.should eql e6.address
104
+ e4.address.should == e6.address
102
105
  e4.free
103
106
  e4.to_ptr.should be_nil
104
107
  end
105
108
  #
106
109
  it "focus should work" do
107
- Efl::Evas.evas_focus_in @e.to_ptr
108
- Efl::Evas.evas_focus_state_get(@e.to_ptr).should be_true
109
- Efl::Evas.evas_focus_out @e.to_ptr
110
- Efl::Evas.evas_focus_state_get(@e.to_ptr).should be_false
111
- Efl::Evas.focus_in @e.to_ptr
112
- Efl::Evas.focus_state_get(@e.to_ptr).should be_true
113
- Efl::Evas.focus_out @e.to_ptr
114
- Efl::Evas.focus_state_get(@e.to_ptr).should be_false
110
+ Native.evas_focus_in @e.to_ptr
111
+ Native.evas_focus_state_get(@e.to_ptr).should be_true
112
+ Native.evas_focus_out @e.to_ptr
113
+ Native.evas_focus_state_get(@e.to_ptr).should be_false
114
+ Evas.focus_in @e.to_ptr
115
+ Evas.focus_state_get(@e.to_ptr).should be_true
116
+ Evas.focus_out @e.to_ptr
117
+ Evas.focus_state_get(@e.to_ptr).should be_false
115
118
  @e.focus_in { |r| r.should be_nil }
116
- @e.focus_state_get.should be_true
119
+ @e.focus_state.should be_true
117
120
  @e.focus_state_get { |r| r.should be_true }
118
121
  @e.focus_out.should be_nil
119
122
  @e.focus_state_get.should be_false
120
- @e.focus_state_get { |r| r.should be_false }
123
+ @e.focus_state { |r| r.should be_false }
121
124
  end
122
125
  #
123
126
  it "nochange should work" do
@@ -128,7 +131,8 @@ describe Efl::Evas do
128
131
  it "attach data should work" do
129
132
  data = FFI::MemoryPointer.from_string "my data"
130
133
  @e.data_attach_set data
131
- @e.data_attach_get.read_string.should eql "my data"
134
+ @e.data_attach.read_string.should == "my data"
135
+ @e.data_attach_get.read_string.should == "my data"
132
136
  end
133
137
  #
134
138
  it "should not crash" do
@@ -143,9 +147,10 @@ describe Efl::Evas do
143
147
  @e.render_dump
144
148
  end
145
149
  it "output method should work" do
146
- @e.output_method_get.should eql Evas::render_method_lookup("buffer")
150
+ @e.output_method.should == Evas::render_method_lookup("buffer")
151
+ @e.output_method_get.should == Evas::render_method_lookup("buffer")
147
152
  # output_method_set tested in before(:all)
148
- l = Efl::Evas::render_method_list
153
+ l = Efl::Evas.render_method_list
149
154
  Evas::render_method_list_free l
150
155
  end
151
156
  #
@@ -156,11 +161,19 @@ describe Efl::Evas do
156
161
  #
157
162
  it "output size should work" do
158
163
  @e.output_size_set 69, 666
159
- @e.output_size_get.should eql [69,666]
164
+ @e.size.should == [69,666]
165
+ @e.output_size.should == [69,666]
166
+ @e.output_size_get.should == [69,666]
167
+ @e.output_size = 666, 69
168
+ @e.size == [666,69]
160
169
  end
161
170
  it "output viewport should work" do
162
171
  @e.output_viewport_set 0, 0, 666, 69
163
- @e.output_viewport_get.should eql [0,0,666,69]
172
+ @e.viewport.should == [0,0,666,69]
173
+ @e.output_viewport.should == [0,0,666,69]
174
+ @e.output_viewport_get.should == [0,0,666,69]
175
+ @e.output_viewport = 0, 0, 69, 666
176
+ @e.viewport.should == [0,0,69,666]
164
177
  end
165
178
  #
166
179
  it "coordinates evas<=>world should work" do
@@ -176,37 +189,41 @@ describe Efl::Evas do
176
189
  end
177
190
  #
178
191
  it "freeze and thaw should work" do
179
- @e.event_freeze_get.should eql 0
192
+ @e.event_freeze?.should == 0
180
193
  @e.event_freeze
181
- @e.event_freeze_get.should eql 1
194
+ @e.event_freeze?.should == 1
182
195
  @e.event_thaw
183
- @e.event_freeze_get.should eql 0
196
+ @e.event_freeze_get.should == 0
184
197
  end
185
198
  #
186
199
  it "up/down mouse event should work" do
187
200
  @e.event_feed_mouse_down 2, :evas_button_double_click, Time.now.to_i, FFI::Pointer::NULL
188
- @e.pointer_button_down_mask_get.should eql 2
201
+ @e.pointer_button_down_mask.should == 2
189
202
  @e.event_feed_mouse_up 2, :evas_button_double_click, Time.now.to_i, FFI::Pointer::NULL
190
- @e.pointer_button_down_mask_get.should eql 0
203
+ @e.pointer_button_down_mask_get.should == 0
191
204
  end
192
205
  #
193
206
  it "move mouse event should work" do
194
- @e.pointer_output_xy_get.should eql [0,0]
195
- @e.pointer_canvas_xy_get.should eql [0,0]
207
+ @e.pointer_output.should == [0,0]
208
+ @e.pointer_output_xy_get.should == [0,0]
209
+ @e.pointer_canvas.should == [0,0]
210
+ @e.pointer_canvas_xy_get.should == [0,0]
196
211
  @e.event_feed_mouse_move 6, 6, Time.now.to_i, FFI::Pointer::NULL
197
- @e.pointer_output_xy_get.should eql [6,6]
198
- @e.pointer_canvas_xy_get.should eql [6,6]
212
+ @e.pointer_output.should == [6,6]
213
+ @e.pointer_output_xy_get.should == [6,6]
214
+ @e.pointer_canvas.should == [6,6]
215
+ @e.pointer_canvas_xy_get.should == [6,6]
199
216
  end
200
217
  #
201
218
  it "in/out mouse event should work" do
202
219
  @e.pointer_inside_get.should be_false
203
220
  @e.event_feed_mouse_in Time.now.to_i, FFI::Pointer::NULL
204
- @e.pointer_inside_get.should be_true
221
+ @e.pointer_inside.should be_true
205
222
  @e.event_feed_mouse_out Time.now.to_i, FFI::Pointer::NULL
206
- @e.pointer_inside_get.should be_false
223
+ @e.pointer_inside.should be_false
207
224
  end
208
225
  #
209
- # TODO
226
+ # TODO evas_event_feed_*
210
227
  # evas_event_feed_multi_down
211
228
  # evas_event_feed_multi_up
212
229
  # evas_event_feed_multi_move
@@ -220,8 +237,8 @@ describe Efl::Evas do
220
237
  @cb = false
221
238
  kd_cb = Proc.new do |data, e, obj, event_info|
222
239
  data.read_string.should eq "mouse_in"
223
- e.address.should eql @e.address
224
- obj.address.should eql @bg.address
240
+ e.address.should == @e.address
241
+ obj.address.should == @bg.address
225
242
  @db=true
226
243
  true
227
244
  end
@@ -232,7 +249,7 @@ describe Efl::Evas do
232
249
  @bg.show
233
250
  @bg.event_callback_add :evas_callback_mouse_in, kd_cb, kd_d
234
251
  @e.event_feed_mouse_in Time.now.to_i, FFI::Pointer::NULL
235
- @bg.event_callback_del(:evas_callback_mouse_in, kd_cb).address.should eql kd_d.address
252
+ @bg.event_callback_del(:evas_callback_mouse_in, kd_cb).address.should == kd_d.address
236
253
  @db.should be_true
237
254
  end
238
255
  #
@@ -240,16 +257,19 @@ describe Efl::Evas do
240
257
  @e.image_cache_flush
241
258
  @e.image_cache_reload
242
259
  @e.image_cache_set 666
243
- @e.image_cache_get.should eql 666
260
+ @e.image_cache.should == 666
261
+ @e.image_cache_get.should == 666
244
262
  end
245
263
  #
246
264
  it "font functions should work" do
247
265
  @e.font_hinting_set :evas_font_hinting_bytecode
248
- @e.font_hinting_get.should eql :evas_font_hinting_bytecode
266
+ @e.font_hinting.should == :evas_font_hinting_bytecode
267
+ @e.font_hinting_get.should == :evas_font_hinting_bytecode
249
268
  @e.font_hinting_can_hint(:evas_font_hinting_none).should be_true
250
269
  @e.font_cache_flush
251
270
  @e.font_cache_set 666
252
- @e.font_cache_get.should eql 666
271
+ @e.font_cache.should == 666
272
+ @e.font_cache_get.should == 666
253
273
  l = @e.font_available_list
254
274
  @e.font_available_list_free l
255
275
  @e.font_path_clear
@@ -258,33 +278,44 @@ describe Efl::Evas do
258
278
  @e.font_path_prepend a[0]
259
279
  require 'efl/eina_list'
260
280
  Efl::EinaList::REinaList.new(@e.font_path_list).each_with_index do |p,i|
261
- p.read_string.should eql a[i]
281
+ p.read_string.should == a[i]
262
282
  end
263
283
  end
284
+ #
285
+ it "focus should work" do
286
+ @e.focus.should == FFI::Pointer::NULL
287
+ @e.focus_get.should == FFI::Pointer::NULL
288
+ @o = @e.object_add(:rectangle) { |o|
289
+ o.color = 200,200,200,200
290
+ o.move 0, 0
291
+ o.resize 100, 100
292
+ o.show
293
+ }
294
+ @o.focus = true
295
+ @e.focus.should == @o.to_ptr
296
+ @e.focus_get.should == @o.to_ptr
297
+ end
298
+ #
299
+ it "object_name_find should work" do
300
+ @e.object_name_find("name").should == FFI::Pointer::NULL
301
+ @o = @e.object_add(:rectangle)
302
+ @o.name="name"
303
+ @e.object_name_find("name").should == @o.to_ptr
304
+ end
305
+ # TODO evas_object_top_at_xy_get, evas_object_top_at_pointer_get, evas_object_top_in_rectangle_get
306
+ # TODO evas_objects_at_xy_get, evas_objects_in_rectangle_get, evas_object_bottom_get, evas_object_top_get
264
307
  end
265
308
  describe Efl::Evas::REvasObject do
266
309
  #
267
310
  before(:all) do
268
311
  Evas.init
269
- @pixels = FFI::MemoryPointer.new :int, 100*100
270
- @e = Evas::REvas.new
271
- @e.output_method_set Evas::render_method_lookup("buffer")
272
- @e.output_viewport_set 0, 0, 100, 100
273
- @e.output_size_set 100, 100
274
- einfo = Efl::Evas::EngineInfoBufferStruct.new @e.engine_info_get
275
- einfo[:info][:depth_type] = Efl::Evas::EVAS_ENGINE_BUFFER_DEPTH_ARGB32
276
- einfo[:info][:dest_buffer] = @pixels
277
- einfo[:info][:dest_buffer_row_bytes] = 100 * FFI::type_size(:int);
278
- einfo[:info][:use_color_key] = 0;
279
- einfo[:info][:alpha_threshold] = 0;
280
- einfo[:info][:func][:new_update_region] = nil #FFI::Pointer::NULL;
281
- einfo[:info][:func][:free_update_region] = nil #FFI::Pointer::NULL;
282
- @e.engine_info_set einfo
283
- @o = @e.object_add :rectangle
284
- @o.color = 200,200,200,200
285
- @o.move 0, 0
286
- @o.resize 100, 100
287
- @o.show
312
+ realize_evas
313
+ @o = @e.object_add(:rectangle) { |o|
314
+ o.color = 200,200,200,200
315
+ o.move 0, 0
316
+ o.resize 100, 100
317
+ o.show
318
+ }
288
319
  end
289
320
  after(:all) do
290
321
  @e.free
@@ -300,16 +331,16 @@ describe Efl::Evas do
300
331
  clipper.resize 50, 50
301
332
  @o.clip = clipper.to_ptr
302
333
  clipper.show
303
- @o.clip_get.address.should eql clipper.address
334
+ @o.clip.address.should == clipper.address
304
335
  require 'efl/eina_list'
305
- Efl::EinaList::REinaList.new(clipper.clipees_get).to_ary[0].address.should eql @o.address
336
+ Efl::EinaList::REinaList.new(clipper.clipees_get).to_ary[0].address.should == @o.address
306
337
  @o.clip_unset
307
- @o.clip_get.address.should eql 0
338
+ @o.clip_get.address.should == 0
308
339
 
309
340
  end
310
341
  #
311
342
  it "focus functions should work" do
312
- @o.focus_get.should be_false
343
+ @o.focus.should be_false
313
344
  @o.focus_set true
314
345
  @o.focus_get.should be_true
315
346
  @o.focus = false
@@ -317,35 +348,256 @@ describe Efl::Evas do
317
348
  end
318
349
  #
319
350
  it "layer functions should work" do
320
- @o.layer_get.should eql 0
351
+ @o.layer.should == 0
321
352
  @o.layer_set 2
322
- @o.layer_get.should eql 2
353
+ @o.layer_get.should == 2
323
354
  @o.layer = 0
324
- @o.layer_get.should eql 0
355
+ @o.layer_get.should == 0
325
356
  end
326
357
  #
327
358
  it "name functions should work" do
328
359
  @o.name_set "My name"
329
- @o.name_get.should eql "My name"
360
+ @o.evas_name.should == "My name"
361
+ @o.name_get.should == "My name"
330
362
  end
331
363
  #
332
364
  it "geometry functions should work" do
333
- # FIXME
334
- # @o.geometry_get.should eql [0,0,100,100]
335
- # @o.resize 50,50
336
- # @o.geometry_get.should eql [0,0,50,50]
337
- # @o.move 10, 10
338
- # @o.geometry_get.should eql [10,10,50,50]
365
+ @o.geometry.should == [0,0,100,100]
366
+ @o.resize 50,50
367
+ @o.geometry.should == [0,0,50,50]
368
+ @o.move 10, 10
369
+ @o.geometry_get.should == [10,10,50,50]
339
370
  end
340
371
  #
341
372
  it "show hide visible should work" do
342
373
  @o.show
343
374
  @o.visible?.should be_true
344
375
  @o.hide
376
+ @o.visible.should be_false
345
377
  @o.visible_get.should be_false
346
378
  @o.show
347
379
  @o.visible?.should be_true
348
380
  end
381
+ #
382
+ it "color get/set should work" do
383
+ @o.color.should == [200,200,200,200]
384
+ @o.color_get.should == [200,200,200,200]
385
+ @o.color_set 0,50,100,200
386
+ @o.color.should == [0,50,100,200]
387
+ @o.color = 200,200,200,200
388
+ @o.color.should == [200,200,200,200]
389
+ end
390
+ #
391
+ it "evas_get should worl" do
392
+ @o.evas.should === @e
393
+ @o.evas_get.should === @e
394
+ end
395
+ #
396
+ it "type_get should work" do
397
+ @o.evas_type.should == 'rectangle'
398
+ @o.type_get.should == 'rectangle'
399
+ end
400
+ # TODO raise, lower
401
+ it "raise, lower, stck_below, stack_above should work" do
402
+ os = []
403
+ 0.upto(3) do
404
+ os << @e.object_add(:rectangle)
405
+ end
406
+ os[2].above.should === os[3]
407
+ os[2].below.should === os[1]
408
+ os[2].above.should === os[3]
409
+ os[2].below.should === os[1]
410
+ os[2].stack_below os[1]
411
+ os[2].above_get.should === os[1]
412
+ os[2].below_get.should === os[0]
413
+ os[2].stack_above os[1]
414
+ os[2].above.should === os[3]
415
+ os[2].below.should === os[1]
416
+ os.each do |o| o.free; end
417
+ end
418
+ #
419
+ it "event_callback should work" do
420
+ @o.move 0, 0 # FIXME why do I need this ?!?
421
+ count = 0
422
+ cb = Proc.new do |data,evas,evas_object,event_info|
423
+ count +=1
424
+ end
425
+ cb_data = FFI::MemoryPointer.from_string "my cb data"
426
+ @o.event_callback_add :evas_callback_mouse_in, cb, @o
427
+ Efl::Evas.event_feed_mouse_in @o.evas, Time.now.to_i, cb_data
428
+ sleep 0.1
429
+ count.should==1
430
+ end
431
+ #
432
+ it "pass events should work" do
433
+ @o.pass_events.should be_false
434
+ @o.pass_events_set true
435
+ @o.pass_events.should be_true
436
+ @o.pass_events=false
437
+ @o.pass_events.should be_false
438
+ @o.pass_events_set true
439
+ @o.pass_events.should be_true
440
+ @o.pass_events=false
441
+ @o.pass_events_get.should be_false
442
+ end
443
+ #
444
+ it "repeat events should work" do
445
+ @o.repeat_events.should be_false
446
+ @o.repeat_events_set true
447
+ @o.repeat_events.should be_true
448
+ @o.repeat_events=false
449
+ @o.repeat_events.should be_false
450
+ @o.repeat_events_set true
451
+ @o.repeat_events.should be_true
452
+ @o.repeat_events=false
453
+ @o.repeat_events_get.should be_false
454
+ end
455
+ #
456
+ it "propagate event should work" do
457
+ @o.propagate_events.should be_true
458
+ @o.propagate_events=false
459
+ @o.propagate_events.should be_false
460
+ @o.propagate_events_set true
461
+ @o.propagate_events.should be_true
462
+ @o.propagate_events=false
463
+ @o.propagate_events.should be_false
464
+ @o.propagate_events_set true
465
+ @o.propagate_events_get.should be_true
466
+ end
467
+ #
468
+ it "map enable should work" do
469
+ @o.map_enable.should be_false
470
+ @o.map_enable_set true
471
+ @o.map_enable.should be_true
472
+ @o.map_enable=false
473
+ @o.map_enable.should be_false
474
+ @o.map_enable_set true
475
+ @o.map_enable.should be_true
476
+ @o.map_enable=false
477
+ @o.map_enable_get.should be_false
478
+ end
479
+ #
480
+ it "size_hint_ should work" do
481
+ @o.size_hint_min_set 100, 150
482
+ @o.size_hint_min.should == [100,150]
483
+ @o.size_hint_min_get.should == [100,150]
484
+ @o.size_hint_max_set 300, 350
485
+ @o.size_hint_max.should == [300,350]
486
+ @o.size_hint_max_get.should == [300,350]
487
+ @o.size_hint_request_set 400, 450
488
+ @o.size_hint_request.should == [400,450]
489
+ @o.size_hint_request_get.should == [400,450]
490
+ @o.size_hint_aspect_set :evas_aspect_control_both, 400, 450
491
+ @o.size_hint_aspect.should == [:evas_aspect_control_both,400,450]
492
+ @o.size_hint_aspect_get.should == [:evas_aspect_control_both,400,450]
493
+ @o.size_hint_align_set 0.2, 0.5
494
+ @o.size_hint_align.should == [0.2,0.5]
495
+ @o.size_hint_align_get.should == [0.2,0.5]
496
+ @o.size_hint_weight_set 0.3, 0.6
497
+ @o.size_hint_weight.should == [0.3,0.6]
498
+ @o.size_hint_weight_get.should == [0.3,0.6]
499
+ @o.size_hint_padding_set 10, 20, 30, 40
500
+ @o.size_hint_padding.should == [10,20,30,40]
501
+ @o.size_hint_padding_get.should == [10,20,30,40]
502
+ end
503
+ #
504
+ it "data get/set should work" do
505
+ @o.data_set "key", "val"
506
+ @o.data("key").should == "val"
507
+ @o.data_get("key").should == "val"
508
+ @o.data_del("key")
509
+ @o.data_get("key").should == nil
510
+ end
511
+ #
512
+ it "pointer mode get/set should work" do
513
+ @o.pointer_mode = :evas_object_pointer_mode_nograb
514
+ @o.pointer_mode.should == :evas_object_pointer_mode_nograb
515
+ @o.pointer_mode_get.should == :evas_object_pointer_mode_nograb
516
+ @o.pointer_mode = :evas_object_pointer_mode_autograb
517
+ @o.pointer_mode.should == :evas_object_pointer_mode_autograb
518
+ @o.pointer_mode_get.should == :evas_object_pointer_mode_autograb
519
+ end
520
+ #
521
+ it "anti_alias get/set should work" do
522
+ @o.anti_alias_set true
523
+ @o.anti_alias_get.should be_true
524
+ @o.anti_alias=false
525
+ @o.anti_alias.should be_false
526
+ @o.anti_alias_get.should be_false
527
+ end
528
+ #
529
+ it "sccale set/get should work" do
530
+ @o.scale_set 1.5
531
+ @o.scale_get.should == 1.5
532
+ @o.scale= 1.6
533
+ @o.scale.should == 1.6
534
+ end
535
+ #
536
+ it "render op get/set" do
537
+ @o.render_op_set :evas_render_copy
538
+ @o.render_op_get.should == :evas_render_copy
539
+ @o.render_op = :evas_render_mask
540
+ @o.render_op.should == :evas_render_mask
541
+ end
542
+ #
543
+ it "precise_is_inside get/set should work" do
544
+ @o.precise_is_inside_set true
545
+ @o.precise_is_inside?.should be_true
546
+ @o.precise_is_inside_get.should be_true
547
+ @o.precise_is_inside=false
548
+ @o.precise_is_inside?.should be_false
549
+ @o.precise_is_inside.should be_false
550
+ end
551
+ #
552
+ it "static_clip get/set should work" do
553
+ @o.static_clip_set true
554
+ @o.static_clip?.should be_true
555
+ @o.static_clip_get.should be_true
556
+ @o.static_clip=false
557
+ @o.static_clip?.should be_false
558
+ @o.static_clip.should be_false
559
+ end
560
+ #
561
+ end
562
+ #
563
+ describe Efl::Evas::REvasLine do
564
+ #
565
+ before(:all) do
566
+ Evas.init
567
+ realize_evas
568
+ @l = @e.object_add 'line'
569
+ end
570
+ after(:all) do
571
+ @e.free
572
+ Evas.shutdown
573
+ end
574
+ it "xy get/set should work" do
575
+ @l.line_xy_set 10, 20, 30, 40
576
+ @l.line_xy_get.should == [10, 20, 30, 40]
577
+ end
578
+ end
579
+ #
580
+ describe Efl::Evas::REvasPolygon do
581
+ #
582
+ before(:all) do
583
+ Evas.init
584
+ realize_evas
585
+ @p = @e.object_add 'polygon'
586
+ end
587
+ after(:all) do
588
+ @e.free
589
+ Evas.shutdown
590
+ end
591
+ it "xy point_add should work" do
592
+ @p.point_add 10, 20
593
+ @p.point_add 30, 40
594
+ @p.point_add 50, 60
595
+ @p.point_add 80, 80
596
+ end
597
+ #
598
+ it "point clear shold work" do
599
+ @p.points_clear
600
+ end
349
601
  end
350
602
  #
351
603
  end