summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-04 18:04:22 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-04 18:04:22 +0200
commite905aede58b598a0714852fb8ea6cdab353c8c45 (patch)
tree0be3fe555fa5c1efef431e03808141aa9f91058b
parenta4db205dfc6d4a73107e170cf7f3cef81ef760b6 (diff)
downloadffi-efl-e905aede58b598a0714852fb8ea6cdab353c8c45.zip
ffi-efl-e905aede58b598a0714852fb8ea6cdab353c8c45.tar.gz
update evas and specs
-rw-r--r--lib/efl/ecore_evas.rb11
-rw-r--r--lib/efl/evas.rb13
-rw-r--r--spec/evas_spec.rb74
3 files changed, 88 insertions, 10 deletions
diff --git a/lib/efl/ecore_evas.rb b/lib/efl/ecore_evas.rb
index 215bb3f..9bc1981 100644
--- a/lib/efl/ecore_evas.rb
+++ b/lib/efl/ecore_evas.rb
@@ -117,10 +117,13 @@ module Efl
# EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj);
Efl::EcoreEvas::REcoreEvas.new Efl::EcoreEvas.ecore_evas_object_ecore_evas_get @ptr
end
- def evas_get
- # EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj);
- Efl::Evas::REvas.new Efl::EcoreEvas.ecore_evas_object_evas_get @ptr
- end
+ alias :ecore_evas :ecore_evas_get
+ # FIXME override REvas#evas_get => evas_object_evas_get
+# def evas_get
+# # EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj);
+# Efl::Evas::REvas.new Efl::EcoreEvas.ecore_evas_object_evas_get @ptr
+# end
+# alias :evas :evas_get
end
end
#
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index aada313..a99f652 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -78,6 +78,7 @@ module Efl
Efl::Evas.evas_output_size_get @ptr, x, y
[ x.read_int, y.read_int ]
end
+ alias :size :output_size_get
def output_viewport_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
@@ -150,6 +151,18 @@ module Efl
[ r.read_int, g.read_int, b.read_int, a.read_int ]
end
alias :color :color_get
+ def evas_get
+ REvas.new Efl::Evas.evas_object_evas_get @ptr
+ end
+ alias :evas :evas_get
+ def above_get
+ REvasObject.new Efl::Evas.evas_object_above_get @ptr
+ end
+ alias :above :above_get
+ def below_get
+ REvasObject.new Efl::Evas.evas_object_below_get @ptr
+ end
+ alias :below :below_get
end
end
end
diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb
index a32782c..9a3749c 100644
--- a/spec/evas_spec.rb
+++ b/spec/evas_spec.rb
@@ -1,6 +1,7 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
+require 'efl/ecore'
require 'efl/evas'
#
describe Efl::Evas do
@@ -264,7 +265,7 @@ describe Efl::Evas do
Evas.init
@pixels = FFI::MemoryPointer.new :int, 100*100
@e = Evas::REvas.new
- @e.output_method_set Evas::render_method_lookup("buffer")
+ @e.output_method_set Evas.render_method_lookup("buffer")
@e.output_viewport_set 0, 0, 100, 100
@e.output_size_set 100, 100
einfo = Efl::Evas::EngineInfoBufferStruct.new @e.engine_info_get
@@ -276,11 +277,12 @@ describe Efl::Evas do
einfo[:info][:func][:new_update_region] = nil #FFI::Pointer::NULL;
einfo[:info][:func][:free_update_region] = nil #FFI::Pointer::NULL;
@e.engine_info_set einfo
- @o = @e.object_add :rectangle
- @o.color = 200,200,200,200
- @o.move 0, 0
- @o.resize 100, 100
- @o.show
+ @o = @e.object_add(:rectangle) { |o|
+ o.color = 200,200,200,200
+ o.move 0, 0
+ o.resize 100, 100
+ o.show
+ }
end
after(:all) do
@e.free
@@ -341,6 +343,66 @@ describe Efl::Evas do
@o.show
@o.visible?.should be_true
end
+ #
+ it "color get/set should work" do
+ @o.color_get.should == [200,200,200,200]
+ @o.color_set 0,50,100,200
+ @o.color.should == [0,50,100,200]
+ @o.color = 200,200,200,200
+ @o.color.should == [200,200,200,200]
+ end
+ #
+ it "evas_get should worl" do
+ @o.evas_get.should === @e
+ @o.evas.should === @e
+ end
+ #
+ it "type_get should work" do
+ @o.type_get.should == 'rectangle'
+ end
+ # TODO raise, lower
+ it "raise, lower, stck_below, stack_above should work" do
+ os = []
+ 0.upto(3) do
+ os << @e.object_add(:rectangle)
+ end
+ os[2].above.should === os[3]
+ os[2].below.should === os[1]
+ os[2].above_get.should === os[3]
+ os[2].below_get.should === os[1]
+ os[2].stack_below os[1]
+ os[2].above_get.should === os[1]
+ os[2].below_get.should === os[0]
+ os[2].stack_above os[1]
+ os[2].above_get.should === os[3]
+ os[2].below_get.should === os[1]
+ os.each do |o| o.free; end
+ end
+ #
+ it "event_callback should work" do
+ @o.move 0, 0 # FIXME why should I need this ?!?
+ count = 0
+ cb = Proc.new do |data,evas,evas_object,event_info|
+ count +=1
+ end
+ cb_data = FFI::MemoryPointer.from_string "my cb data"
+ @o.event_callback_add :evas_callback_mouse_in, cb, @o
+ Efl::Evas.event_feed_mouse_in @o.evas, Time.now.to_i, cb_data
+ sleep 0.1
+ count.should==1
+ end
+ #
+ it "pass event should work" do
+ @o.pass_events_get.should be_false
+ @o.pass_events_set true
+ @o.pass_events_get.should be_true
+ @o.pass_events=false
+ @o.pass_events_get.should be_false
+ @o.pass_events_set true
+ @o.pass_events_get.should be_true
+ @o.pass_events=false
+ @o.pass_events_get.should be_false
+ end
end
#
end