ffi-efl 0.0.5 → 0.0.6

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.
data/spec/edje_spec.rb CHANGED
@@ -19,35 +19,16 @@ end
19
19
  require 'efl/eina_list'
20
20
  require 'efl/evas'
21
21
  require 'efl/edje'
22
+ require './spec/helper'
22
23
  #
23
- describe Efl::Edje do
24
+ describe "Efl::Edje #{Efl::Edje.version.full}" do
24
25
  #
25
- def realize_evas
26
- width = 300
27
- height = 200
28
- @pixels = FFI::MemoryPointer.new :int, width*height
29
- @e = Efl::Evas::REvas.new
30
- @e.output_method_set Efl::Evas::render_method_lookup("buffer")
31
- @e.output_viewport_set 0, 0, width, height
32
- @e.output_size_set width, height
33
- einfo = Efl::Native::EngineInfoBufferStruct.new @e.engine_info
34
- einfo[:info][:depth_type] = Efl::Evas::EVAS_ENGINE_BUFFER_DEPTH_ARGB32
35
- einfo[:info][:dest_buffer] = @pixels
36
- einfo[:info][:dest_buffer_row_bytes] = width * FFI::type_size(:int);
37
- einfo[:info][:use_color_key] = 0;
38
- einfo[:info][:alpha_threshold] = 0;
39
- einfo[:info][:func][:new_update_region] = nil #FFI::Pointer::NULL;
40
- einfo[:info][:func][:free_update_region] = nil #FFI::Pointer::NULL;
41
- @e.engine_info_set einfo
42
- end
43
- #
44
- before(:all) { Edje = Efl::Edje }
45
- #
46
- before(:each) {
47
- Edje.init
26
+ before(:all) {
27
+ Edje = Efl::Edje
28
+ Edje.init.should == 1
48
29
  }
49
- after(:each) {
50
- Edje.shutdown
30
+ after(:all) {
31
+ Edje.shutdown == 0
51
32
  }
52
33
  #
53
34
  it "should init" do
@@ -60,7 +41,7 @@ describe Efl::Edje do
60
41
  Edje.shutdown.should == 1
61
42
  end
62
43
  #
63
- it "frametime get/set should work" do
44
+ it "frametime get/set " do
64
45
  Edje.frametime_set 10
65
46
  Edje.frametime_get.should == 10
66
47
  end
@@ -70,39 +51,39 @@ describe Efl::Edje do
70
51
  Edje.thaw
71
52
  end
72
53
  #
73
- it "font_set_append should work" do
54
+ it "font_set_append " do
74
55
  Edje.fontset_append_set "my font"
75
56
  Edje.fontset_append_get.should == "my font"
76
57
  end
77
58
  #
78
- it "scale get/set should work" do
59
+ it "scale get/set " do
79
60
  Edje.scale_set 0.3
80
61
  Edje.scale_get.should == 0.3
81
62
  end
82
63
  #
83
- it "file_collection_list should work" do
64
+ it "file_collection_list " do
84
65
  l = Efl::EinaList::REinaList.new Edje.file_collection_list EDJE_FILE
85
66
  l.to_ary.length.should > 0
86
67
  Edje.file_collection_list_free l
87
68
  end
88
69
  #
89
- it "file_group_exists should work" do
70
+ it "file_group_exists " do
90
71
  Edje.file_group_exists(EDJE_FILE, "my_group").should be_true
91
72
  Edje.file_group_exists(EDJE_FILE, "my_grup").should be_false
92
73
  end
93
74
  #
94
- it "file_data_get should work" do
75
+ it "file_data_get " do
95
76
  Edje.file_data_get(EDJE_FILE, "key1").should == "val1"
96
77
  Edje.file_data_get(EDJE_FILE, "key2").should == nil
97
78
  end
98
79
  #
99
- it "file_cache get/set should work" do
80
+ it "file_cache get/set " do
100
81
  Edje.file_cache_set 2
101
82
  Edje.file_cache_get.should == 2
102
83
  Edje.file_cache_flush
103
84
  end
104
85
  #
105
- it "collection_cache get/set should work" do
86
+ it "collection_cache get/set " do
106
87
  Edje.collection_cache_set 6
107
88
  Edje.collection_cache_get.should == 6
108
89
  Edje.collection_cache_flush
@@ -114,7 +95,6 @@ describe Efl::Edje do
114
95
  describe Efl::Edje::REdje do
115
96
  before(:all) do
116
97
  Efl::Evas.init
117
- Efl::Edje.init
118
98
  realize_evas
119
99
  @ed = @e.edje_object_add
120
100
  @ed.file_set EDJE_FILE, "my_group"
@@ -125,31 +105,25 @@ describe Efl::Edje do
125
105
  after(:all) do
126
106
  @e.free
127
107
  @pixels.free
128
- Efl::Edje.shutdown
129
- Efl::Evas.shutdown
108
+ Efl::Evas.shutdown.should==0
130
109
  end
131
110
  #
132
- it "scale get/set should work" do
111
+ it "scale get/set " do
133
112
  @ed.scale_set 0.3
134
113
  @ed.scale_get.should == 0.3
135
114
  end
136
115
  #
137
- it "mirrored get/set should work" do
138
- @ed.mirrored_set true
139
- @ed.mirrored_get.should be_true
140
- @ed.mirrored = false
141
- @ed.mirrored.should be_false
142
- @ed.mirrored?.should be_false
143
- @ed.mirrored_get.should be_false
116
+ it "mirrored get/set " do
117
+ bool_check @ed, 'mirrored'
144
118
  end
145
119
  #
146
- it "data_get hould work" do
120
+ it "data_get" do
147
121
  @ed.data("key2").should == "val2"
148
122
  @ed.data_get("key2").should == "val2"
149
123
  @ed.data_get("key1").should == nil
150
124
  end
151
125
  #
152
- it "file_get should work" do
126
+ it "file_get " do
153
127
  @ed.file_get[0].should == EDJE_FILE
154
128
  @ed.file_get[1].should == "my_group"
155
129
  end
data/spec/eet_spec.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  require 'efl/eet'
5
5
  #
6
- describe Efl::Eet do
6
+ describe "Efl::Eet #{Efl::Eet.version.full}" do
7
7
  #
8
8
  before(:all) {
9
9
  Eet = Efl::Eet
@@ -39,8 +39,8 @@ describe Efl::Eet do
39
39
  end
40
40
  #
41
41
  describe Efl::Eet::REetFile do
42
- before(:each) { Eet.init }
43
- after(:each) { Eet.shutdown }
42
+ before(:all) { Eet.init.should==1 }
43
+ after(:all) { Eet.shutdown.should==0 }
44
44
  #
45
45
  it "should open and close" do
46
46
  f = REetFile.open FP, Native.enum_type(:eet_file_mode)[:eet_file_mode_write]
@@ -167,7 +167,7 @@ describe Efl::EinaHash do
167
167
  h[k3].read_string.should == "D3"
168
168
  end
169
169
  #
170
- it "alternate constructor should work" do
170
+ it "alternate constructor" do
171
171
  cstr_cnt = 0
172
172
  h = REinaHash.new { cstr_cnt+=1; Efl::Native.eina_hash_string_superfast_new FFI::Pointer::NULL }
173
173
  cstr_cnt.should == 1
@@ -92,7 +92,7 @@ describe Efl::EinaList do
92
92
  l.free
93
93
  end
94
94
  #
95
- it "Enumerable should work" do
95
+ it "Enumerable" do
96
96
  l = REinaList.new
97
97
  d1 = ::FFI::MemoryPointer.from_string "D0"
98
98
  d2 = ::FFI::MemoryPointer.from_string "D1"
@@ -0,0 +1,83 @@
1
+ #! /usr/bin/env ruby
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ require 'efl/eina'
5
+ require 'efl/eina_log'
6
+ require './spec/helper'
7
+ #
8
+ describe Efl::EinaLog do
9
+ before(:all) {
10
+ Efl::Eina.init
11
+ EinaLog = Efl::EinaLog
12
+ }
13
+ after(:all) {
14
+ Efl::Eina.shutdown
15
+ }
16
+ #
17
+ it "level set/get" do
18
+ EinaLog.level_set 2
19
+ EinaLog.level_get.should == 2
20
+ EinaLog.level_set 3
21
+ EinaLog.level_get.should == 3
22
+ end
23
+ #
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
29
+ end
30
+ #
31
+ 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
36
+ end
37
+ #
38
+ 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
43
+ end
44
+ #
45
+ 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
50
+ end
51
+ #
52
+ it "abort_on_critical_level set/get" do
53
+ EinaLog.abort_on_critical_level_set 2
54
+ 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
57
+ end
58
+ #
59
+ it "domain register, unregister, level set/get" do
60
+ d = EinaLog.domain_register "mydom", EinaLog::COLOR_CYAN
61
+ d.should > 0
62
+ EinaLog.domain_level_set "mydom", 2
63
+ EinaLog.domain_level_get("mydom").should == 2
64
+ EinaLog.domain_registered_level_get(d).should == 2
65
+ EinaLog.domain_level_set "mydom", 1
66
+ EinaLog.domain_level_get("mydom").should == 1
67
+ EinaLog.domain_registered_level_get(d).should == 1
68
+ EinaLog.domain_unregister d
69
+ end
70
+ #
71
+ it "treads enable check" do
72
+ EinaLog.main_thread_check.should be_true
73
+ EinaLog.threads_enable
74
+ end
75
+ # EAPI void eina_log_threads_enable(void);
76
+ # EAPI void eina_log_print_cb_set(Eina_Log_Print_Cb cb, void *data);
77
+ #
78
+ # EAPI void eina_log_print(int domain, Eina_Log_Level level, const char *file, const char *function, int line, const char *fmt, ...);
79
+ # EAPI void eina_log_vprint(int domain, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, va_list args);
80
+ # EAPI void eina_log_print_cb_stdout(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
81
+ # EAPI void eina_log_print_cb_stderr(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
82
+ # EAPI void eina_log_print_cb_file(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
83
+ end
data/spec/eina_spec.rb CHANGED
@@ -3,18 +3,24 @@
3
3
  #
4
4
  require 'efl/eina'
5
5
  #
6
- describe Efl::Eina do
6
+ describe "Efl::Eina #{Efl::Eina.version.full}" do
7
+ before(:all) {
8
+ @i = Efl::Eina.init
9
+ }
10
+ after(:all) {
11
+ Efl::Eina.shutdown
12
+ }
7
13
  #
8
14
  it "should init" do
9
- Efl::Eina.init.should == 1
10
- Efl::Eina.init.should == 2
11
- Efl::Eina.init.should == 3
15
+ Efl::Eina.init.should == @i+1
16
+ Efl::Eina.init.should == @i+2
17
+ Efl::Eina.init.should == @i+3
12
18
  end
13
19
  #
14
20
  it "should shutdown" do
15
- Efl::Eina.shutdown.should == 2
16
- Efl::Eina.shutdown.should == 1
17
- Efl::Eina.shutdown.should == 0
21
+ Efl::Eina.shutdown.should == @i+2
22
+ Efl::Eina.shutdown.should == @i+1
23
+ Efl::Eina.shutdown.should == @i+0
18
24
  end
19
25
  #
20
26
  end