ffi-efl 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,13 +6,13 @@ require 'efl/eina_list'
6
6
  #
7
7
  describe Efl::EinaList do
8
8
  #
9
- before(:all) {
9
+ before(:all) do
10
10
  REinaList = Efl::EinaList::REinaList
11
- Efl::Eina.init.should == 1
12
- }
13
- after(:all) {
14
- Efl::Eina.shutdown.should == 0
15
- }
11
+ Efl::Eina.init
12
+ end
13
+ after(:all) do
14
+ Efl::Eina.shutdown
15
+ end
16
16
  #
17
17
  it "should append prepend and fetch" do
18
18
  l = REinaList.new
@@ -38,7 +38,7 @@ describe Efl::EinaList do
38
38
  end
39
39
  #
40
40
  it "should be able to convert into ruby Array from empty REinaList" do
41
- ary = REinaList.new.to_ary
41
+ ary = REinaList.new.to_a
42
42
  ary.empty?.should be_true
43
43
  ary.is_a?(Array).should be_true
44
44
  end
@@ -71,7 +71,7 @@ describe Efl::EinaList do
71
71
  l.prepend d2
72
72
  l << d4
73
73
  l.unshift d1
74
- ary = l.to_ary
74
+ ary = l.to_a
75
75
  ary.length.should == 4
76
76
  0.upto 3 do |i|
77
77
  ary[i].read_string.should == "D#{i}"
@@ -79,7 +79,25 @@ describe Efl::EinaList do
79
79
  l.free
80
80
  end
81
81
  #
82
- it "should be able to build from ruby Array" do
82
+ it "should be able to convert into ruby Array from non empty REinaList pointer" do
83
+ l = REinaList.new
84
+ d1 = ::FFI::MemoryPointer.from_string "D0"
85
+ d2 = ::FFI::MemoryPointer.from_string "D1"
86
+ d3 = ::FFI::MemoryPointer.from_string "D2"
87
+ d4 = ::FFI::MemoryPointer.from_string "D3"
88
+ l.append d3
89
+ l.prepend d2
90
+ l << d4
91
+ l.unshift d1
92
+ ary = l.to_a :string
93
+ ary.length.should == 4
94
+ 0.upto 3 do |i|
95
+ ary[i].should == "D#{i}"
96
+ end
97
+ l.free
98
+ end
99
+ #
100
+ it "should be able to build from a ruby Array of pointers" do
83
101
  a = []
84
102
  a << ::FFI::MemoryPointer.from_string("D0")
85
103
  a << ::FFI::MemoryPointer.from_string("D1")
@@ -92,6 +110,15 @@ describe Efl::EinaList do
92
110
  l.free
93
111
  end
94
112
  #
113
+ it "should be able to build from a ruby Array of int" do
114
+ a = [3,4,5,6]
115
+ l = REinaList.from_a a, :int
116
+ 0.upto 3 do |i|
117
+ l.nth(i).read_int.should == i+3
118
+ end
119
+ l.free
120
+ end
121
+ #
95
122
  it "Enumerable" do
96
123
  l = REinaList.new
97
124
  d1 = ::FFI::MemoryPointer.from_string "D0"
@@ -6,54 +6,42 @@ require 'efl/eina_log'
6
6
  require './spec/helper'
7
7
  #
8
8
  describe Efl::EinaLog do
9
- before(:all) {
9
+ before(:all) do
10
10
  Efl::Eina.init
11
11
  EinaLog = Efl::EinaLog
12
- }
13
- after(:all) {
12
+ end
13
+ after(:all) do
14
14
  Efl::Eina.shutdown
15
- }
15
+ end
16
16
  #
17
17
  it "level set/get" do
18
18
  EinaLog.level_set 2
19
19
  EinaLog.level_get.should == 2
20
- EinaLog.level_set 3
21
- EinaLog.level_get.should == 3
20
+ EinaLog.level = 3
21
+ EinaLog.level.should == 3
22
22
  end
23
23
  #
24
24
  it "color_disable set/get" do
25
- EinaLog.color_disable_set true
26
- EinaLog.color_disable_get.should be_true
27
- EinaLog.color_disable_set false
28
- EinaLog.color_disable_get.should be_false
25
+ bool_check EinaLog, 'color_disable'
29
26
  end
30
27
  #
31
28
  it "file_disable set/get" do
