summaryrefslogtreecommitdiffstats
path: root/spec/edje_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/edje_spec.rb')
-rw-r--r--spec/edje_spec.rb322
1 files changed, 320 insertions, 2 deletions
diff --git a/spec/edje_spec.rb b/spec/edje_spec.rb
index 56cb7c0..1a82650 100644
--- a/spec/edje_spec.rb
+++ b/spec/edje_spec.rb
@@ -1,14 +1,58 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
+EDC_FILE=File.join '/tmp','edje_spec.edc'
+EDJE_FILE=File.join '/tmp','edje_spec.edj'
+#
+if __FILE__==$0
+ if not File.exists? EDJE_FILE
+ File.open(EDC_FILE,'w') do |f| f << DATA.read end
+ system "edje_cc #{EDC_FILE}"
+ end
+ exit File.exists?(EDJE_FILE)
+else
+ describe "generate #{EDJE_FILE}" do
+ it "" do
+ system("ruby #{__FILE__}").should be_true
+ end
+ end
+end
+#
+require 'efl/eina_list'
+require 'efl/evas'
require 'efl/edje'
#
+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
+#
describe Efl::Edje do
#
before(:all) { Edje = Efl::Edje }
#
+ before(:each) {
+ Edje.init
+ }
+ after(:each) {
+ Edje.shutdown
+ }
+ #
it "should init" do
- Edje.init.should == 1
Edje.init.should == 2
Edje.init.should == 3
end
@@ -16,7 +60,281 @@ describe Efl::Edje do
it "should shutdown" do
Edje.shutdown.should == 2
Edje.shutdown.should == 1
- Edje.shutdown.should == 0
end
#
+ it "frametime get/set should work" do
+ Edje.frametime_set 10
+ Edje.frametime_get.should == 10
+ end
+ #
+ it "freeze and thaw should run" do
+# Edje.freeze
+ Edje.thaw
+ end
+ #
+ it "font_set_append should work" do
+ Edje.fontset_append_set "my font"
+ Edje.fontset_append_get.should == "my font"
+ end
+ #
+ it "scale get/set should work" do
+ Edje.scale_set 0.3
+ Edje.scale_get.should == 0.3
+ end
+ #
+ it "file_collection_list should work" do
+ l = Efl::EinaList::REinaList.new Edje.file_collection_list EDJE_FILE
+ l.to_ary.length.should > 0
+ Edje.file_collection_list_free l
+ end
+ #
+ it "file_group_exists should work" do
+ Edje.file_group_exists(EDJE_FILE, "my_group").should be_true
+ Edje.file_group_exists(EDJE_FILE, "my_grup").should be_false
+ end
+ #
+ it "file_data_get should work" do
+ Edje.file_data_get(EDJE_FILE, "key1").should == "value1"
+ Edje.file_data_get(EDJE_FILE, "key6").should == nil
+ end
+ #
+ it "file_cache get/set should work" do
+ Edje.file_cache_set 2
+ Edje.file_cache_get.should == 2
+ Edje.file_cache_flush
+ end
+ #
+ it "collection_cache get/set should work" do
+ Edje.collection_cache_set 6
+ Edje.collection_cache_get.should == 6
+ Edje.collection_cache_flush
+ end
+ #
+ # TODO edje_color_class*
+ # TODO edje_text_class*
+ #
+ describe Efl::Edje::REdje do
+ before(:all) do
+ Efl::Evas.init
+ realize_evas
+ @ed = @e.edje_object_add
+ @ed.file_set EDJE_FILE, "my_group"
+ @ed.move 0, 0
+ @ed.resize 300, 200
+ @ed.show
+ end
+ after(:all) do
+ @e.free
+ @pixels.free
+ Efl::Evas.shutdown
+ end
+ #
+ it "scale get/set should work" do
+ @ed.scale_set 0.3
+ @ed.scale_get.should == 0.3
+ end
+ #
+ it "mirrored get/set should work" do
+ @ed.mirrored_set true
+ @ed.mirrored_get.should be_true
+ @ed.mirrored = false
+ @ed.mirrored.should be_false
+ @ed.mirrored?.should be_false
+ @ed.mirrored_get.should be_false
+ end
+ # EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh);
+ # EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh);
+ # EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah);
+ # EAPI void edje_box_layout_register (const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data);
+ # EAPI Evas_Object *edje_object_add (Evas *evas);
+ # EAPI const char *edje_object_data_get (const Evas_Object *obj, const char *key);
+ # EAPI Eina_Bool edje_object_file_set (Evas_Object *obj, const char *file, const char *group);
+ # EAPI void edje_object_file_get (const Evas_Object *obj, const char **file, const char **group);
+ # EAPI Edje_Load_Error edje_object_load_error_get (const Evas_Object *obj);
+ # EAPI const char *edje_load_error_str (Edje_Load_Error error);
+ # EAPI Eina_Bool edje_object_preload (Evas_Object *obj, Eina_Bool cancel);
+ # EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
+ # EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
+ # EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
+ # EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source);
+ # EAPI void edje_object_play_set (Evas_Object *obj, Eina_Bool play);
+ # EAPI Eina_Bool edje_object_play_get (const Evas_Object *obj);
+ # EAPI void edje_object_animation_set (Evas_Object *obj, Eina_Bool on);
+ # EAPI Eina_Bool edje_object_animation_get (const Evas_Object *obj);
+ # EAPI int edje_object_freeze (Evas_Object *obj);
+ # EAPI int edje_object_thaw (Evas_Object *obj);
+ # EAPI Eina_Bool edje_object_color_class_set (Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3);
+ # EAPI Eina_Bool edje_object_color_class_get (const Evas_Object *o, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3);
+ # EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class);
+ # EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size);
+ # EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
+ # EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
+ # EAPI void edje_object_calc_force (Evas_Object *obj);
+ # EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
+ # EAPI Eina_Bool edje_object_parts_extends_calc (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
+ # EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh);
+ # EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part);
+ # EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part);
+ # EAPI Eina_Bool edje_object_part_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
+ # EAPI void edje_object_item_provider_set (Evas_Object *obj, Edje_Item_Provider_Cb func, void *data);
+ # EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data);
+ # EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text);
+ # EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part);
+ # EAPI Eina_Bool edje_object_part_text_unescaped_set (Evas_Object *obj, const char *part, const char *text_to_escape);
+ # EAPI char *edje_object_part_text_unescaped_get (const Evas_Object *obj, const char *part);
+ # EAPI const char *edje_object_part_text_selection_get (const Evas_Object *obj, const char *part);
+ # EAPI void edje_object_part_text_select_none (const Evas_Object *obj, const char *part);
+ # EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part);
+ # EAPI void edje_object_part_text_insert (Evas_Object *obj, const char *part, const char *text);
+ # EAPI const Eina_List *edje_object_part_text_anchor_list_get (const Evas_Object *obj, const char *part);
+ # EAPI const Eina_List *edje_object_part_text_anchor_geometry_get (const Evas_Object *obj, const char *part, const char *anchor);
+ # EAPI const Eina_List *edje_object_part_text_item_list_get (const Evas_Object *obj, const char *part);
+ # EAPI Eina_Bool edje_object_part_text_item_geometry_get (const Evas_Object *obj, const char *part, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
+ # EAPI void edje_object_part_text_cursor_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
+ # EAPI void edje_object_part_text_select_allow_set (const Evas_Object *obj, const char *part, Eina_Bool allow);
+ # EAPI void edje_object_part_text_select_abort (const Evas_Object *obj, const char *part);
+ # EAPI void edje_object_part_text_select_begin (const Evas_Object *obj, const char *part);
+ # EAPI void edje_object_part_text_select_extend (const Evas_Object *obj, const char *part);
+ # EAPI Eina_Bool edje_object_part_text_cursor_next (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI Eina_Bool edje_object_part_text_cursor_prev (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI Eina_Bool edje_object_part_text_cursor_up (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI Eina_Bool edje_object_part_text_cursor_down (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI void edje_object_part_text_cursor_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI void edje_object_part_text_cursor_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI void edje_object_part_text_cursor_copy (Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst);
+ # EAPI void edje_object_part_text_cursor_line_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI void edje_object_part_text_cursor_line_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI Eina_Bool edje_object_part_text_cursor_coord_set (Evas_Object *obj, const char *part, Edje_Cursor cur, Evas_Coord x, Evas_Coord y);
+ # EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI void edje_object_part_text_cursor_pos_set (Evas_Object *obj, const char *part, Edje_Cursor cur, int pos);
+ # EAPI int edje_object_part_text_cursor_pos_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
+ # EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data);
+ # EAPI void *edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func);
+ # EAPI void *edje_object_text_insert_filter_callback_del_full (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data);
+ # EAPI Eina_Bool edje_object_part_swallow (Evas_Object *obj, const char *part, Evas_Object *obj_swallow);
+ # EAPI void edje_object_part_unswallow (Evas_Object *obj, Evas_Object *obj_swallow);
+ # EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part);
+ # EAPI const char *edje_object_part_state_get (const Evas_Object *obj, const char *part, double *val_ret);
+ # EAPI Edje_Drag_Dir edje_object_part_drag_dir_get (const Evas_Object *obj, const char *part);
+ # EAPI Eina_Bool edje_object_part_drag_value_set (Evas_Object *obj, const char *part, double dx, double dy);
+ # EAPI Eina_Bool edje_object_part_drag_value_get (const Evas_Object *obj, const char *part, double *dx, double *dy);
+ # EAPI Eina_Bool edje_object_part_drag_size_set (Evas_Object *obj, const char *part, double dw, double dh);
+ # EAPI Eina_Bool edje_object_part_drag_size_get (const Evas_Object *obj, const char *part, double *dw, double *dh);
+ # EAPI Eina_Bool edje_object_part_drag_step_set (Evas_Object *obj, const char *part, double dx, double dy);
+ # EAPI Eina_Bool edje_object_part_drag_step_get (const Evas_Object *obj, const char *part, double *dx, double *dy);
+ # EAPI Eina_Bool edje_object_part_drag_page_set (Evas_Object *obj, const char *part, double dx, double dy);
+ # EAPI Eina_Bool edje_object_part_drag_page_get (const Evas_Object *obj, const char *part, double *dx, double *dy);
+ # EAPI Eina_Bool edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy);
+ # EAPI Eina_Bool edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy);
+ # EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part);
+ # EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param);
+ # EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param);
+ # EAPI Evas_Object *edje_object_part_external_content_get (const Evas_Object *obj, const char *part, const char *content);
+ # EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param);
+ # EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child);
+ # EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child);
+ # EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference);
+ # EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos);
+ # EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child);
+ # EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos);
+ # EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear);
+ # EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row);
+ # EAPI Eina_Bool edje_object_part_table_pack (Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan);
+ # EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj);
+ # EAPI Eina_Bool edje_object_part_table_col_row_size_get (const Evas_Object *obj, const char *part, int *cols, int *rows);
+ # EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear);
+ # EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg);
+ # EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data);
+ # EAPI void edje_object_message_signal_process (Evas_Object *obj);
+ # EAPI void edje_message_signal_process (void);
+ # EAPI Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info);
+ # EAPI Eina_Bool edje_external_type_unregister (const char *type_name);
+ # EAPI void edje_external_type_array_register (const Edje_External_Type_Info *array);
+ # EAPI void edje_external_type_array_unregister (const Edje_External_Type_Info *array);
+ # EAPI unsigned int edje_external_type_abi_version_get (void);
+ # EAPI Eina_Iterator *edje_external_iterator_get (void);
+ # EAPI Edje_External_Param *edje_external_param_find (const Eina_List *params, const char *key);
+ # EAPI Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret);
+ # EAPI Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret);
+ # EAPI Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret);
+ # EAPI Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret);
+ # EAPI Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret);
+ # EAPI const Edje_External_Param_Info *edje_external_param_info_get (const char *type_name);
+ # EAPI const Edje_External_Type *edje_external_type_get (const char *type_name);
+ # EAPI Eina_Bool edje_module_load (const char *module);
+ # EAPI const Eina_List *edje_available_modules_get (void);
+ # EAPI Edje_Perspective *edje_perspective_new (Evas *e);
+ # EAPI void edje_perspective_free (Edje_Perspective *ps);
+ # EAPI void edje_perspective_set (Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc);
+ # EAPI void edje_perspective_global_set (Edje_Perspective *ps, Eina_Bool global);
+ # EAPI Eina_Bool edje_perspective_global_get (const Edje_Perspective *ps);
+ # EAPI const Edje_Perspective *edje_evas_global_perspective_get(const Evas *e);
+ # EAPI void edje_object_perspective_set (Evas_Object *obj, Edje_Perspective *ps);
+ # EAPI const Edje_Perspective *edje_object_perspective_get (const Evas_Object *obj);
+ end
end
+
+__END__
+
+data {
+ item: "key1" "value1";
+ item: "key2" "value2";
+}
+collections {
+ group {
+ name: "my_group";
+ parts {
+ part {
+ name: "background";
+ type: RECT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ rel1 { relative: 0.0 0.0; offset: 0 0; }
+ rel2 { relative: 1.0 1.0; offset: -1 -1; }
+ }
+ }
+ part {
+ name: "text";
+ type: TEXT;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 255 0 0 255;
+ rel1 { relative: 0.1 0.2; offset: 5 10; }
+ rel2 { relative: 0.9 0.8; offset: -6 -11; }
+ text {
+ font: "Sans";
+ size: 10;
+ text: "hello world";
+ }
+ }
+ description {
+ state: "over" 0.0;
+ inherit: "default" 0.0;
+ color: 0 255 0 255;
+ }
+ }
+ programs {
+ program {
+ signal: "mouse,in";
+ source: "text";
+ action: STATE_SET "over" 0.0;
+ target: "text";
+ transition: LINEAR 0.1;
+ }
+ program {
+ signal: "mouse,out";
+ source: "text";
+ action: STATE_SET "default" 0.0;
+ target: "text";
+ transition: LINEAR 0.1;
+ }
+ }
+ }
+ }
+}
+