summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-05 00:13:06 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-05 00:13:06 +0200
commitf3d11962e77d25d19a312b4baa1a390539b2187b (patch)
treed7a3842583a0607cba272a85b210f5947ed9ec57 /spec
parente4baccaefd209a25daa3ff8d5277fe86aca1d379 (diff)
downloadffi-efl-f3d11962e77d25d19a312b4baa1a390539b2187b.zip
ffi-efl-f3d11962e77d25d19a312b4baa1a390539b2187b.tar.gz
all FFI into one module Efl::Native
Diffstat (limited to 'spec')
-rw-r--r--spec/ecore_getopt_spec.rb2
-rw-r--r--spec/eet_spec.rb15
-rw-r--r--spec/eina_hash_spec.rb2
-rw-r--r--spec/evas_spec.rb37
4 files changed, 30 insertions, 26 deletions
diff --git a/spec/ecore_getopt_spec.rb b/spec/ecore_getopt_spec.rb
index 62916c1..cdd04e3 100644
--- a/spec/ecore_getopt_spec.rb
+++ b/spec/ecore_getopt_spec.rb
@@ -49,7 +49,7 @@ describe Efl::EcoreGetopt do
@p.help 'H', 'help'
@p.value :boolp, @values[:help]
# FIXME debug callback : ecore_getopt_callback_ecore_evas_list_engines
- @p.callback_noargs 'E', 'list-engines', 'list ecore-evas available engines', Efl::EcoreEvas::Native.method(:ecore_getopt_callback_ecore_evas_list_engines), FFI::Pointer::NULL
+ @p.callback_noargs 'E', 'list-engines', 'list ecore-evas available engines', Efl::Native.method(:ecore_getopt_callback_ecore_evas_list_engines), FFI::Pointer::NULL
@p.value :boolp, @values[:engines]
@p.store_type :int, 'i', 'int', 'store an integer'
@p.value :intp, @values[:int]
diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb
index 89da878..67f4ed2 100644
--- a/spec/eet_spec.rb
+++ b/spec/eet_spec.rb
@@ -7,6 +7,7 @@ describe Efl::Eet do
#
before(:all) {
Eet = Efl::Eet
+ Native = Efl::Native
REetFile = Efl::Eet::REetFile
}
#
@@ -31,10 +32,10 @@ describe Efl::Eet do
end
#
it "should have good enums" do
- Eet::Native.enum_type(:eet_file_mode)[:eet_file_mode_invalid].should == -1
- Eet::Native.enum_type(:eet_file_mode)[:eet_file_mode_read].should == 0
- Eet::Native.enum_type(:eet_file_mode)[:eet_file_mode_write].should == 1
- Eet::Native.enum_type(:eet_file_mode)[:eet_file_mode_read_write].should == 2
+ Native.enum_type(:eet_file_mode)[:eet_file_mode_invalid].should == -1
+ Native.enum_type(:eet_file_mode)[:eet_file_mode_read].should == 0
+ Native.enum_type(:eet_file_mode)[:eet_file_mode_write].should == 1
+ Native.enum_type(:eet_file_mode)[:eet_file_mode_read_write].should == 2
end
#
describe Efl::Eet::REetFile do
@@ -42,15 +43,15 @@ describe Efl::Eet do
after(:each) { Eet.shutdown }
#
it "should open and close" do
- f = REetFile.open FP, Eet::Native.enum_type(:eet_file_mode)[:eet_file_mode_write]
+ f = REetFile.open FP, Native.enum_type(:eet_file_mode)[:eet_file_mode_write]
f.write 'fake', 'value'
f.close
end
#
it "should be able to get file access mode" do
- Eet::Native.enum_type(:eet_file_mode).symbols.each do |m|
+ Native.enum_type(:eet_file_mode).symbols.each do |m|
next if m==:eet_file_mode_invalid
- REetFile.open FP, Eet::Native.enum_type(:eet_file_mode)[m] do |f|
+ REetFile.open FP, Native.enum_type(:eet_file_mode)[m] do |f|
f.mode_get.should == m
end
end
diff --git a/spec/eina_hash_spec.rb b/spec/eina_hash_spec.rb
index fbf8985..3c073c5 100644
--- a/spec/eina_hash_spec.rb
+++ b/spec/eina_hash_spec.rb
@@ -169,7 +169,7 @@ describe Efl::EinaHash do
#
it "alternate constructor should work" do
cstr_cnt = 0
- h = REinaHash.new { cstr_cnt+=1; Efl::EinaHash::Native.eina_hash_string_superfast_new FFI::Pointer::NULL }
+ h = REinaHash.new { cstr_cnt+=1; Efl::Native.eina_hash_string_superfast_new FFI::Pointer::NULL }
cstr_cnt.should == 1
end
end
diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb
index 728935b..135e8bf 100644
--- a/spec/evas_spec.rb
+++ b/spec/evas_spec.rb
@@ -6,7 +6,10 @@ require 'efl/evas'
#
describe Efl::Evas do
#
- before(:all) { Evas = Efl::Evas }
+ before(:all) {
+ Evas = Efl::Evas
+ Native = Efl::Native
+ }
#
it "should init" do
Evas.init.should == 1
@@ -21,15 +24,15 @@ describe Efl::Evas do
end
#
it "evas alloc error enum is ok" do
- Evas::Native.enum_value(:evas_alloc_error_none).should == 0
- Evas::Native.enum_value(:evas_alloc_error_fatal).should == 1
- Evas::Native.enum_value(:evas_alloc_error_recovered).should == 2
- Evas::Native.enum_type(:evas_alloc_error)[0].should == :evas_alloc_error_none
- Evas::Native.enum_type(:evas_alloc_error)[1].should == :evas_alloc_error_fatal
- Evas::Native.enum_type(:evas_alloc_error)[2].should == :evas_alloc_error_recovered
- Evas::Native.enum_type(:evas_alloc_error)[:evas_alloc_error_none].should == 0
- Evas::Native.enum_type(:evas_alloc_error)[:evas_alloc_error_fatal].should == 1
- Evas::Native.enum_type(:evas_alloc_error)[:evas_alloc_error_recovered].should == 2
+ Native.enum_value(:evas_alloc_error_none).should == 0
+ Native.enum_value(:evas_alloc_error_fatal).should == 1
+ Native.enum_value(:evas_alloc_error_recovered).should == 2
+ Native.enum_type(:evas_alloc_error)[0].should == :evas_alloc_error_none
+ Native.enum_type(:evas_alloc_error)[1].should == :evas_alloc_error_fatal
+ Native.enum_type(:evas_alloc_error)[2].should == :evas_alloc_error_recovered
+ Native.enum_type(:evas_alloc_error)[:evas_alloc_error_none].should == 0
+ Native.enum_type(:evas_alloc_error)[:evas_alloc_error_fatal].should == 1
+ Native.enum_type(:evas_alloc_error)[:evas_alloc_error_recovered].should == 2
end
#
it "should have no memory allocation error occured" do
@@ -63,7 +66,7 @@ describe Efl::Evas do
@e.output_method_set Evas::render_method_lookup("buffer")
@e.output_viewport_set 0, 0, @width, @height
@e.output_size_set @width, @height
- einfo = Evas::Native::EngineInfoBufferStruct.new @e.engine_info_get
+ einfo = Native::EngineInfoBufferStruct.new @e.engine_info_get
einfo[:info][:depth_type] = Efl::Evas::EVAS_ENGINE_BUFFER_DEPTH_ARGB32
einfo[:info][:dest_buffer] = @pixels
einfo[:info][:dest_buffer_row_bytes] = @width * FFI::type_size(:int);
@@ -90,7 +93,7 @@ describe Efl::Evas do
e1.to_ptr.should be_nil
e2.free
e2.free
- e4 = Evas::REvas.new Evas::Native.evas_new
+ e4 = Evas::REvas.new Native.evas_new
e4.address.should_not == 0
e5 = e4.dup
e4.address.should == e5.address
@@ -101,10 +104,10 @@ describe Efl::Evas do
end
#
it "focus should work" do
- Evas::Native.evas_focus_in @e.to_ptr
- Evas::Native.evas_focus_state_get(@e.to_ptr).should be_true
- Evas::Native.evas_focus_out @e.to_ptr
- Evas::Native.evas_focus_state_get(@e.to_ptr).should be_false
+ Native.evas_focus_in @e.to_ptr
+ Native.evas_focus_state_get(@e.to_ptr).should be_true
+ Native.evas_focus_out @e.to_ptr
+ Native.evas_focus_state_get(@e.to_ptr).should be_false
Evas.focus_in @e.to_ptr
Evas.focus_state_get(@e.to_ptr).should be_true
Evas.focus_out @e.to_ptr
@@ -268,7 +271,7 @@ describe Efl::Evas do
@e.output_method_set Evas.render_method_lookup("buffer")
@e.output_viewport_set 0, 0, 100, 100
@e.output_size_set 100, 100
- einfo = Evas::Native::EngineInfoBufferStruct.new @e.engine_info_get
+ einfo = Native::EngineInfoBufferStruct.new @e.engine_info_get
einfo[:info][:depth_type] = Efl::Evas::EVAS_ENGINE_BUFFER_DEPTH_ARGB32
einfo[:info][:dest_buffer] = @pixels
einfo[:info][:dest_buffer_row_bytes] = 100 * FFI::type_size(:int);