32
- EinaLog.file_disable_set true
33
- EinaLog.file_disable_get.should be_true
34
- EinaLog.file_disable_set false
35
- EinaLog.file_disable_get.should be_false
29
+ bool_check EinaLog, 'file_disable'
36
30
  end
37
31
  #
38
32
  it "function_disable set/get" do
39
- EinaLog.function_disable_set true
40
- EinaLog.function_disable_get.should be_true
41
- EinaLog.function_disable_set false
42
- EinaLog.function_disable_get.should be_false
33
+ bool_check EinaLog, 'function_disable'
43
34
  end
44
35
  #
45
36
  it "abort_on_critical set/get" do
46
- EinaLog.abort_on_critical_set true
47
- EinaLog.abort_on_critical_get.should be_true
48
- EinaLog.abort_on_critical_set false
49
- EinaLog.abort_on_critical_get.should be_false
37
+ bool_check EinaLog, 'abort_on_critical'
50
38
  end
51
39
  #
52
40
  it "abort_on_critical_level set/get" do
53
41
  EinaLog.abort_on_critical_level_set 2
54
42
  EinaLog.abort_on_critical_level_get.should == 2
55
- EinaLog.abort_on_critical_level_set 3
56
- EinaLog.abort_on_critical_level_get.should == 3
43
+ EinaLog.abort_on_critical_level = 3
44
+ EinaLog.abort_on_critical_level.should == 3
57
45
  end
58
46
  #
59
47
  it "domain register, unregister, level set/get" do
data/spec/eina_spec.rb CHANGED
@@ -4,23 +4,34 @@
4
4
  require 'efl/eina'
5
5
  #
6
6
  describe "Efl::Eina #{Efl::Eina.version.full}" do
7
- before(:all) {
8
- @i = Efl::Eina.init
9
- }
10
- after(:all) {
7
+ before(:all) do
8
+ @init = Efl::Eina.init
9
+ end
10
+ after(:all) do
11
11
  Efl::Eina.shutdown
12
- }
12
+ end
13
13
  #
14
14
  it "should init" do
15
- Efl::Eina.init.should == @i+1
16
- Efl::Eina.init.should == @i+2
17
- Efl::Eina.init.should == @i+3
15
+ Efl::Eina.init.should == @init+1
16
+ Efl::Eina.init.should == @init+2
17
+ Efl::Eina.init.should == @init+3
18
+ end
19
+ #
20
+ it "should be main thread" do
21
+ Efl::Eina.main_loop_is.should be_true
22
+ if RUBY_VERSION > "1.9.0"
23
+ Thread.new do
24
+ Efl::Eina.main_loop_is.should be_false
25
+ end.join
26
+ else
27
+ puts " no bother on 1.8 branch"
28
+ end
18
29
  end
19
30
  #
20
31
  it "should shutdown" do
21
- Efl::Eina.shutdown.should == @i+2
22
- Efl::Eina.shutdown.should == @i+1
23
- Efl::Eina.shutdown.should == @i+0
32
+ Efl::Eina.shutdown.should == @init+2
33
+ Efl::Eina.shutdown.should == @init+1
34
+ Efl::Eina.shutdown.should == @init
24
35
  end
25
36
  #
26
37
  end
data/spec/elm_spec.rb CHANGED
@@ -6,13 +6,24 @@ require './spec/helper'
6
6
  #
7
7
  describe "Efl::Elm #{Efl::Elm.version.full}" do
8
8
  #
9
- before(:all) {
9
+ before(:all) do
10
10
  Elm = Efl::Elm
11
- Elm.init.should == 1
12
- }
13
- after(:all) {
14
- Elm.shutdown.should == 0
15
- }
11
+ @init = Elm.init
12
+ end
13
+ after(:all) do
14
+ Elm.shutdown
15
+ end
16
+ it "should init" do
17
+ Elm.init.should == @init+1
18
+ Elm.init.should == @init+2
19
+ Elm.init.should == @init+3
20
+ end
21
+ #
22
+ it "should shutdown" do
23
+ Elm.shutdown.should == @init+2
24
+ Elm.shutdown.should == @init+1
25
+ Elm.shutdown.should == @init
26
+ end
16
27
  #
17
28
  describe Efl::Elm::ElmWin do
