summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_elementary.rb271
-rw-r--r--test/test_elm_win-native.rb8
-rw-r--r--test/test_elm_win.rb37
-rw-r--r--test/test_evas.rb24
-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, 36 insertions, 848 deletions
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-native.rb b/test/test_elm_win-native.rb
index 318c3cd..0dbf9e0 100644
--- a/test/test_elm_win-native.rb
+++ b/test/test_elm_win-native.rb
@@ -1,12 +1,14 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
-require 'efl/native' # requires efl/native/* which populates Efl::Native
-require 'efl/elementary' # for Efl::Elm.init convenience
+require 'efl/native/elm/elm_win'
+require 'efl/native/elm/elm_bg'
+require 'efl/native/elm/elm_label'
+require 'efl/native/elm/elm_object'
#
include Efl::Native
#
-Efl::Elm.init
+elm_init 0, FFI::MemoryPointer::NULL
#
win_del = Proc.new { |data,evas_object,event_info|
elm_exit();
diff --git a/test/test_elm_win.rb b/test/test_elm_win.rb
index b9abcf2..9bf00ca 100644
--- a/test/test_elm_win.rb
+++ b/test/test_elm_win.rb
@@ -1,32 +1,33 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
-require 'efl/elementary'
+require 'efl/elm/elm_win'
+require 'efl/elm/elm_bg'
+require 'efl/elm/elm_label'
#
include Efl
#
class MyWin < Elm::ElmWin
#
- def initialize name, title
- super FFI::MemoryPointer::NULL, name
+ def initialize name, title, &block
+ super FFI::MemoryPointer::NULL, name, &block
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
+ @bg = Elm::ElmBg.new(self) do
+ size_hint_weight_expand
+ evas_object_color_set 200,255,100,150
+ 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
+ @lb = Elm::ElmLabel.new(self) do
+ text_set "Hello World!"
+ size_hint_align_fill
+ size_hint_weight_expand
+ show
end
- @lb.show
resize_object_add @lb
end
def on_delete data, evas_object, event_info
@@ -37,11 +38,11 @@ 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
+win = MyWin.new "App name", "Window Title" do
+ alpha_set true
+ resize 200, 100
+ center_set 600, 300
+ show
end
#
Elm.run
diff --git a/test/test_evas.rb b/test/test_evas.rb
index c3eadf7..c70f4d9 100644
--- a/test/test_evas.rb
+++ b/test/test_evas.rb
@@ -59,19 +59,19 @@ h = 240
#
canvas, pixels = create_canvas w, h
#
-bg = canvas.object_rectangle_add do |b|
- b.color = 255, 255, 255, 255
- b.move 0, 0
- b.resize w, h
+bg = canvas.object_rectangle_add do
+ color_set 255, 255, 255, 255
+ move 0, 0
+ resize w, h
end
bg.show
#
draw_scene canvas
#
-r1 = canvas.object_rectangle_add do |r|
- r.color = 255, 0, 0, 255
- r.move 10, 10
- r.resize 100, 100
+r1 = canvas.object_rectangle_add do
+ color_set 0, 0, 0, 255
+ move 10, 10
+ resize 100, 100
end
r1.show
#
@@ -82,10 +82,10 @@ r2 = canvas.object_rectangle_add do |r|
end
r2.show
#
-r3 = canvas.object_rectangle_add do |r|
- r.color = 0, 128, 0, 255
- r.move 60, 60
- r.resize 50, 50
+r3 = canvas.object_rectangle_add do
+ color_set 0, 128, 0, 255
+ move 60, 60
+ resize 50, 50
end
r3.show
#
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