ffi-efl 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/spec/elm_spec.rb ADDED
@@ -0,0 +1,409 @@
1
+ #! /usr/bin/env ruby
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ require 'efl/elementary'
5
+ require './spec/helper'
6
+ #
7
+ describe "Efl::Elm #{Efl::Elm.version.full}" do
8
+ #
9
+ before(:all) {
10
+ Elm = Efl::Elm
11
+ Elm.init.should == 1
12
+ }
13
+ after(:all) {
14
+ Elm.shutdown.should == 0
15
+ }
16
+ #
17
+ describe Efl::Elm::ElmWin do
18
+ before(:each) {
19
+ realize_win
20
+ }
21
+ after(:each) {
22
+ @bg.free
23
+ @win.free
24
+ }
25
+ #
26
+ it "resize_object add/del" do
27
+ r = @win.evas.object_rectangle_add
28
+ @win.resize_object_add r
29
+ @win.resize_object_del r
30
+ end
31
+ #
32
+ it "title set/get" do
33
+ @win.title_set "title1"
34
+ @win.title_get.should == "title1"
35
+ @win.title= "title2"
36
+ @win.title.should == "title2"
37
+ end
38
+ #
39
+ it "autodel set/get" do
40
+ bool_check @win, 'autodel'
41
+ end
42
+ #
43
+ it "activate, lower, raise" do
44
+ @win.activate
45
+ @win.lower
46
+ @win.raise
47
+ end
48
+ #
49
+ it "borderless set/get" do
50
+ bool_check @win, 'borderless'
51
+ @win.borderless.should be_false
52
+ end
53
+ #
54
+ it "shaped set/get" do
55
+ bool_check @win, 'shaped'
56
+ end
57
+ #
58
+ it "alpha set/get" do
59
+ bool_check @win, 'alpha'
60
+ end
61
+ #
62
+ it "transparent set/get" do
63
+ bool_check @win, 'transparent'
64
+ end
65
+ #
66
+ it "override set/get" do
67
+ bool_check @win, 'override'
68
+ end
69
+ #
70
+ it "fullscreen set/get" do
71
+ bool_check @win, 'fullscreen', 4
72
+ end
73
+ # FIXME depends on issue: ecore-2
74
+ it "maximized set/get" do
75
+ bool_check @win, 'maximized', 3
76
+ end
77
+ #
78
+ it "iconified set/get" do
79
+ bool_check @win, 'iconified'
80
+ end
81
+ #
82
+ it "layet set/get" do
83
+ @win.layer_set 2
84
+ @win.layer_get.should == 2
85
+ @win.layer = 3
86
+ @win.layer.should == 3
87
+ end
88
+ #
89
+ it "rotation set/get" do
90
+ @win.rotation_set 90
91
+ @win.rotation_get.should == 90
92
+ @win.rotation = 180
93
+ @win.rotation.should == 180
94
+ @win.rotation_with_resize_set 90
95
+ @win.rotation_get.should == 90
96
+ @win.rotation_with_resize= 180
97
+ @win.rotation.should == 180
98
+ end
99
+ #
100
+ it "sticky set/get" do
101
+ bool_check @win, 'sticky', 3
102
+ end
103
+ #
104
+ it "conformant set/get" do
105
+ bool_check @win, 'conformant'
106
+ end
107
+ #
108
+ it "quickpanel set/get" do
109
+ bool_check @win, 'quickpanel'
110
+ end
111
+ #
112
+ it "quickpanel_priority_major set/get" do
113
+ @win.quickpanel_priority_major_set 6
114
+ @win.quickpanel_priority_major_get.should == 6
115
+ @win.quickpanel_priority_major= 1
116
+ @win.quickpanel_priority_major.should == 1
117
+ end
118
+ #
119
+ it "quickpanel_priority_minor set/get" do
120
+ @win.quickpanel_priority_minor_set 6
121
+ @win.quickpanel_priority_minor_get.should == 6
122
+ @win.quickpanel_priority_minor= 1
123
+ @win.quickpanel_priority_minor.should == 1
124
+ end
125
+ #
126
+ it "quickpanel_zone set/get" do
127
+ @win.quickpanel_zone_set 6
128
+ @win.quickpanel_zone_get.should == 6
129
+ @win.quickpanel_zone= 1
130
+ @win.quickpanel_zone.should == 1
131
+ end
132
+ #
133
+ it "focus_highlight_enabled" do
134
+ bool_check @win, 'focus_highlight_enabled'
135
+ end
136
+ #
137
+ it "focus_highlight_style set/get" do
138
+ char_check @win, 'focus_highlight_style'
139
+ end
140
+ #
141
+ it "keyboard_mode set/get" do
142
+ @win.keyboard_mode_set :elm_win_keyboard_off
143
+ @win.keyboard_mode_get.should == :elm_win_keyboard_off
144
+ @win.keyboard_mode= :elm_win_keyboard_on
145
+ @win.keyboard_mode.should == :elm_win_keyboard_on
146
+ @win.keyboard_mode?.should == :elm_win_keyboard_on
147
+ end
148
+ #
149
+ it "keyboard_winset/get" do
150
+ bool_check @win, 'keyboard_win'
151
+ end
152
+ #
153
+ it "screen_position_get" do
154
+ @win.screen_position_get.should == [0,0]
155
+ @win.screen_position.should == [0,0]
156
+ end
157
+ #
158
+ it "prop_focus_skip_set" do
159
+ @win.prop_focus_skip_set true
160
+ @win.prop_focus_skip= false
161
+ end
162
+ #
163
+ it "inlined_image_object_get" do
164
+ o1 = @win.inlined_image_object_get
165
+ o2 = @win.inlined_image_object
166
+ o1.should === o2
167
+ end
168
+ # TODO EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params);;
169
+ # TODO EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj);
170
+ #
171
+ describe Efl::Elm::ElmInWin do
172
+ it "activate, content set/get/unset" do
173
+ @iwin = @win.inwin_add
174
+ o1 = @win.evas.object_rectangle_add
175
+ o2 = @win.evas.object_rectangle_add
176
+ @iwin.activate
177
+ @iwin.content_set o1
178
+ @iwin.content.should == o1.to_ptr
179
+ @iwin.content?.should == o1.to_ptr
180
+ @iwin.content_get.should === o1.to_ptr
181
+ @iwin.content= o2
182
+ @iwin.content.should === o2.to_ptr
183
+ @iwin.content?.should === o2.to_ptr
184
+ @iwin.content_get.should === o2.to_ptr
185
+ @iwin.content_unset
186
+ @iwin.content.should == FFI::Pointer::NULL
187
+ @iwin.content?.should == FFI::Pointer::NULL
188
+ @iwin.content_get.should == FFI::Pointer::NULL
189
+ o1.free
190
+ o2.free
191
+ end
192
+ end
193
+ end
194
+ #
195
+ describe Efl::Elm::ElmBg do
196
+ before(:all) {
197
+ realize_win
198
+ }
199
+ after(:all) {
200
+ @bg.free
201
+ @win.free
202
+ }
203
+ #
204
+ it "file set/get" do
205
+ @bg.file_set "file", "group1"
206
+ @bg.file_get.should == ["file","group1"]
207
+ @bg.file= "file", "group1"
208
+ @bg.file.should == ["file","group1"]
209
+ end
210
+ #
211
+ it "option set/get" do
212
+ @bg.option_set :elm_bg_option_scale
213
+ @bg.option_get.should == :elm_bg_option_scale
214
+ @bg.option=:elm_bg_option_center
215
+ @bg.option.should == :elm_bg_option_center
216
+ end
217
+ #
218
+ it "color set/get" do
219
+ @bg.color_set 12,24,36
220
+ @bg.color_get.should == [12,24,36]
221
+ @bg.color= 2,4,8
222
+ @bg.color.should == [2,4,8]
223
+ @bg.class.superclass.instance_method(:color).bind(@bg).call.should == [200,255,100,150]
224
+ end
225
+ #
226
+ it "overlay get/set unset" do
227
+ r = @win.evas.object_rectangle_add
228
+ @bg.overlay_get.should==FFI::Pointer::NULL
229
+ @bg.overlay_set r
230
+ @bg.overlay_get.should == r.to_ptr
231
+ @bg.overlay_unset.should == r.to_ptr
232
+ @bg.overlay_get.should == FFI::Pointer::NULL
233
+ r.free
234
+ end
235
+ end
236
+ #
237
+ describe Efl::Elm::ElmLayout do
238
+ before(:all) {
239
+ realize_win
240
+ }
241
+ after(:all) {
242
+ @bg.free
243
+ @win.free
244
+ }
245
+ # EAPI Evas_Object *elm_layout_add(Evas_Object *parent);
246
+ # EAPI Eina_Bool elm_layout_file_set(Evas_Object *obj, const char *file, const char *group);
247
+ # EAPI Eina_Bool elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style);
248
+ # EAPI void elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content);
249
+ # EAPI Evas_Object *elm_layout_content_get(const Evas_Object *obj, const char *swallow);
250
+ # EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow);
251
+ # EAPI void elm_layout_text_set(Evas_Object *obj, const char *part, const char *text);
252
+ # EAPI const char *elm_layout_text_get(const Evas_Object *obj, const char *part);
253
+ # EAPI void elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child);
254
+ # EAPI void elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child);
255
+ # EAPI void elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference);
256
+ # EAPI void elm_layout_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos);
257
+ # EAPI Evas_Object *elm_layout_box_remove(Evas_Object *obj, const char *part, Evas_Object *child);
258
+ # EAPI void elm_layout_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear);
259
+ # EAPI void elm_layout_table_pack(Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan);
260
+ # EAPI Evas_Object *elm_layout_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child_obj);
261
+ # EAPI void elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear);
262
+ # EAPI Evas_Object *elm_layout_edje_get(const Evas_Object *obj);
263
+ # EAPI const char *elm_layout_data_get(const Evas_Object *obj, const char *key);
264
+ # EAPI void elm_layout_sizing_eval(Evas_Object *obj);
265
+ # EAPI Eina_Bool elm_layout_part_cursor_set(Evas_Object *obj, const char *part_name, const char *cursor);
266
+ # EAPI const char *elm_layout_part_cursor_get(const Evas_Object *obj, const char *part_name);
267
+ # EAPI void elm_layout_part_cursor_unset(Evas_Object *obj, const char *part_name);
268
+ # EAPI Eina_Bool elm_layout_part_cursor_style_set(Evas_Object *obj, const char *part_name, const char *style);
269
+ # EAPI const char *elm_layout_part_cursor_style_get(const Evas_Object *obj, const char *part_name);
270
+ # EAPI Eina_Bool elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only);
271
+ # EAPI Eina_Bool elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name);
272
+ end
273
+ #
274
+ describe Efl::Elm::ElmLabel do
275
+ #
276
+ before(:all) {
277
+ realize_win
278
+ @lb = Elm::ElmLabel.new @win
279
+ }
280
+ after(:all) {
281
+ @lb.free
282
+ @bg.free
283
+ @win.free
284
+ }
285
+ #
286
+ it "label set/get" do
287
+ @lb.label_set "label1"
288
+ @lb.label_get.should == "label1"
289
+ @lb.label= "label2"
290
+ @lb.label.should == "label2"
291
+ end
292
+ #
293
+ it "line_wrap set/get" do
294
+ @lb.line_wrap_set :elm_wrap_char
295
+ @lb.line_wrap_get.should == :elm_wrap_char
296
+ @lb.line_wrap= :elm_wrap_none
297
+ @lb.line_wrap.should == :elm_wrap_none
298
+ end
299
+ #
300
+ it "wrap_width set/get" do
301
+ @lb.wrap_width_set 69
302
+ @lb.wrap_width_get.should == 69
303
+ @lb.wrap_width= 666
304
+ @lb.wrap_width.should == 666
305
+ end
306
+ #
307
+ it "wrap_height set/get" do
308
+ @lb.wrap_height_set 69
309
+ @lb.wrap_height_get.should == 69
310
+ @lb.wrap_height= 666
311
+ @lb.wrap_height.should == 666
312
+ end
313
+ #
314
+ it "ellipsis_set" do
315
+ @lb.ellipsis_set true
316
+ @lb.ellipsis= false
317
+ end
318
+ #
319
+ it "slide_set" do
320
+ bool_check @lb, 'slide'
321
+ end
322
+ #
323
+ it "slide_duration_set" do
324
+ @lb.slide_duration_set 3.1415926
325
+ @lb.slide_duration_get.should == 3.1415926
326
+ @lb.slide_duration= 3.1415926
327
+ @lb.slide_duration.should == 3.1415926
328
+ end
329
+ end
330
+ #
331
+ describe Efl::Elm::ElmPager do
332
+ #
333
+ before(:all) {
334
+ realize_win
335
+ @p = Elm::ElmPager.new @win
336
+ @os = []
337
+ 0.upto(3) do
338
+ @os << @win.evas.object_rectangle_add
339
+ end
340
+ }
341
+ after(:all) {
342
+ @p.free
343
+ @bg.free
344
+ @win.free
345
+ }
346
+ #
347
+ it "content push pop promote bottom_get top_get" do
348
+ @os.each do |o|
349
+ @p.content_push o
350
+ end
351
+ @p.content_top_get.should == @os[-1].to_ptr
352
+ @p.content_bottom_get.should == @os[0].to_ptr
353
+ @p.content_pop
354
+ @p.content_top_get.should == @os[-2].to_ptr
355
+ @p.content_bottom_get.should == @os[0].to_ptr
356
+ @p.content_promote @os[0]
357
+ @p.content_top_get.should == @os[0].to_ptr
358
+ @p.content_bottom_get.should == @os[1].to_ptr
359
+ end
360
+ end
361
+ #
362
+ describe Efl::Elm::ElmPanel do
363
+ #
364
+ before(:all) {
365
+ realize_win
366
+ @p = Elm::ElmPanel.new @win
367
+ @os = []
368
+ }
369
+ after(:all) {
370
+ @p.free
371
+ @bg.free
372
+ @win.free
373
+ }
374
+ #
375
+ it "orient set/get" do
376
+ @p.orient_set :elm_panel_orient_bottom
377
+ @p.orient_get.should == :elm_panel_orient_bottom
378
+ @p.orient= :elm_panel_orient_top
379
+ @p.orient.should == :elm_panel_orient_top
380
+ end
381
+ #
382
+ it "content set/get/unset" do
383
+ o = @win.evas.object_rectangle_add
384
+ @p.content_set o
385
+ @p.content_get.should == o.to_ptr
386
+ @p.content_unset.should == o.to_ptr
387
+ o.free
388
+ o = @win.evas.object_rectangle_add
389
+ @p.content= o
390
+ @p.content.should == o.to_ptr
391
+ @p.content_unset.should == o.to_ptr
392
+ o.free
393
+ end
394
+ #
395
+ it "hidden set/get toggle" do
396
+ @p.hidden_set true
397
+ @p.hidden_get.should be_true
398
+ @p.hidden=false
399
+ @p.hidden.should be_false
400
+ @p.toggle
401
+ @p.hidden_get.should be_true
402
+ @p.hidden.should be_true
403
+ @p.toggle
404
+ @p.hidden_get.should be_false
405
+ @p.hidden.should be_false
406
+ end
407
+ end
408
+ end
409
+