diff options
Diffstat (limited to 'test/tests')
-rw-r--r-- | test/tests/test_actionslider.rb | 132 | ||||
-rw-r--r-- | test/tests/test_bg.rb | 151 | ||||
-rw-r--r-- | test/tests/test_box.rb | 147 | ||||
-rw-r--r-- | test/tests/test_buttons.rb | 114 |
4 files changed, 0 insertions, 544 deletions
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 |