summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-05 12:14:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-05 12:14:03 +0200
commit36707e379932a8de7c1940b945ec9ea9d3bbb4c6 (patch)
tree705feef206253a0ddd1b346f6d7a02b7a59d21c1 /spec
parent429e5812eab616a3db352b5ae84d1c2bcf9278b4 (diff)
downloadffi-efl-36707e379932a8de7c1940b945ec9ea9d3bbb4c6.zip
ffi-efl-36707e379932a8de7c1940b945ec9ea9d3bbb4c6.tar.gz
add classes : REvasRectangle, REvasLine, REvasPolygon and specs
Diffstat (limited to 'spec')
-rw-r--r--spec/evas_spec.rb91
1 files changed, 61 insertions, 30 deletions
diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb
index d437619..8936cfe 100644
--- a/spec/evas_spec.rb
+++ b/spec/evas_spec.rb
@@ -5,6 +5,24 @@ require 'efl/ecore'
require 'efl/evas'
#
describe Efl::Evas do
+ def realize_evas
+ @width = 800
+ @height = 600
+ @pixels = FFI::MemoryPointer.new :int, @width*@height
+ @e = Evas::REvas.new
+ @e.output_method_set Evas::render_method_lookup("buffer")
+ @e.output_viewport_set 0, 0, @width, @height
+ @e.output_size_set @width, @height
+ einfo = Native::EngineInfoBufferStruct.new @e.engine_info
+ 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);
+ einfo[:info][:use_color_key] = 0;
+ einfo[:info][:alpha_threshold] = 0;
+ 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
+ end
#
before(:all) {
Evas = Efl::Evas
@@ -59,22 +77,7 @@ describe Efl::Evas do
describe Efl::Evas::REvas do
before(:all) do
Evas.init
- @width = 800
- @height = 600
- @pixels = FFI::MemoryPointer.new :int, @width*@height
- @e = Evas::REvas.new
- @e.output_method_set Evas::render_method_lookup("buffer")
- @e.output_viewport_set 0, 0, @width, @height
- @e.output_size_set @width, @height
- einfo = Native::EngineInfoBufferStruct.new @e.engine_info
- 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);
- einfo[:info][:use_color_key] = 0;
- einfo[:info][:alpha_threshold] = 0;
- 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
+ realize_evas
end
after(:all) do
@e.free
@@ -306,20 +309,7 @@ describe Efl::Evas do
#
before(:all) 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_viewport_set 0, 0, 100, 100
- @e.output_size_set 100, 100
- einfo = Native::EngineInfoBufferStruct.new @e.engine_info
- 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);
- einfo[:info][:use_color_key] = 0;
- einfo[:info][:alpha_threshold] = 0;
- 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
+ realize_evas
@o = @e.object_add(:rectangle) { |o|
o.color = 200,200,200,200
o.move 0, 0
@@ -567,6 +557,47 @@ describe Efl::Evas do
@o.static_clip?.should be_false
@o.static_clip.should be_false
end
+ #
+ end
+ #
+ describe Efl::Evas::REvasLine do
+ #
+ before(:all) do
+ Evas.init
+ realize_evas
+ @l = @e.object_add 'line'
+ end
+ after(:all) do
+ @e.free
+ Evas.shutdown
+ end
+ it "xy get/set should work" do
+ @l.line_xy_set 10, 20, 30, 40
+ @l.line_xy_get.should == [10, 20, 30, 40]
+ end
+ end
+ #
+ describe Efl::Evas::REvasPolygon do
+ #
+ before(:all) do
+ Evas.init
+ realize_evas
+ @p = @e.object_add 'polygon'
+ end
+ after(:all) do
+ @e.free
+ Evas.shutdown
+ end
+ it "xy point_add should work" do
+ @p.point_add 10, 20
+ @p.point_add 30, 40
+ @p.point_add 50, 60
+ @p.point_add 80, 80
+ end
+ #
+ it "point clear shold work" do
+ @p.points_clear
+ end
end
#
end