summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/efl/elementary.rb692
-rw-r--r--spec/elm_spec.rb364
-rw-r--r--test/test_elementary.rb271
-rw-r--r--test/test_elm_win.rb50
-rw-r--r--test/tests/test_actionslider.rb132
-rw-r--r--test/tests/test_bg.rb151
-rw-r--r--test/tests/test_box.rb147
-rw-r--r--test/tests/test_buttons.rb114
8 files changed, 0 insertions, 1921 deletions
diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb
deleted file mode 100644
index 8970b28..0000000
--- a/lib/efl/elementary.rb
+++ /dev/null
@@ -1,692 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-require 'efl/evas'
-require 'efl/native/elementary'
-#
-module Efl
- #
- module Native
- #
- class ElmGenlistItemClassStruct < FFI::Struct
- layout :item_style, :pointer,
- :label_get, :pointer,
- :icon_get, :pointer,
- :state_get, :pointer,
- :del, :pointer,
- :moved, :pointer,
- :mode_item_style, :pointer
- end
- #
- end
- #
- module Elm
- #
- def self.version
- Native::VersionStruct.new(Native.elm_version)
- end
- #
- module Helper
- def self.included kls
- def kls.constructor meth
- self.class_eval <<-EOF
- def initialize ptr, &block
- if ptr.is_a? FFI::Pointer
- super ptr, &block
- else
- super Native.method(:#{meth}), ptr, &block
- end
- end
- EOF
- end
- end
- end
- #
- class << self
- def init *args
- a = args.select { |e| e.is_a? String }
- a << __FILE__ if a.length==0
- ptr = FFI::MemoryPointer.new :pointer, a.length
- a.each_with_index do |s,i|
- ptr[i].write_pointer FFI::MemoryPointer.from_string(s)
- end
- Native.elm_init a.length, ptr
- end
- end
- #
- class ElmObject < Efl::Evas::REvasObject
- #
- search_prefixes 'elm_object_'
- #
- def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL
- Native.evas_object_smart_callback_add @ptr, event_str, cb, data
- end
- #
- def text_set label
- Native.elm_object_part_text_set @ptr, nil, label
- end
- alias :text= :text_set
- #
- def text_get
- Native.elm_object_part_text_get @ptr, nil
- end
- alias :text :text_get
- #
- def content_set content
- Native.elm_object_part_content_set @ptr, nil, content
- end
- alias :content= :content_set
- #
- def content_get
- Native.elm_object_part_content_get @ptr, nil
- end
- alias :content :content_get
- #
- def content_unset
- Native.elm_object_part_content_unset @ptr, nil
- end
- #
- def parent_widget_get
- ElmObject.new Native.elm_object_parent_widget_get @ptr
- end
- alias :parent_widget :parent_widget_get
- end
- #
- ####################################################################################
- #
- class ElmActionSlider < ElmObject
- #
- @as_pos = Native.enum_type :elm_actionslider_pos
- class << self
- attr_reader :as_pos
- end
- #
- include Helper
- constructor :elm_actionslider_add
- search_prefixes 'elm_actionslider_'
- #
- def texts_set l=nil, c=nil, r=nil
- l,c,r = *l if l.is_a? Array
- Native.elm_object_part_text_set @ptr, "left", l
- Native.elm_object_part_text_set @ptr, "center", c
- Native.elm_object_part_text_set @ptr, "right", r
- end
- alias :texts= :texts_set
- def indicator_set str
- p = self.class.as_pos
- v = (
- case str
- when 'l'
- p[:elm_actionslider_left]
- when 'c'
- p[:elm_actionslider_center]
- when 'r'
- p[:elm_actionslider_right]
- else
- p[:elm_actionslider_none]
- end
- )
- Native.elm_actionslider_indicator_pos_set @ptr, v
- end
- alias :indicator= :indicator_set
- def enabled_set str
- p = self.class.as_pos
- v = p[:elm_actionslider_none]
- v |= p[:elm_actionslider_left] if str=~/l/
- v |= p[:elm_actionslider_center] if str=~/c/
- v |= p[:elm_actionslider_right] if str=~/r/
- v |= p[:elm_actionslider_all] if str=~/a/
- Native.elm_actionslider_enabled_pos_set @ptr, v
- end
- alias :enabled= :enabled_set
- def magnet_set str
- p = self.class.as_pos
- v = p[:elm_actionslider_none]
- v |= p[:elm_actionslider_left] if str=~/l/
- v |= p[:elm_actionslider_center] if str=~/c/
- v |= p[:elm_actionslider_right] if str=~/r/
- v |= p[:elm_actionslider_all] if str=~/a/
- Native.elm_actionslider_magnet_pos_set @ptr, v
- end
- alias :magnet= :magnet_set
- #
- def setup t=[], i='l', m='a', e='a'
- texts_set *t
- indicator_set i
- magnet_set m
- enabled_set e
- end
- end
- #
- class ElmAnchorBlock < ElmObject
- #
- include Helper
- constructor :elm_anchorblock_add
- search_prefixes 'elm_anchorblock_'
- end
- #
- class ElmAnchorView < ElmObject
- #
- include Helper
- constructor :elm_anchorview_add
- search_prefixes 'elm_anchorview_'
- end
- #
- class ElmBg < ElmObject
- #
- include Helper
- constructor :elm_bg_add
- search_prefixes 'elm_bg_'
- #
- def file_get
- f = FFI::MemoryPointer.new :pointer
- g = FFI::MemoryPointer.new :pointer
- Native.elm_bg_file_get @ptr, f, g
- [ f.read_pointer.read_string, g.read_pointer.read_string ]
- end
- alias :file :file_get
- def color_get
- r = FFI::MemoryPointer.new :int
- g = FFI::MemoryPointer.new :int
- b = FFI::MemoryPointer.new :int
- Native.elm_bg_color_get @ptr, r, g, b
- [ r.read_int, g.read_int, b.read_int ]
- end
- alias :color :color_get
- end
- #
- class ElmBox < ElmObject
- #
- include Helper
- constructor :elm_box_add
- search_prefixes 'elm_box_'
- #
- def padding_get
- x = FFI::MemoryPointer.new :int
- y = FFI::MemoryPointer.new :int
- Native::elm_box_padding_get @ptr, x, y
- [ x.read_int, y.read_int ]
- end
- alias :padding :padding_get
- #
- def align_get
- x = FFI::MemoryPointer.new :float
- y = FFI::MemoryPointer.new :float
- Native::elm_box_align_get @ptr, x, y
- [ x.read_float, y.read_float ]
- end
- alias :align :padding_get
- #
- def children_get
- Efl::EinaList::REinaList.new Native.elm_box_children_get @ptr
- end
- alias :children :children_get
- end
- #
- class ElmBubble < ElmObject
- #
- include Helper
- constructor :elm_bubble_add
- search_prefixes 'elm_bubble_'
- end
- #
- class ElmButton < ElmObject
- #
- include Helper
- constructor :elm_button_add
- search_prefixes 'elm_button_'
- #
- end
- #
- class ElmCalendar < ElmObject
- #
- include Helper
- constructor :elm_calendar_add
- search_prefixes 'elm_calendar_'
- #
- end
- #
- class ElmCheck < ElmObject
- #
- include Helper
- constructor :elm_check_add
- search_prefixes 'elm_check_'
- #
- end
- #
- class ElmClock < ElmObject
- #
- include Helper
- constructor :elm_clock_add
- search_prefixes 'elm_clock_'
- end
- #
- class ElmColorSelector < ElmObject
- #
- include Helper
- constructor :elm_colorselector_add
- search_prefixes 'elm_colorselector_'
- #
- end
- #
- class ElmDiskSelector < ElmObject
- #
- include Helper
- constructor :elm_diskselector_add
- search_prefixes 'elm_diskselector_'
- #
- def item_selected_set it, b
- Native::elm_diskselector_item_selected_set it, b
- end
- alias :item_selected= :item_selected_set
- end
- #
- class ElmDiskSelectorItem < ElmObject
- #
- search_prefixes 'elm_diskselector_item_'
- #
- def data_get
- Native::elm_diskselector_item_data_get @ptr
- end
- alias :data :data_get
- end
- #
- class ElmEntry < ElmObject
- #
- include Helper
- constructor :elm_entry_add
- search_prefixes 'elm_entry_'
- #
- end
- #
- class ElmFileSelector < ElmObject
- #
- include Helper
- constructor :elm_fileselector_add
- search_prefixes 'elm_fileselector_'
- end
- #
- class ElmFileSelectorButton < ElmObject
- #
- include Helper
- constructor :elm_fileselector_button_add
- search_prefixes 'elm_fileselector_button_'
- end
- #
- class ElmFileSelectorENtry < ElmObject
- #
- include Helper
- constructor :elm_fileselector_entry_add
- search_prefixes 'elm_fileselector_entry_'
- end
- #
- class ElmFlip < ElmObject
- #
- include Helper
- constructor :elm_flip_add
- search_prefixes 'elm_flip_'
- end
- #
- class ElmFlipSelector < ElmObject
- #
- include Helper
- constructor :elm_flipselector_add
- search_prefixes 'elm_flipselector_'
- #
- def item_append label, cb, data
- ElmFlipSelectorItem.new Native::elm_flipselector_item_append @ptr, label, cb, data
- end
- #
- def selected_item_get
- ElmFlipSelectorItem.new Native::elm_flipselector_selected_item_get @ptr
- end
- alias :selected_item :selected_item_get
- end
- #
- class ElmFlipSelectorItem < ElmObject
- #
- search_prefixes 'elm_flipselector_item_'
- #
- end
- #
- class ElmFrame < ElmObject
- #
- include Helper
- constructor :elm_frame_add
- search_prefixes 'elm_frame_'
- end
- #
- class ElmGenGrid < ElmObject
- #
- include Helper
- constructor :elm_gengrid_add
- search_prefixes 'elm_gengrid_'
- end
- #
- class ElmGenList < ElmObject
- #
- include Helper
- constructor :elm_genlist_add
- search_prefixes 'elm_genlist_'
- #
- end
- #
- class ElmGestureLayer < ElmObject
- #
- include Helper
- constructor :elm_gesture_layer_add
- search_prefixes 'elm_gesture_layer_'
- end
- #
- class ElmGlView < ElmObject
- #
- include Helper
- constructor :elm_glview_add
- search_prefixes 'elm_glview_'
- #
- end
- #
- class ElmGrid < ElmObject
- #
- include Helper
- constructor :elm_grid_add
- search_prefixes 'elm_grid_'
- #
- end
- #
- class ElmHover < ElmObject
- #
- include Helper
- constructor :elm_hover_add
- search_prefixes 'elm_hover_'
- #
- end
- #
- class ElmHoverSel < ElmObject
- #
- include Helper
- constructor :elm_hoversel_add
- search_prefixes 'elm_hoversel_'
- #
- def item_add label, icon_file=nil, icon_type=:elm_icon_none, cb=nil, data=nil
- ElmHoverselItem.new Native::elm_hoversel_item_add @ptr, label, icon_file, icon_type, cb, data
- end
- end
- #
- class ElmHoverSelItem < ElmObject
- #
- search_prefixes 'elm_hoversel_item_'
- #
- end
- #
- class ElmIcon < ElmObject
- #
- include Helper
- constructor :elm_icon_add
- search_prefixes 'elm_icon_'
- #
- def scale_set args
- Native.elm_icon_scale_set @ptr, *args
- end
- alias :scale= :scale_set
- end
- #
- class ElmImage < ElmObject
- #
- include Helper
- constructor :elm_image_add
- search_prefixes 'elm_image_'
- #
- end
- #
- class ElmIndex < ElmObject
- #
- include Helper
- constructor :elm_index_add
- search_prefixes 'elm_index_'
- #
- end
- #
- class ElmInWin < ElmObject
- #
- search_prefixes 'elm_win_inwin_', 'elm_win_'
- #
- def initialize parent, &block
- super Native.method(:elm_win_inwin_add), parent, &block
- end
- #
- end
- #
- class ElmLabel < ElmObject
- #
- include Helper
- constructor :elm_label_add
- search_prefixes 'elm_label_'
- #
- end
- #
- class ElmLayout < ElmObject
- #
- include Helper
- constructor :elm_layout_add
- search_prefixes 'elm_layout_'
- #
- def edje_get &block
- Efl::Edje::REdje.new Native.method(:elm_layout_edje_get), @ptr, &block
- end
- alias :edje :edje_get
- end
- #
- class ElmList < ElmObject
- #
- include Helper
- constructor :elm_list_add
- search_prefixes 'elm_list_'
- #
- def item_append label, left_icon=nil, right_icon=nil, cb=nil, data=nil
- ElmListItem.new Native::elm_list_item_append @ptr, label, left_icon, right_icon, cb, data
- end
- end
- #
- class ElmListItem < ElmObject
- #
- search_prefixes 'elm_list_item_'
- #
- def data_get
- Native::elm_list_item_data_get @ptr
- end
- alias :data :data_get
- end
- #
- class ElmMenu < ElmObject
- #
- include Helper
- constructor :elm_menu_add
- search_prefixes 'elm_menu_'
- #
- end
- #
- class ElmMenuItem < ElmObject
- #
- include Helper
- constructor :elm_menu_item_add
- search_prefixes 'elm_menu_item_'
- #
- end
- #
- class ElmMenuItemSeparator < ElmObject
- #
- include Helper
- constructor :elm_menu_item_separator_add
- search_prefixes 'elm_menu_item_separator_'
- #
- end
- #
- class ElmNaviFrame < ElmObject
- #
- include Helper
- constructor :elm_naviframe_add
- search_prefixes 'elm_naviframe_'
- #
- end
- #
- class ElmNotify < ElmObject
- #
- include Helper
- constructor :elm_notify_add
- search_prefixes 'elm_notify_'
- #
- end
- #
- class ElmPager < ElmObject
- #
- include Helper
- constructor :elm_pager_add
- search_prefixes 'elm_pager_'
- #
- end
- #
- class ElmPanel < ElmObject
- #
- include Helper
- constructor :elm_panel_add
- search_prefixes 'elm_panel_'
- #
- end
- #
- class ElmPanes < ElmObject
- #
- include Helper
- constructor :elm_panes_add
- search_prefixes 'elm_panes_'
- #
- end
- #
- class ElmPlayer < ElmObject
- #
- include Helper
- constructor :elm_player_add
- search_prefixes 'elm_player_'
- #
- end
- #
- class ElmPhoto < ElmObject
- #
- include Helper
- constructor :elm_photo_add
- search_prefixes 'elm_photo_'
- end
- #
- class ElmPhotoCam < ElmObject
- #
- include Helper
- constructor :elm_photocam_add
- search_prefixes 'elm_photocam_'
- end
- #
- class ElmProgressBar < ElmObject
- #
- include Helper
- constructor :elm_progressbar_add
- search_prefixes 'elm_progressbar_'
- end
- #
- class ElmRadio < ElmObject
- #
- include Helper
- constructor :elm_radio_add
- search_prefixes 'elm_radio_'
- #
- end
- #
- class ElmScroller < ElmObject
- #
- include Helper
- constructor :elm_scroller_add
- search_prefixes 'elm_scroller_'
- #
- end
- #
- class ElmSeparator < ElmObject
- #
- include Helper
- constructor :elm_separator_add
- search_prefixes 'elm_separator_'
- #
- end
- #
- class ElmSlider < ElmObject
- #
- include Helper
- constructor :elm_slider_add
- search_prefixes 'elm_slider_'
- #
- end
- #
- class ElmSlideshow < ElmObject
- #
- include Helper
- constructor :elm_slideshow_add
- search_prefixes 'elm_slideshow_'
- #
- end
- #
- class ElmSpinner < ElmObject
- #
- include Helper
- constructor :elm_spinner_add
- search_prefixes 'elm_spinner_'
- #
- end
- #
- class ElmTable < ElmObject
- #
- include Helper
- constructor :elm_table_add
- search_prefixes 'elm_table_'
- end
- #
- class ElmThumb < ElmObject
- #
- include Helper
- constructor :elm_thumb_add
- search_prefixes 'elm_thumb_'
- end
- #
- class ElmToolbar < ElmObject
- #
- include Helper
- constructor :elm_toolbar_add
- search_prefixes 'elm_toolbar_'
- end
- #
- class ElmVideo < ElmObject
- #
- include Helper
- constructor :elm_video_add
- search_prefixes 'elm_video_'
- end
- #
- class ElmWin < ElmObject
- #
- search_prefixes 'elm_win_'
- #
- def initialize parent, title, type=:elm_win_basic, &block
- super Native.method(:elm_win_add), parent, title, type, &block
- end
- def inwin_add
- ElmInWin.new @ptr
- end
- def screen_position_get
- x = FFI::MemoryPointer.new :int
- y = FFI::MemoryPointer.new :int
- Native.elm_win_screen_position_get @ptr, x, y
- [ x.read_int, y.read_int ]
- end
- alias :screen_position :screen_position_get
- end
- #
- end
-end
-#
-# EOF
diff --git a/spec/elm_spec.rb b/spec/elm_spec.rb
deleted file mode 100644
index 0ae7d93..0000000
--- a/spec/elm_spec.rb
+++ /dev/null
@@ -1,364 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-require 'efl/elementary'
-require './spec/helper'
-#
-describe "Efl::Elm #{Efl::Elm.version.full}" do
- #
- before(:all) do
- Elm = Efl::Elm
- @init = Elm.init
- end
- after(:all) do
- Elm.shutdown
- end
- it "should init" do
- Elm.init.should == @init+1
- Elm.init.should == @init+2
- Elm.init.should == @init+3
- end
- #
- it "should shutdown" do
- Elm.shutdown.should == @init+2
- Elm.shutdown.should == @init+1
- Elm.shutdown.should == @init
- end
- #
- describe 'Efl::Elm::ElmWin' do
- before(:each) {
- realize_win
- }
- after(:each) {
- @bg.free
- @win.free
- }
- #
- it "resize_object add/del" do
- r = @win.evas.object_rectangle_add
- @win.resize_object_add r
- @win.resize_object_del r
- end
- #
- it "title set/get" do
- @win.title_set "title1"
- @win.title_get.should == "title1"
- @win.title= "title2"
- @win.title.should == "title2"
- end
- #
- it "autodel set/get" do
- bool_check @win, 'autodel'
- end
- #
- it "activate, lower, raise" do
- @win.activate
- @win.lower
- @win.raise
- end
- #
- it "borderless set/get" do
- bool_check @win, 'borderless'
- @win.borderless.should be_false
- end
- #
- it "shaped set/get" do
- bool_check @win, 'shaped'
- end
- #
- it "alpha set/get" do
- bool_check @win, 'alpha'
- end
- #
- it "transparent set/get" do
- bool_check @win, 'transparent'
- end
- #
- it "override set/get" do
- bool_check @win, 'override'
- end
- #
- it "fullscreen set/get" do
- bool_check @win, 'fullscreen', 4
- end
- # FIXME depends on issue: ecore-2
- it "maximized set/get" do
- bool_check @win, 'maximized', 3
- end
- #
- it "iconified set/get" do
- bool_check @win, 'iconified'
- end
- #
- it "layet set/get" do
- @win.layer_set 2
- @win.layer_get.should == 2
- @win.layer = 3
- @win.layer.should == 3
- end
- #
- it "rotation set/get" do
- @win.rotation_set 90
- @win.rotation_get.should == 90
- @win.rotation = 180
- @win.rotation.should == 180
- @win.rotation_with_resize_set 90
- @win.rotation_get.should == 90
- @win.rotation_with_resize= 180
- @win.rotation.should == 180
- end
- #
- it "sticky set/get" do
- bool_check @win, 'sticky', 3
- end
- #
- it "conformant set/get" do
- bool_check @win, 'conformant'
- end
- #
- it "quickpanel set/get" do
- bool_check @win, 'quickpanel'
- end
- #
- it "quickpanel_priority_major set/get" do
- @win.quickpanel_priority_major_set 6
- @win.quickpanel_priority_major_get.should == 6
- @win.quickpanel_priority_major= 1
- @win.quickpanel_priority_major.should == 1
- end
- #
- it "quickpanel_priority_minor set/get" do
- @win.quickpanel_priority_minor_set 6
- @win.quickpanel_priority_minor_get.should == 6
- @win.quickpanel_priority_minor= 1
- @win.quickpanel_priority_minor.should == 1
- end
- #
- it "quickpanel_zone set/get" do
- @win.quickpanel_zone_set 6
- @win.quickpanel_zone_get.should == 6
- @win.quickpanel_zone= 1
- @win.quickpanel_zone.should == 1
- end
- #
- it "focus_highlight_enabled" do
- bool_check @win, 'focus_highlight_enabled'
- end
- #
- it "focus_highlight_style set/get" do
- char_check @win, 'focus_highlight_style'
- end
- #
- it "keyboard_mode set/get" do
- @win.keyboard_mode_set :elm_win_keyboard_off
- @win.keyboard_mode_get.should == :elm_win_keyboard_off
- @win.keyboard_mode= :elm_win_keyboard_on
- @win.keyboard_mode.should == :elm_win_keyboard_on
- @win.keyboard_mode?.should == :elm_win_keyboard_on
- end
- #
- it "keyboard_winset/get" do
- bool_check @win, 'keyboard_win'
- end
- #
- it "screen_position_get" do
- @win.screen_position_get.should == [0,0]
- @win.screen_position.should == [0,0]
- end
- #
- it "prop_focus_skip_set" do
- @win.prop_focus_skip_set true
- @win.prop_focus_skip= false
- end
- #
- it "inlined_image_object_get" do
- o1 = @win.inlined_image_object_get
- o2 = @win.inlined_image_object
- o1.should === o2
- end
- # TODO EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params);;
- # TODO EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj);
- #
- describe 'Efl::Elm::ElmInWin' do
- it "activate, content set/get/unset" do
- @iwin = @win.inwin_add
- o1 = @win.evas.object_rectangle_add
- o2 = @win.evas.object_rectangle_add
- @iwin.activate
- @iwin.content_set o1
- @iwin.content.should == o1.to_ptr
- @iwin.content_get.should === o1.to_ptr
- @iwin.content= o2
- @iwin.content.should === o2.to_ptr
- @iwin.content_get.should === o2.to_ptr
- @iwin.content_unset
- @iwin.content.should == FFI::Pointer::NULL
- @iwin.content_get.should == FFI::Pointer::NULL
- o1.free
- o2.free
- end
- end
- end
- #
- describe 'Efl::Elm::ElmBg' do
- before(:all) {
- realize_win
- }
- after(:all) {
- @bg.free
- @win.free
- }
- #
- it "file set/get" do
- @bg.file_set "file", "group1"
- @bg.file_get.should == ["file","group1"]
- @bg.file= "file", "group1"
- @bg.file.should == ["file","group1"]
- end
- #
- it "option set/get" do
- @bg.option_set :elm_bg_option_scale
- @bg.option_get.should == :elm_bg_option_scale
- @bg.option=:elm_bg_option_center
- @bg.option.should == :elm_bg_option_center
- end
- #
- it "color set/get" do
- @bg.color_set 12,24,36
- @bg.color_get.should == [12,24,36]
- @bg.color= 2,4,8
- @bg.color.should == [2,4,8]
- @bg.class.superclass.instance_method(:color).bind(@bg).call.should == [200,255,100,150]
- end
- #
- end
- #
- describe 'Efl::Elm::ElmLabel' do
- #
- before(:all) {
- realize_win
- @lb = Elm::ElmLabel.new @win
- }
- after(:all) {
- @lb.free
- @bg.free
- @win.free
- }
- #
- it "line_wrap set/get" do
- @lb.line_wrap_set :elm_wrap_char
- @lb.line_wrap_get.should == :elm_wrap_char
- @lb.line_wrap= :elm_wrap_none
- @lb.line_wrap.should == :elm_wrap_none
- end
- #
- it "wrap_width set/get" do
- @lb.wrap_width_set 69
- @lb.wrap_width_get.should == 69
- @lb.wrap_width= 666
- @lb.wrap_width.should == 666
- end
- #
- it "wrap_height set/get" do
- @lb.wrap_height_set 69
- @lb.wrap_height_get.should == 69
- @lb.wrap_height= 666
- @lb.wrap_height.should == 666
- end
- #
- it "ellipsis_set" do
- @lb.ellipsis_set true
- @lb.ellipsis= false
- end
- #
- it "slide_set" do
- bool_check @lb, 'slide'
- end
- #
- it "slide_duration_set" do
- @lb.slide_duration_set 3.1415926
- @lb.slide_duration_get.should == 3.1415926
- @lb.slide_duration= 3.1415926
- @lb.slide_duration.should == 3.1415926
- end
- end
- #
- describe 'Efl::Elm::ElmPager' do
- #
- before(:all) {
- realize_win
- @p = Elm::ElmPager.new @win
- @os = []
- 0.upto(3) do
- @os << @win.evas.object_rectangle_add
- end
- }
- after(:all) {
- @p.free
- @bg.free
- @win.free
- }
- #
- it "content push pop promote bottom_get top_get" do
- @os.each do |o|
- @p.content_push o
- end
- @p.content_top_get.should == @os[-1].to_ptr
- @p.content_bottom_get.should == @os[0].to_ptr
- @p.content_pop
- @p.content_top_get.should == @os[-2].to_ptr
- @p.content_bottom_get.should == @os[0].to_ptr
- @p.content_promote @os[0]
- @p.content_top_get.should == @os[0].to_ptr
- @p.content_bottom_get.should == @os[1].to_ptr
- end
- end
- #
- describe 'Efl::Elm::ElmPanel' do
- #
- before(:all) {
- realize_win
- @p = Elm::ElmPanel.new @win
- @os = []
- }
- after(:all) {
- @p.free
- @bg.free
- @win.free
- }
- #
- it "orient set/get" do
- @p.orient_set :elm_panel_orient_bottom
- @p.orient_get.should == :elm_panel_orient_bottom
- @p.orient= :elm_panel_orient_top
- @p.orient.should == :elm_panel_orient_top
- end
- #
- it "content set/get/unset" do
- o = @win.evas.object_rectangle_add
- @p.content_set o
- @p.content_get.should == o.to_ptr
- @p.content_unset.should == o.to_ptr
- o.free
- o = @win.evas.object_rectangle_add
- @p.content= o
- @p.content.should == o.to_ptr
- @p.content_unset.should == o.to_ptr
- o.free
- end
- #
- it "hidden set/get toggle" do
- @p.hidden_set true
- @p.hidden_get.should be_true
- @p.hidden=false
- @p.hidden.should be_false
- @p.toggle
- @p.hidden_get.should be_true
- @p.hidden.should be_true
- @p.toggle
- @p.hidden_get.should be_false
- @p.hidden.should be_false
- end
- end
-end
-
diff --git a/test/test_elementary.rb b/test/test_elementary.rb
deleted file mode 100644
index 4e2e2ef..0000000
--- a/test/test_elementary.rb
+++ /dev/null
@@ -1,271 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-require 'efl/elementary'
-require 'efl/edje'
-require 'efl'
-#
-PREFIX=`pkg-config --variable=prefix ecore`.strip
-if PREFIX.empty?
- puts "unable to determine Efl::PREFIX using pkg-config, images will not be available"
-end
-PACKAGE_DATA_DIR = File.join PREFIX, 'share', 'elementary'
-
-Dir.glob( File.join File.dirname(__FILE__), 'tests', '*.rb').each do |f|
- load f
-end
-#
-include Efl;
-#
-TESTS = [
- [ 'Bg Plain', :test_bg_plain ],
- [ 'Bg Image', :test_bg_image ],
- [ 'Bg Options', :test_bg_options ],
- [ 'Icon Transparent', :test_icon ],
- [ 'Icon Animation', :test_icon_animated ],
- [ 'Box Vert', :test_box_vert ],
- [ 'Box Vert 2', :test_box_vert2 ],
- [ 'Box Horiz', :test_box_horiz ],
- [ 'Box Transition', :test_box_transition ],
- [ 'Buttons', :test_button ],
- [ 'Transit', :test_transit ],
- [ 'Transit 2', :test_transit2 ],
- [ 'Transit 3', :test_transit3 ],
- [ 'Transit 4', :test_transit4 ],
- [ 'Transit 5', :test_transit5 ],
- [ 'Transit 6', :test_transit6 ],
- [ 'Transit 7', :test_transit7 ],
- [ 'Transit 8', :test_transit8 ],
- [ 'Transit 9', :test_transit9 ],
- [ 'File Selector Button', :test_fileselector_button ],
- [ 'File Selector Entry', :test_fileselector_entry ],
- [ 'Toggles', :test_toggle ],
- [ 'Table', :test_table ],
- [ 'Table Homogeneous', :test_table2 ],
- [ 'Table 3', :test_table3 ],
- [ 'Table 4', :test_table4 ],
- [ 'Table 5', :test_table5 ],
- [ 'Table 6', :test_table6 ],
- [ 'Clock', :test_clock ],
- [ 'Clock 2', :test_clock2 ],
- [ 'Layout', :test_layout ],
- [ 'Hover', :test_hover ],
- [ 'Hover 2', :test_hover2 ],
- [ 'Entry', :test_entry ],
- [ 'Entry Scrolled', :test_entry_scrolled ],
- [ 'Entry 3', :test_entry3 ],
- [ 'Entry 4', :test_entry4 ],
- [ 'Entry 5', :test_entry5 ],
- [ 'Entry Notepad', :test_entry_notepad ],
- [ 'Anchorview', :test_anchorview ],
- [ 'Anchorblock', :test_anchorblock ],
- [ 'Toolbar', :test_toolbar ],
- [ 'Toolbar 2', :test_toolbar2 ],
- [ 'Toolbar 3', :test_toolbar3 ],
- [ 'Toolbar 4', :test_toolbar4 ],
- [ 'Toolbar 5', :test_toolbar5 ],
- [ 'Toolbar 6', :test_toolbar6 ],
- [ 'Hoversel', :test_hoversel ],
- [ 'List', :test_list ],
- [ 'List - Horizontal', :test_list_horizontal ],
- [ 'List 2', :test_list2 ],
- [ 'List 3', :test_list3 ],
- [ 'List 4', :test_list4 ],
- [ 'List 5', :test_list5 ],
- [ 'Inwin', :test_inwin ],
- [ 'Inwin 2', :test_inwin2 ],
- [ 'Scaling', :test_scaling ],
- [ 'Scaling 2', :test_scaling2 ],
- [ 'Slider', :test_slider ],
- [ 'Actionslider', :test_actionslider ],
- [ 'Genlist', :test_genlist ],
- [ 'Genlist 2', :test_genlist2 ],
- [ 'Genlist 3', :test_genlist3 ],
- [ 'Genlist 4', :test_genlist4 ],
- [ 'Genlist 5', :test_genlist5 ],
- [ 'Genlist 7', :test_genlist7 ],
- [ 'Genlist Tree', :test_genlist6 ],
- [ 'Genlist Group', :test_genlist8 ],
- [ 'Genlist Group Tree', :test_genlist9 ],
- [ 'Genlist Mode', :test_genlist10 ],
- [ 'Genlist Reorder Mode', :test_genlist11 ],
- [ 'Genlist Eio', :test_eio ],
- [ 'GenGrid', :test_gengrid ],
- [ 'GenGrid 2', :test_gengrid2 ],
- [ 'Checks', :test_check ],
- [ 'Radios', :test_radio ],
- [ 'Pager', :test_pager ],
- [ 'Pager Slide', :test_pager_slide ],
- [ 'Window States', :test_win_state ],
- [ 'Window States 2', :test_win_state2 ],
- [ 'Progressbar', :test_progressbar ],
- [ 'File Selector', :test_fileselector ],
- [ 'Separator', :test_separator ],
- [ 'Scroller', :test_scroller ],
- [ 'Scroller 2', :test_scroller2 ],
- [ 'Spinner', :test_spinner ],
- [ 'Index', :test_index ],
- [ 'Index 2', :test_index2 ],
- [ 'Photocam', :test_photocam ],
- [ 'Photo', :test_photo ],
- [ 'Thumb', :test_thumb ],
- [ 'Icon Desktops', :test_icon_desktops ],
- [ 'Notify', :test_notify ],
- [ 'Slideshow', :test_slideshow ],
- [ 'Menu', :test_menu ],
- [ 'Panel', :test_panel ],
- [ 'Panes', :test_panes ],
- [ 'Map', :test_map ],
- [ 'Weather', :test_weather ],
- [ 'Flip', :test_flip ],
- [ 'Flip 2', :test_flip2 ],
- [ 'Flip 3', :test_flip3 ],
- [ 'Flip Interactive', :test_flip4 ],
- [ 'Flip Page', :test_flip_page ],
- [ 'Label', :test_label ],
- [ 'Conformant', :test_conformant ],
- [ 'Conformant 2', :test_conformant2 ],
- [ 'Multi Touch', :test_multi ],
- [ 'Floating Objects', :test_floating ],
- [ 'Launcher', :test_launcher ],
- [ 'Launcher 2', :test_launcher2 ],
- [ 'Launcher 3', :test_launcher3 ],
- [ 'Animation', :test_anim ],
- [ 'Calendar', :test_calendar ],
- [ 'Calendar 2', :test_calendar2 ],
- [ 'Tooltip', :test_tooltip ],
- [ 'Tooltip2', :test_tooltip2 ],
- [ 'Cursor', :test_cursor ],
- [ 'Cursor 2', :test_cursor2 ],
- [ 'Cursor 3', :test_cursor3 ],
- [ 'Focus', :test_focus ],
- [ 'Focus 2', :test_focus2 ],
- [ 'Focus 3', :test_focus3 ],
- [ 'Flip Selector', :test_flipselector ],
- [ 'Disk Selector', :test_diskselector ],
- [ 'Color Selector', :test_colorselector ],
- [ 'Ctxpopup', :test_ctxpopup ],
- [ 'Bubble', :test_bubble ],
- [ 'Segment Control', :test_segment_control ],
- [ 'Store', :test_store ],
- [ 'Window Inline', :test_win_inline ],
- [ 'Grid', :test_grid ],
- [ 'GLViewSimple', :test_glview_simple ],
- [ 'GLView', :test_glview ],
- [ '3D', :test_3d ],
- [ 'Gesture Layer', :test_gesture_layer ],
- [ 'Naviframe', :test_naviframe ],
- [ 'Factory', :test_factory ],
-]
-#
-class TestWin < Elm::ElmWin
- #
- def initialize name, title
- super FFI::MemoryPointer::NULL, name
- self.title = title
- feed
- smart_callback_add 'delete,request', method(:on_delete)
- end
- #
- def feed
- @bg = Elm::ElmBg.new self do |bg|
- bg.size_hint_weight_expand
- resize_object_add bg
- bg.show
- end
- @bx0 = Elm::ElmBox.new self do |bx|
- bx.size_hint_weight_expand
- resize_object_add bx
- bx.show
- end
- @fr = Elm::ElmFrame.new self do |fr|
- fr.text = 'Information'
- @bx0.pack_end fr
- fr.show
- end
- Elm::ElmLabel.new self do |lb|
- lb.text = 'Please select a test from the list below<br>by clicking the test button to show the<br>test window.'
- @fr.content = lb
- lb.show
- end
- Elm::ElmCheck.new self do |tg|
- tg.style = 'toggle'
- tg.text = 'UI-Mirroring:'
- tg.state = Native.elm_mirrored_get
- tg.smart_callback_add 'changed', method(:tg_changed)
- @bx0.pack_end tg
- tg.show
- end
- @li = Elm::ElmList.new self do |li|
- li.always_select_mode = true
- li.size_hint_weight_expand
- li.size_hint_align_set_fill
- @bx0.pack_end li
- end
- @idx = Elm::ElmIndex.new self do |idx|
- idx.smart_callback_add 'delay,changed', method(:index_changed)
- idx.size_hint_weight_expand
- resize_object_add idx
- idx.show
- end
- ch = nil
- TESTS.sort.each do |l,m|
- icon = nil
- if Tests.respond_to? m
- icon = Elm::ElmIcon.new self
- icon.file = "#{PACKAGE_DATA_DIR}/images/icon_00.png", nil
- icon.size_hint_min = 20,20
- end
- it = @li.item_append l, nil, icon, method(:try_test), FFI::MemoryPointer.from_string(m.to_s)
- it.del_cb_set method(:free_list_item)
- if l[0]!=ch
- ch = l[0]
- @idx.item_append ch.to_s, it
- end
- end
- @idx.item_go 0
- @li.go
- @li.show
- end
- #
- def try_test data, evas_obj, event_info
- fct = data.read_string
- begin
- Tests.send fct
- rescue NoMethodError
- puts "#{fct} not implemeneted yet"
- end
- end
- #
- def tg_changed data, evas_obj, event_info
- Native.elm_mirrored_set Native.elm_check_state_get evas_obj
- end
- #
- def index_changed data, evas_obj, event_info
- Native.elm_list_item_show event_info
- end
- #
- def free_list_item data, evas_obj, event_info
- # free FFI::MemoryPointer.from_string m.to_s
- data.free
- end
- #
- def on_delete data, evas_object, event_info
- Elm.exit
- end
-end
-#
-def elm_main
- win = TestWin.new 'test_elementary', 'Elementary Tests'
- win.evas_object_resize 320, 480
- win.show
-end
-#
-Elm.init
-#
-Native.elm_app_info_set elm_main, 'elementary', 'images/logo.png'
-#
-Elm.run
-Elm.shutdown
-#
-# EOF
diff --git a/test/test_elm_win.rb b/test/test_elm_win.rb
deleted file mode 100644
index b9abcf2..0000000
--- a/test/test_elm_win.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-require 'efl/elementary'
-#
-include Efl
-#
-class MyWin < Elm::ElmWin
- #
- def initialize name, title
- super FFI::MemoryPointer::NULL, name
- title = title
- feed
- smart_callback_add "delete,request", method(:on_delete), FFI::MemoryPointer.from_string("my data")
- end
- def feed
- @bg = Elm::ElmBg.new(self) do |bg|
-# bg.color = 200,255,100
- bg.size_hint_weight_expand
- bg.evas_object_color = 200,255,100,150
- bg.show
- end
- resize_object_add @bg
- @lb = Elm::ElmLabel.new(self) do |lb|
- lb.text = "Hello World!"
- lb.size_hint_align_fill
- lb.size_hint_weight_expand
- end
- @lb.show
- resize_object_add @lb
- end
- def on_delete data, evas_object, event_info
- puts "EXIT #{data.read_string}"
- Elm.exit
- end
-end
-#
-Elm.init
-#
-win = MyWin.new "App name", "Window Title" do |w|
- w.alpha = true
- w.move 300, 300
- w.resize 200, 100
- w.show
-end
-#
-Elm.run
-Elm.shutdown
-#
-# EOF
diff --git a/test/tests/test_actionslider.rb b/test/tests/test_actionslider.rb
deleted file mode 100644
index a04f380..0000000
--- a/test/tests/test_actionslider.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-module Tests
- #
- class TestActionSlider < Efl::Elm::ElmWin
- def initialize name, title, fct
- super nil, name
- self.title = title
- self.autodel = true
- self.send fct
- self.resize 320, 400
- self.show
- end
- def simple
- @bg = Elm::ElmBg.new self do |bg|
- bg.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- self.resize_object_add bg
- bg.show
- end
- @bx = Elm::ElmBox.new self do |bx|
- bx.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- self.resize_object_add bx
- bx.show
- end
- as_pos = Native.enum_type :elm_actionslider_pos
- # standards calls
- as = Elm::ElmActionSlider.new self do |as|
- as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
- as.part_text = "left", "Snooze"
- as.part_text = "center", nil
- as.part_text = "right", "Stop"
- as.indicator_pos = :elm_actionslider_right
- as.magnet_pos = :elm_actionslider_right
- as.enabled_pos = as_pos[:elm_actionslider_left]|as_pos[:elm_actionslider_right]
- as.smart_callback_add "selected", method(:cb_pos_selected)
- as.smart_callback_add "pos_changed", method(:cb_position_change_magnetic)
- as.show
- end
- @bx.pack_end as
- # use xxx_set helpers
- as = Elm::ElmActionSlider.new self do |as|
- as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
- as.texts_set "Snooze", nil, "Stop"
- as.indicator_set 'c'
- as.magnet_set 'c'
- as.enabled_set 'lr'
- as.smart_callback_add "selected", method(:cb_pos_selected)
- as.show
- end
- @bx.pack_end as
- # use xxx = helpers
- as = Elm::ElmActionSlider.new self do |as|
- as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
- as.style = "bar"
- as.texts = nil, "Accept", "Reject"
- as.indicator = 'l'
- as.magnet = 'cr'
- as.enabled = 'cr'
- as.smart_callback_add "selected", method(:cb_pos_selected)
- as.show
- end
- @bx.pack_end as
- # use setup
- as = Elm::ElmActionSlider.new self do |as|
- as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
- as.style = "bar"
- as.text = "Go"
- as.setup [nil, "Accept", "Reject"], 'l', 'l', 'a'
- as.smart_callback_add "selected", method(:cb_pos_selected)
- as.smart_callback_add "pos_changed", method(:cb_position_change_magnetic)
- as.show
- end
- @bx.pack_end as
- as = Elm::ElmActionSlider.new self do |as|
- as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
- as.text = "Go"
- as.setup ["Left", "Center", "right"], 'l', 'a'
- as.smart_callback_add "selected", method(:cb_pos_selected)
- as.show
- end
- @bx.pack_end as
- as = Elm::ElmActionSlider.new self do |as|
- as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
- as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
- as.text = "Go"
- as.setup ["Enable", "Magnet", "Disable"], 'c', 'c'
- as.smart_callback_add "selected", method(:cb_pos_selected)
- as.smart_callback_add "pos_changed", method(:cb_magnet_enable_disable)
- as.show
- end
- @bx.pack_end as
- end
- def cb_pos_selected data, evas_obj, event_info
- as = Elm::ElmActionSlider.new evas_obj
- puts "Selection #{event_info.null? ? 'NULL' : event_info.read_string}"
- puts " label: #{Elm::ElmActionSlider.new(evas_obj).selected_label}"
- end
- def cb_position_change_magnetic data, evas_obj, event_info
- as = Elm::ElmActionSlider.new evas_obj
- return if event_info.null?
- case event_info.read_string
- when "left"
- as.magnet_pos = :elm_actionslider_left
- when "right"
- as.magnet_pos = :elm_actionslider_right
- end
- end
- def cb_magnet_enable_disable data, evas_obj, event_info
- as = Elm::ElmActionSlider.new evas_obj
- return if event_info.null?
- case event_info.read_string
- when "left"
- as.magnet_pos = :elm_actionslider_center
- when "right"
- as.magnet_pos = :elm_actionslider_none
- end
- end
- end
- #
- def self.test_actionslider
- TestActionSlider.new 'actionslider', 'Actionslider', :simple
- end
- #
-end
-#
-# EOF
diff --git a/test/tests/test_bg.rb b/test/tests/test_bg.rb
deleted file mode 100644
index 2739bdf..0000000
--- a/test/tests/test_bg.rb
+++ /dev/null
@@ -1,151 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-module Tests
- #
- class TestBg < Efl::Elm::ElmWin
- def initialize name, title, fct
- super nil, name
- self.title = title
- self.autodel = true
- self.send fct
- @bg.size_hint_min = 160, 160
- @bg.size_hint_max = 640, 640
- self.resize 320, 230
- self.show
- end
- def plain_bg
- @bg = Elm::ElmBg.new self do |bg|
- bg.size_hint_weight_expand
- self.resize_object_add bg
- bg.show
- end
- end
- def image_bg
- @bg = Elm::ElmBg.new self do |bg|
- bg.file = "#{PACKAGE_DATA_DIR}/images/plant_01.jpg", nil
- bg.size_hint_weight_expand
- self.resize_object_add bg
- bg.show
- end
- end
- def options_bg
- plain_bg
- @bx = Elm::ElmBox.new self do |bx|
- bx.size_hint_weight_expand
- self.resize_object_add bx
- bx.show
- end
- @o_bg = Elm::ElmBg.new self do |bg|
- bg.file = "#{PACKAGE_DATA_DIR}/images/plant_01.jpg", nil
- bg.size_hint_weight_expand
- bg.size_hint_align_fill
- @bx.pack_end bg
- bg.show
- end
- @hbx = Elm::ElmBox.new self do |bx|
- bx.horizontal = true
- bx.size_hint_weight_expand_fill
- bx.size_hint_align_fill
- end
- @rdg = Elm::ElmRadio.new self do |r|
- r.state_value = :elm_bg_option_center
- r.text = "Center"
- r.size_hint_weight_expand_fill
- r.smart_callback_add "changed", method(:cb_radio_changed)
- @hbx.pack_end r
- r.show
- end
- Elm::ElmRadio.new self do |r|
- r.state_value = :elm_bg_option_scale
- r.group_add @rdg
- r.text = "Scale"
- r.size_hint_weight_expand_fill
- r.smart_callback_add "changed", method(:cb_radio_changed)
- @hbx.pack_end r
- r.show
- end
- Elm::ElmRadio.new self do |r|
- r.state_value = :elm_bg_option_stretch
- r.group_add @rdg
- r.text = "Stretch"
- r.size_hint_weight_expand_fill
- r.smart_callback_add "changed", method(:cb_radio_changed)
- @hbx.pack_end r
- r.show
- end
- Elm::ElmRadio.new self do |r|
- r.state_value = :elm_bg_option_tile
- r.group_add @rdg
- r.text = "Tile"
- r.size_hint_weight_expand_fill
- r.smart_callback_add "changed", method(:cb_radio_changed)
- @hbx.pack_end r
- r.show
- end
- @rdg.value_set :elm_bg_option_scale
- Elm::ElmCheck.new self do |ck|
- ck.text = "Show Overlay"
- ck.size_hint_weight_expand_fill
- ck.smart_callback_add "changed", method(:cb_overlay_changed)
- @hbx.pack_end ck
- ck.show
- end
- Elm::ElmSpinner.new self do |sp|
- sp.style = "vertical"
- sp.min_max = 1, 4
- sp.label_format = "%.0f"
- sp.editable = false
- sp.special_value_add 1, "White"
- sp.special_value_add 2, "Red"
- sp.special_value_add 3, "Blue"
- sp.special_value_add 4, "Green"
- sp.size_hint_weight_expand
- sp.size_hint_align_fill
- sp.smart_callback_add "changed", method(:cb_color_changed)
- @hbx.pack_end sp
- sp.show
- end
- @bx.pack_end @hbx
- @hbx.show
- end
- def cb_radio_changed data, evas_obj, event_info
- @o_bg.option = Elm::ElmRadio.new(evas_obj).value
- end
- def cb_overlay_changed data, evas_obj, event_info
- if Elm::ElmCheck.new(evas_obj).state
- over = @o_bg.parent_widget.evas.edje_object_add
- over.file = "#{PACKAGE_DATA_DIR}/objects/test.edj", "bg_overlay"
- @o_bg.content = over
- else
- @o_bg.content = FFI::Pointer::NULL
- end
- end
- def cb_color_changed data, evas_obj, event_info
- case Elm::ElmSpinner.new(evas_obj).value
- when 1.0
- @o_bg.color = 255, 255, 255
- when 2.0
- @o_bg.color = 255, 0, 0
- when 3.0
- @o_bg.color = 0, 0, 255
- when 4.0
- @o_bg.color = 0, 255, 0
- end
- end
- end
- #
- def self.test_bg_plain
- TestBg.new 'bg-plain', 'Bg Plain', :plain_bg
- end
- #
- def self.test_bg_image
- TestBg.new 'bg-image', 'Bg Image', :image_bg
- end
- def self.test_bg_options
- TestBg.new 'bg-options', 'Bg Options', :options_bg
- end
- #
-end
-#
-# EOF
diff --git a/test/tests/test_box.rb b/test/tests/test_box.rb
deleted file mode 100644
index 11665ed..0000000
--- a/test/tests/test_box.rb
+++ /dev/null
@@ -1,147 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-module Tests
- #
- class TestBox < Efl::Elm::ElmWin
- def initialize name, title, fct
- super nil, name
- self.title = title
- self.autodel = true
- @bg = Elm::ElmBg.new self do |bg|
- bg.size_hint_weight_expand
- self.resize_object_add bg
- bg.show
- end
- self.send fct
- self.show
- end
- #
- def box_vert
- @bx = Elm::ElmBox.new self do |bx|
- bx.size_hint_weight_expand
- self.resize_object_add bx
- bx.show
- end
- icons = []
- (0..2).each do
- icons << Elm::ElmIcon.new(self) do |ico|
- ico.file = "#{PACKAGE_DATA_DIR}/images/logo_small.png", nil
- ico.scale = false, false
- @bx.pack_end ico
- ico.show
- end
- end
- icons[0].size_hint_align = 0.5, 0.5
- icons[1].size_hint_align = 0.0, 0.5
- icons[2].size_hint_align = Efl::Evas::EVAS_HINT_EXPAND, 0.5
- end
- #
- def box_vert2
- @bx = Elm::ElmBox.new self do |bx|
- bx.padding = 10, 10
- self.resize_object_add bx
- bx.size_hint_weight_expand
- bx.show
- end
- (1..5).each do |n|
- bt = Efl::Elm::ElmButton.new self
- bt.text = "Button #{n}"
- bt.size_hint_align_fill
- bt.size_hint_weight = 0.0, 0.0
- bt.smart_callback_add "clicked", method(:del_cb)
- @bx.pack_end bt
- bt.show
- end
- end
- #
- def del_cb data, evas_obj, event_info
- o = Efl::Elm::ElmObject.new(evas_obj)
- @bx.unpack o
- o.move 0, 0
- o.color = 128, 64, 0, 128
- end
- #
- def box_horiz
- @bx = Elm::ElmBox.new self do |bx|
- bx.horizontal = true
- self.resize_object_add bx
- bx.size_hint_weight_expand
- bx.show
- end
- icons = []
- (0..2).each do
- icons << Elm::ElmIcon.new(self) do |ico|
- ico.file = "#{PACKAGE_DATA_DIR}/images/logo_small.png", nil
- ico.scale = false, false
- @bx.pack_end ico
- ico.show
- end
- end
- icons[0].size_hint_align = 0.5, 0.5
- icons[1].size_hint_align = 0.5, 0.0
- icons[2].size_hint_align = 0.0, Efl::Evas::EVAS_HINT_EXPAND
- end
- #
- def box_transition
- @bx = Elm::ElmBox.new self do |bx|
- self.resize_object_add bx
- bx.size_hint_weight_expand
- bx.show
- end
- (1..3).each do |n|
- bt = Efl::Elm::ElmButton.new self
- bt.text = "Button #{n}"
- bt.size_hint_weight_expand
-# bt.size_hint_align_fill
- bt.smart_callback_add "clicked", method(:del_cb)
- @bx.pack_end bt
- bt.resize 100, 100
- bt.show
- end
- @idx = 0
- @transitions = [
- Efl::Native.find_variable('evas_object_box_layout_vertical'),
- Efl::Native.find_variable('evas_object_box_layout_horizontal'),
- Efl::Native.find_variable('evas_object_box_layout_stack'),
- Efl::Native.find_variable('evas_object_box_layout_homogeneous_vertical'),
- Efl::Native.find_variable('evas_object_box_layout_homogeneous_horizontal'),
- Efl::Native.find_variable('evas_object_box_layout_flow_vertical'),
- Efl::Native.find_variable('evas_object_box_layout_flow_horizontal'),
- Efl::Native.find_variable('evas_object_box_layout_stack'),
- ]
- self.resize 300, 300
- @bx.resize 300, 300
- @bx.layout = @transitions[@idx], nil, nil
- self.show
- transition_change
- end
- #
- def transition_change data=nil
- last_layout = @transitions[@idx]
- @idx = (@idx+1) % @transitions.length
- next_layout = @transitions[@idx]
- transition = Efl::Native.elm_box_transition_new 1.0, last_layout, nil, nil, next_layout, nil, nil, method(:transition_change), nil
- transition_fct = Efl::Native.find_variable('elm_box_layout_transition')
- transition_free = Efl::Native.find_variable('elm_box_transition_free')
- @bx.layout = transition_fct, transition, transition_free
- end
- #
- end
- #
- def self.test_box_vert
- TestBox.new 'box-vert', 'Box Vert', :box_vert
- end
- def self.test_box_vert2
- TestBox.new 'box-vert', 'Box Vert', :box_vert2
- end
- def self.test_box_horiz
- TestBox.new 'box-horiz', 'Box Horiz', :box_horiz
- end
- def self.test_box_transition
- TestBox.new 'box-transition', 'Box Transition', :box_transition
- end
- #
-end
-#
-# EOF
diff --git a/test/tests/test_buttons.rb b/test/tests/test_buttons.rb
deleted file mode 100644
index c0e2bb1..0000000
--- a/test/tests/test_buttons.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-module Tests
- #
- class TestBg < Efl::Elm::ElmWin
- def initialize name, title, fct
- super nil, name
- self.title = title
- self.autodel = true
- @bg = Elm::ElmBg.new self do |bg|
- bg.size_hint_weight_expand
- self.resize_object_add bg
- bg.show
- end
- self.send fct
- self.resize 320, 480
- self.show
- end
- #
- def __create_butt_ico txt=nil, do_icon=true
- if do_icon
- ico = Elm::ElmIcon.new self
- ico.file = "#{PACKAGE_DATA_DIR}/images/logo_small.png", nil
- else
- ico = nil
- end
- bt = Efl::Elm::ElmButton.new self
- bt.text = txt unless txt.nil?
- bt.content = ico if ico
- bt.smart_callback_add "clicked", method(:bt_clicked_cb)
- bt.smart_callback_add "unpressed", method(:bt_unpressed_cb)
- @bx.pack_end bt
- @buttons << bt
- ico.show if ico
- bt.show
- [bt,ico]
- end
- #
- def buttons
- @scr = Efl::Elm::ElmScroller.new self do |scr|
- scr.bounce = false, true
- scr.policy = :elm_scroller_policy_off, :elm_scroller_policy_auto
- self.resize_object_add scr
- scr.size_hint_weight_expand
- scr.show
- end
- @bx = Efl::Elm::ElmBox.new self do |bx|
- bx.size_hint_weight_expand
- @scr.content = bx
- bx.show
- end
- #
- @buttons = []
- #
- bt,ico = __create_butt_ico "Icon sized to button"
- ico.size_hint_aspect = :evas_aspect_control_vertical, 1, 1
- #
- bt,ico = __create_butt_ico "Icon no scale"
- ico.scale = false, false
- #
- bt,ico = __create_butt_ico "Disabled Button"
- bt.disabled = true
- ico.size_hint_aspect = :evas_aspect_control_vertical, 1, 1
- #
- bt,ico = __create_butt_ico
- bt.disabled = true
- ico.size_hint_aspect = :evas_aspect_control_vertical, 1, 1
- #
- bt,ico = __create_butt_ico "Label Only", false
- bt.smart_callback_add "repeated", method(:bt_repeated_cb)
- bt.autorepeat = true
- bt.autorepeat_gap_timeout = 0.5
- bt.autorepeat_initial_timeout = 2.0
- #
- bt,ico = __create_butt_ico
- ico.scale = false, false
- #
- bt,ico = __create_butt_ico "Anchor style", false
- bt.style = "anchor"
- #
- bt,ico = __create_butt_ico
- ico.size_hint_aspect = :evas_aspect_control_vertical, 1, 1
- bt.style = "anchor"
- #
- bt,ico = __create_butt_ico
- ico.size_hint_aspect = :evas_aspect_control_vertical, 1, 1
- bt.style = "anchor"
- bt.disabled = true
- bt.access_info_set "This is some custom text describing this widget"
- end
- #
- def bt_clicked_cb data, evas_obj, event_info
- idx = @buttons.index @buttons.find { |b| b.to_ptr==evas_obj }
- puts "clicked event on Button: #{idx+1}"
- end
- #
- def bt_unpressed_cb data, evas_obj, event_info
- idx = @buttons.index @buttons.find { |b| b.to_ptr==evas_obj }
- puts "unpressed event on Button: #{idx+1}"
- end
- #
- def bt_repeated_cb data, evas_obj, event_info
- @count = ((@count||=0)+1)%1000
- Efl::Elm::ElmButton.new(evas_obj).text = "count = #{@count}"
- end
- end
- #
- def self.test_button
- TestBg.new 'buttons', 'Buttons', :buttons
- end
-end
-#
-# EOF