18
29
  before(:each) {
@@ -234,43 +245,6 @@ describe "Efl::Elm #{Efl::Elm.version.full}" do
234
245
  end
235
246
  end
236
247
  #
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
248
  describe Efl::Elm::ElmLabel do
275
249
  #
276
250
  before(:all) {
@@ -283,13 +257,6 @@ describe "Efl::Elm #{Efl::Elm.version.full}" do
283
257
  @win.free
284
258
  }
285
259
  #
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
260
  it "line_wrap set/get" do
294
261
  @lb.line_wrap_set :elm_wrap_char
295
262
  @lb.line_wrap_get.should == :elm_wrap_char
data/spec/evas_spec.rb CHANGED
@@ -8,23 +8,25 @@ require './spec/helper'
8
8
  #
9
9
  describe "Efl::Evas #{Efl::Evas.version.full}" do
10
10
  #
11
- before(:all) {
11
+ before(:all) do
12
12
  Evas = Efl::Evas
13
13
  Native = Efl::Native unless Kernel.const_defined? 'Native'
14
- Evas.init.should == 1
15
- }
16
- after(:all) {
14
+ @init = Evas.init
15
+ end
16
+ after(:all) do
17
17
  Evas.shutdown.should == 0
18
- }
18
+ end
19
19
  #
20
20
  it "should init" do
21
- Evas.init.should == 2
22
- Evas.init.should == 3
21
+ Evas.init.should == @init+1
22
+ Evas.init.should == @init+2
23
+ Evas.init.should == @init+3
23
24
  end
24
25
  #
25
26
  it "should shutdown" do
26
- Evas.shutdown.should == 2
27
- Evas.shutdown.should == 1
27
+ Evas.shutdown.should == @init+2
28
+ Evas.shutdown.should == @init+1
29
+ Evas.shutdown.should == @init
28
30
  end
29
31
  #
30
32
  it "evas alloc error enum is ok" do
@@ -520,7 +522,7 @@ describe "Efl::Evas #{Efl::Evas.version.full}" do
520
522
  @o.anti_alias_get.should be_false
521
523
  end
522
524
  #
523
- it "sccale set/get " do
525
+ it "scale set/get " do
524
526
  @o.scale_set 1.5
525
527
  @o.scale_get.should == 1.5
526
528
  @o.scale= 1.6
@@ -632,7 +634,7 @@ describe "Efl::Evas #{Efl::Evas.version.full}" do
632
634
  @t.horiz_advance_get.should > 0
633
635
  @t.vert_advance_get.should > 0
634
636
  @t.inset_get.should > 0
635
- @t.direction_get.should == :evas_bidi_direction_ltr
637
+ @t.direction_get.should == :evas_bidi_direction_neutral
636
638
  @t.style_pad_get.length.should == 4
637
639
  @t.ascent.should > 0
638
640
  @t.descent.should > 0
@@ -641,7 +643,7 @@ describe "Efl::Evas #{Efl::Evas.version.full}" do
641
643
  @t.horiz_advance.should > 0
642
644
  @t.vert_advance.should > 0
643
645
  @t.inset.should > 0
644
- @t.direction.should == :evas_bidi_direction_ltr
646
+ @t.direction.should == :evas_bidi_direction_neutral
645
647
  @t.style_pad.length.should == 4
646
648
  end
647
649
  #
data/tasks/gem.rake CHANGED
@@ -77,7 +77,7 @@ class GemPackageTask < Rake::PackageTask
77
77
  end
78
78
  end
79
79
  end
80
-
80
+
81
81
  def gem_file
82
82
  if @gem_spec.platform == Gem::Platform::RUBY
83
83
  "#{package_name}.gem"
data/tasks/helpers.rb CHANGED
@@ -89,7 +89,7 @@ end
89
89
  # files = []
90
90
  # exclude = PROJ.exclude.dup
91
91
  # comment = %r/^\s*#/
92
- #
92
+ #
93
93
  # # process the ignore file and add the items there to the exclude list
94
94
  # if test(?f, PROJ.ignore_file)
95
95
  # ary = []
data/tasks/rdoc.rake CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  #
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  namespace :doc do
6
6
  desc 'Generate RDoc documentation'
@@ -8,7 +8,7 @@ namespace :doc do
8
8
  rdoc = PROJ.rdoc
9
9
  rd.main = rdoc.main
10
10
  rd.rdoc_dir = rdoc.dir
11
-
11
+
12
12
  incl = Regexp.new(rdoc.include.join('|'))
13
13
  excl = Regexp.new(rdoc.exclude.join('|'))
14
14
  files = PROJ.gem.files.find_all do |fn|
@@ -24,12 +24,12 @@ namespace :doc do
24
24
  rd.options << "-t #{title}"
25
25
  rd.options.concat(rdoc.opts)
26
26
  end
27
-
27
+
28
28
  desc 'Generate ri locally for testing'
29
29
  task :ri => :clobber_ri do
30
30
  sh "#{RDOC} --ri -o ri ."
31
31
  end
32
-
32
+
33
33
  task :clobber_ri do
34
34
  rm_r 'ri' rescue nil
35
35
  end
data/tasks/svn.rake CHANGED
@@ -35,7 +35,7 @@ namespace :svn do
35
35
 
36
36
  puts "Creating SVN tag '#{tag}'"
37
37
  unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
38
- abort "Tag creation failed"
38
+ abort "Tag creation failed"
39
39
  end
40
40
  end
41
41
 
data/test/test_elm_win.rb CHANGED
@@ -9,26 +9,27 @@ class MyWin < Elm::ElmWin
9
9
  #
10
10
  def initialize name, title
11
11
  super FFI::MemoryPointer::NULL, name
12
- title_set title
12
+ title = title
13
13
  feed
14
- smart_callback_add "delete,request", method(:exit), FFI::MemoryPointer.from_string("my data")
14
+ smart_callback_add "delete,request", method(:on_delete), FFI::MemoryPointer.from_string("my data")
15
15
  end
16
16
  def feed
17
17
  @bg = Elm::ElmBg.new(self) do |bg|
18
- bg.size_hint_weight_set 1.0, 1.0
19
18
  # bg.color = 200,255,100
20
- bg.evas_object_color_set 200,255,100,150
19
+ bg.size_hint_weight_expand
20
+ bg.evas_object_color = 200,255,100,150
21
21
  bg.show
22
22
  end
23
23
  resize_object_add @bg
24
24
  @lb = Elm::ElmLabel.new(self) do |lb|
25
- lb.label_set "Hello World!"
26
- lb.size_hint_weight_set 1.0, 1.0
25
+ lb.label = "Hello World!"
26
+ lb.size_hint_align_fill
27
+ lb.size_hint_weight_expand
27
28
  end
28
29
  @lb.show
29
30
  resize_object_add @lb
30
31
  end
31
- def exit data, evas_object, event_info
32
+ def on_delete data, evas_object, event_info
32
33
  puts "EXIT #{data.read_string}"
33
34
  Elm.exit
34
35
  end
@@ -37,7 +38,7 @@ end
37
38
  Elm.init
38
39
  #
39
40
  win = MyWin.new "App name", "Window Title" do |w|
40
- w.alpha_set true
41
+ w.alpha = true
41
42
  w.move 300, 300
42
43
  w.resize 200, 100
43
44
  w.show
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ffi-efl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - "J\xC3\xA9r\xC3\xA9my Zurcher"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-11 00:00:00 Z
13
+ date: 2011-08-18 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 3.6.5
45
+ version: 3.7.1
46
46
  type: :development
47
47
  version_requirements: *id003
48
48
  description: A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries).
@@ -86,6 +86,7 @@ files:
86
86
  - lib/efl/native/eina_log.rb
87
87
  - lib/efl/native/eina_types.rb
88
88
  - lib/efl/native/elementary.rb
89
+ - lib/efl/native/emap.rb
89
90
  - lib/efl/native/evas.rb
90
91
  - spec/ecore_evas_spec.rb
91
92
  - spec/ecore_getopt_spec.rb
@@ -144,12 +145,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  requirements: []
145
146
 
146
147
  rubyforge_project: ffi-efl
147
- rubygems_version: 1.8.1
148
+ rubygems_version: 1.8.8
148
149
  signing_key:
149
150
  specification_version: 3
150
151
  summary: A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries)
151
152
  test_files:
153
+ - test/test_elm_win.rb
152
154
  - test/test_evas.rb
153
- - test/test_elm_win-native.rb
154
155
  - test/test_edje.rb
155
- - test/test_elm_win.rb
156
+ - test/test_elm_win-native.rb