summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-07 00:54:04 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-07 00:54:04 +0200
commit2aa685afae252676850dd7721b2540258375593a (patch)
tree6744b3a9202c38a10073e7d934ed806e479bfe84 /spec
parent77c7a3411531c72ab21f255b655653156411a2c6 (diff)
downloadffi-efl-2aa685afae252676850dd7721b2540258375593a.zip
ffi-efl-2aa685afae252676850dd7721b2540258375593a.tar.gz
extract realize_evas from specs
Diffstat (limited to 'spec')
-rw-r--r--spec/edje_spec.rb20
-rw-r--r--spec/evas_spec.rb20
-rw-r--r--spec/helper.rb22
3 files changed, 24 insertions, 38 deletions
diff --git a/spec/edje_spec.rb b/spec/edje_spec.rb
index cf67e4e..19998e5 100644
--- a/spec/edje_spec.rb
+++ b/spec/edje_spec.rb
@@ -19,28 +19,10 @@ end
require 'efl/eina_list'
require 'efl/evas'
require 'efl/edje'
+require './spec/helper'
#
describe Efl::Edje do
#
- def realize_evas
- width = 300
- height = 200
- @pixels = FFI::MemoryPointer.new :int, width*height
- @e = Efl::Evas::REvas.new
- @e.output_method_set Efl::Evas::render_method_lookup("buffer")
- @e.output_viewport_set 0, 0, width, height
- @e.output_size_set width, height
- einfo = Efl::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) { Edje = Efl::Edje }
#
before(:each) {
diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb
index 6bde803..7099e12 100644
--- a/spec/evas_spec.rb
+++ b/spec/evas_spec.rb
@@ -4,28 +4,10 @@
require 'efl/eina_list'
require 'efl/ecore'
require 'efl/evas'
+require './spec/helper'
#
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] = 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
Native = Efl::Native unless Kernel.const_defined? 'Native'
diff --git a/spec/helper.rb b/spec/helper.rb
new file mode 100644
index 0000000..9ba137a
--- /dev/null
+++ b/spec/helper.rb
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+def realize_evas
+ width = 300
+ height = 200
+ @pixels = FFI::MemoryPointer.new :int, width*height
+ @e = Efl::Evas::REvas.new
+ @e.output_method_set Efl::Evas::render_method_lookup("buffer")
+ @e.output_viewport_set 0, 0, width, height
+ @e.output_size_set width, height
+ einfo = Efl::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
+