MINT-core 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -3
- data/Gemfile.lock +98 -22
- data/History.txt +262 -0
- data/LICENSE +30 -0
- data/MINT-core.gemspec +25 -80
- data/Manifest.txt +145 -30
- data/README.rdoc +6 -163
- data/Rakefile +16 -17
- data/bin/mint-aui +3 -3
- data/bin/mint-cui-gfx +3 -2
- data/bin/mint-juggernaut.sh +0 -0
- data/bin/mint-tuplespace +0 -0
- data/lib/MINT-core.rb +53 -15
- data/lib/MINT-core/agent/agent.rb +1 -1
- data/lib/MINT-core/agent/aui.rb +0 -14
- data/lib/MINT-core/agent/auicontrol.rb +91 -38
- data/lib/MINT-core/agent/cui-gfx.rb +3 -3
- data/lib/MINT-core/agent/cuicontrol.rb +94 -24
- data/lib/MINT-core/connector/redis_connector.rb +16 -0
- data/lib/MINT-core/manager/mapping_manager.rb +101 -0
- data/lib/MINT-core/manager/mapping_parser.rb +89 -0
- data/lib/MINT-core/manager/mapping_server.rb +99 -0
- data/lib/MINT-core/manager/position_updater.rb +33 -0
- data/lib/MINT-core/manager/scxml_client.rb +118 -0
- data/lib/MINT-core/manager/scxml_server.rb +86 -0
- data/lib/MINT-core/mapping/action/action.rb +32 -0
- data/lib/MINT-core/mapping/action/backend_action.rb +32 -0
- data/lib/MINT-core/mapping/action/bind_action.rb +88 -0
- data/lib/MINT-core/mapping/action/event_action.rb +40 -0
- data/lib/MINT-core/mapping/complementary_mapping.rb +31 -0
- data/lib/MINT-core/mapping/mapping.rb +170 -34
- data/lib/MINT-core/mapping/observation/negation_observation.rb +64 -0
- data/lib/MINT-core/mapping/observation/observation.rb +219 -0
- data/lib/MINT-core/mapping/sequential.rb +1 -2
- data/lib/MINT-core/mapping/sequential_mapping.rb +60 -0
- data/lib/MINT-core/model/aui/AIChoiceElement.rb +17 -0
- data/lib/MINT-core/model/aui/AICommand.rb +7 -0
- data/lib/MINT-core/model/aui/AIContainer.rb +73 -0
- data/lib/MINT-core/model/aui/AIContext.rb +12 -0
- data/lib/MINT-core/model/aui/AIIN.rb +8 -0
- data/lib/MINT-core/model/aui/AIINContinuous.rb +56 -0
- data/lib/MINT-core/model/aui/AIINDiscrete.rb +8 -0
- data/lib/MINT-core/model/aui/AIMultiChoice.rb +1 -2
- data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +4 -51
- data/lib/MINT-core/model/aui/AIO.rb +76 -123
- data/lib/MINT-core/model/aui/AIOUT.rb +8 -0
- data/lib/MINT-core/model/aui/AIOUTContinuous.rb +61 -0
- data/lib/MINT-core/model/aui/AIReference.rb +16 -0
- data/lib/MINT-core/model/aui/AISingleChoice.rb +18 -1
- data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +10 -56
- data/lib/MINT-core/model/aui/AISinglePresence.rb +39 -71
- data/lib/MINT-core/model/aui/aicommand.scxml +47 -0
- data/lib/MINT-core/model/aui/aicontainer.scxml +41 -0
- data/lib/MINT-core/model/aui/aicontext.scxml +34 -0
- data/lib/MINT-core/model/aui/aiincontinuous.scxml +59 -0
- data/lib/MINT-core/model/aui/aiinrange.scxml +86 -0
- data/lib/MINT-core/model/aui/aimultichoice.scxml +67 -0
- data/lib/MINT-core/model/aui/aimultichoiceelement.scxml +51 -0
- data/lib/MINT-core/model/aui/aio.scxml +18 -27
- data/lib/MINT-core/model/aui/aioutcontinuous.scxml +66 -0
- data/lib/MINT-core/model/aui/aireference.scxml +28 -0
- data/lib/MINT-core/model/aui/aisinglechoice.scxml +60 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +45 -60
- data/lib/MINT-core/model/aui/aisinglepresence.scxml +15 -24
- data/lib/MINT-core/model/aui/model.rb +15 -38
- data/lib/MINT-core/model/cui/gfx/CIC.rb +34 -10
- data/lib/MINT-core/model/cui/gfx/CIO.rb +66 -115
- data/lib/MINT-core/model/cui/gfx/CarouFredSel.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb +6 -0
- data/lib/MINT-core/model/cui/gfx/button.rb +16 -0
- data/lib/MINT-core/model/cui/gfx/button.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/caroufredsel.rb +48 -0
- data/lib/MINT-core/model/cui/gfx/cic.scxml +57 -0
- data/lib/MINT-core/model/cui/gfx/cio.scxml +54 -0
- data/lib/MINT-core/model/cui/gfx/markableradiobutton.scxml +67 -0
- data/lib/MINT-core/model/cui/gfx/model.rb +39 -176
- data/lib/MINT-core/model/cui/gfx/radiobutton.scxml +59 -0
- data/lib/MINT-core/model/interactor.rb +167 -46
- data/lib/MINT-core/model/interactor.scxml +3 -0
- data/lib/MINT-core/model/interactor_helpers.rb +25 -0
- data/lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb +15 -0
- data/lib/MINT-core/model/ir/body/body.rb +5 -0
- data/lib/MINT-core/model/ir/body/fingertip.rb +114 -0
- data/lib/MINT-core/model/ir/body/fingertip.scxml +43 -0
- data/lib/MINT-core/model/{body → ir/body}/gesture_button.rb +0 -0
- data/lib/MINT-core/model/ir/body/hand.rb +5 -0
- data/lib/MINT-core/model/ir/body/head.rb +102 -0
- data/lib/MINT-core/model/ir/body/head.scxml +92 -0
- data/lib/MINT-core/model/ir/body/onehandposenavigation.scxml +53 -0
- data/lib/MINT-core/model/ir/body/pose.rb +99 -0
- data/lib/MINT-core/model/ir/browserscreen.rb +27 -0
- data/lib/MINT-core/model/ir/browserscreen.scxml +14 -0
- data/lib/MINT-core/model/{device → ir}/button.rb +1 -1
- data/lib/MINT-core/model/ir/ir.rb +5 -0
- data/lib/MINT-core/model/ir/irmedia.rb +5 -0
- data/lib/MINT-core/model/ir/irmode.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/joypad.rb +1 -1
- data/lib/MINT-core/model/ir/mouse.rb +44 -0
- data/lib/MINT-core/model/ir/mouse.scxml +35 -0
- data/lib/MINT-core/model/{device/mouse.rb → ir/mouse_old.rb} +2 -2
- data/lib/MINT-core/model/{device → ir}/pointer.rb +20 -22
- data/lib/MINT-core/model/ir/pointer.scxml +19 -0
- data/lib/MINT-core/model/ir/screen.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/wheel.rb +1 -1
- data/lib/MINT-core/model/mim/aicommand_activate_to_button_press.xml +13 -0
- data/lib/MINT-core/model/mim/aicommand_deactivate_to_button_release.xml +13 -0
- data/lib/MINT-core/model/mim/aio_defocus_to_cio_unhighlight.xml +13 -0
- data/lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml +14 -0
- data/lib/MINT-core/model/mim/aio_present_to_cio_display.xml +14 -0
- data/lib/MINT-core/model/mim/aio_suspend_to_cio_hide.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_chosen_to_radiobutton_select.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_unchosen_to_radiobutton_unselect.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglepresence_children_finished_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglepresence_present_to_child_present.xml +15 -0
- data/lib/MINT-core/model/mim/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/lib/MINT-core/model/mim/button_press_to_aicommand_activate.xml +12 -0
- data/lib/MINT-core/model/mim/button_release_to_aicommand_deactivate.xml +12 -0
- data/lib/MINT-core/model/mim/caroufredsel_refreshing_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_defocus.xml +13 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_present.xml +12 -0
- data/lib/MINT-core/model/mim/cio_display_to_cio_display_cache_add.xml +11 -0
- data/lib/MINT-core/model/mim/cio_hide_to_aio_suspend.xml +12 -0
- data/lib/MINT-core/model/mim/cio_hide_to_cio_display_cache_remove.xml +12 -0
- data/lib/MINT-core/model/mim/cio_highlight_to_aio_focus.xml +13 -0
- data/lib/MINT-core/model/mim/head_looking_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_looking_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_nodding_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_tilting_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_tilting_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_enter.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/mim_default.xml +52 -0
- data/lib/MINT-core/model/mim/mint-mappings.xsd +127 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aicommand_activate.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_choose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_unchoose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_release_to_aicommand_deactivate.xml +16 -0
- data/lib/MINT-core/model/mim/mouse_stop_to_cio_highlight.xml +13 -0
- data/lib/MINT-core/model/mim/onehandposnav_confirm_to_aichoiceelement_choose.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_next_to_aio_next.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_previous_to_aio_prev.xml +14 -0
- data/lib/MINT-core/model/mim/radiobutton_selected_to_aisinglechoiceelement_choose.xml +13 -0
- data/lib/MINT-core/model/mim/radiobutton_unselected_to_aisinglechoiceelement_unchoose.xml +13 -0
- data/lib/MINT-core/model/mim/right_button_aisinglepresence_prev.xml +15 -0
- data/lib/MINT-core/model/task.rb +6 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/spec/AICommand_spec.rb +20 -0
- data/spec/AIContainer_spec.rb +161 -0
- data/spec/AIINContinuous_spec.rb +92 -0
- data/spec/AIOUTContinuous_spec.rb +93 -0
- data/spec/AIO_spec.rb +73 -0
- data/spec/AIReference_spec.rb +105 -0
- data/spec/AISinglePresence_spec.rb +204 -60
- data/spec/Button_spec.rb +114 -0
- data/spec/CIO_spec.rb +145 -0
- data/spec/Interactor_spec.rb +95 -0
- data/spec/MappingManager_spec.rb +126 -0
- data/spec/Spontaneous_spec.rb +53 -0
- data/spec/aio_agent_spec.rb +215 -186
- data/spec/aisinglechoice_spec.rb +147 -88
- data/spec/aisinglechoiceelement_spec.rb +154 -70
- data/spec/complementary_mapping_spec.rb +158 -0
- data/spec/core_spec.rb +27 -15
- data/spec/cui_helper.rb +100 -0
- data/spec/examples/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/spec/examples/mim_streaming_example.xml +9 -0
- data/spec/examples/mouse_highlight.xml +22 -0
- data/spec/examples/performance_mapping.xml +15 -0
- data/spec/examples/reset_click.xml +24 -0
- data/spec/interactor_test.scxml +32 -0
- data/spec/interactor_test_2.scxml +16 -0
- data/spec/mapping_performance_spec.rb +118 -0
- data/spec/mapping_server_spec.rb +161 -0
- data/spec/mapping_spec.rb +307 -0
- data/spec/music_spec.rb +301 -135
- data/spec/performance_counter.scxml +9 -0
- data/spec/sequential_mappings_spec.rb +69 -0
- data/spec/shared/aio_shared.rb +144 -0
- data/spec/spec_helper.rb +22 -3
- data/spec/spontaneous.scxml +11 -0
- data/spec/support/connection_helper.rb +19 -0
- data/spec/support/redis_connector_monkey_patch.rb +1 -0
- data/spec/support/statemachine_helper.rb +84 -0
- data/spec/sync_mappings_spec.rb +96 -0
- metadata +219 -354
- data/lib/MINT-core/mapping/complementary.rb +0 -100
- data/lib/MINT-core/mapping/on_state_change.rb +0 -65
- data/lib/MINT-core/model/aui/AIC.rb +0 -86
- data/lib/MINT-core/model/aui/AIChoice.rb +0 -65
- data/lib/MINT-core/model/aui/AIINChoose.rb +0 -54
- data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +0 -43
- data/lib/MINT-core/model/aui/aic.png +0 -0
- data/lib/MINT-core/model/aui/aic.scxml +0 -50
- data/lib/MINT-core/model/aui/aichoice.png +0 -0
- data/lib/MINT-core/model/aui/aichoice.scxml +0 -60
- data/lib/MINT-core/model/aui/aio.png +0 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
- data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
- data/lib/MINT-core/model/body/handgesture.rb +0 -279
- data/lib/MINT-core/model/body/head.png +0 -0
- data/lib/MINT-core/model/body/head.rb +0 -51
- data/lib/MINT-core/model/body/head.scxml +0 -28
- data/lib/MINT-core/model/cui/gfx/screen.rb +0 -18
- data/lib/MINT-core/overrides/rinda.rb +0 -34
- data/spec/AIC_spec.rb +0 -69
- data/spec/MINT-core_spec.rb +0 -11
- data/spec/aio_spec.rb +0 -144
- data/spec/cio_spec.rb +0 -369
- data/tasks/rspec.rake +0 -21
data/spec/music_spec.rb
CHANGED
@@ -1,177 +1,343 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
include MINT
|
4
3
|
describe 'AUI' do
|
5
|
-
|
6
|
-
|
4
|
+
include EventMachine::SpecHelper
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
class ::Helper
|
8
|
+
def self.create_structure
|
9
|
+
MINT::AIContainer.create(:name=>"interactive_sheet", :children => "sheets|option")
|
10
|
+
MINT::AIContainer.create(:name=>"sheets", :children => "", :parent => "interactive_sheet")
|
11
|
+
MINT::AISingleChoice.create(:name=>"option", :children => "nodding|tilting|turning", :parent => "interactive_sheet")
|
12
|
+
MINT::AISingleChoiceElement.create(:name=>"nodding",:text=>"Nodding", :parent => "option")
|
13
|
+
MINT::AISingleChoiceElement.create(:name=>"tilting",:text=>"Tilting", :parent => "option")
|
14
|
+
MINT::AISingleChoiceElement.create(:name=>"turning",:text=>"Turning", :parent => "option")
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.create_structure_CUI
|
18
|
+
MINT::CIC.create(:name =>"interactive_sheet",:x=>15, :y=>15, :width =>1280, :height => 1000,:layer=>0, :rows=>2, :cols=>1,:states=>[:positioned])
|
19
|
+
MINT::SingleHighlight.create(:name => "sheets", :width=>1198, :height => 820,:states=>[:positioned])
|
20
|
+
MINT::RadioButtonGroup.create(:name =>"option", :x=>30,:y=>840, :width=>1200, :height => 100,:rows=>1,:cols=>3,:states=>[:positioned])
|
21
|
+
MINT::RadioButton.create(:name => "nodding",:x=>40, :y=>850, :width=>200, :height => 80,:states=>[:positioned])
|
22
|
+
MINT::RadioButton.create(:name => "tilting",:x=>440, :y=>850,:width=>200, :height => 80,:states=>[:positioned])
|
23
|
+
MINT::RadioButton.create(:name => "turning",:x=>840, :y=>850,:width=>200, :height => 80,:states=>[:positioned])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
connection_options = { :adapter => "redis"}
|
7
28
|
DataMapper.setup(:default, connection_options)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
29
|
+
|
30
|
+
connect do |redis|
|
31
|
+
require "MINT-core"
|
32
|
+
|
33
|
+
DataMapper.finalize
|
34
|
+
DataMapper::Model.raise_on_save_failure = true
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
=begin
|
41
|
+
@interactive_sheet = MINT::AIContainer.first
|
19
42
|
AUIControl.organize(@interactive_sheet,nil,0)
|
20
43
|
@interactive_sheet.save!
|
21
44
|
|
22
|
-
@sheets = MINT::
|
45
|
+
@sheets = MINT::AIContainer.first(:name=>"sheets")
|
23
46
|
@option = MINT::AISingleChoice.first(:name=>"option")
|
24
|
-
|
47
|
+
=end
|
25
48
|
|
26
49
|
describe 'music sheet' do
|
50
|
+
|
27
51
|
it 'interactive_sheet should recover state after save and reload' do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
52
|
+
connect do |redis|
|
53
|
+
Helper.create_structure
|
54
|
+
@interactive_sheet = MINT::AIContainer.first
|
55
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
56
|
+
|
57
|
+
@interactive_sheet.states.should == [:organized]
|
58
|
+
b = MINT::AIContainer.first(:name=>"interactive_sheet")
|
59
|
+
b.states.should == [:organized]
|
60
|
+
b.process_event(:present).should == [:defocused]
|
61
|
+
end
|
33
62
|
end
|
34
63
|
|
35
64
|
it 'sheets should recover state after save and reload' do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
65
|
+
connect do |redis|
|
66
|
+
Helper.create_structure
|
67
|
+
@interactive_sheet = MINT::AIContainer.first
|
68
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
69
|
+
@sheets = MINT::AIContainer.first(:name=>"sheets")
|
70
|
+
|
71
|
+
@sheets.states.should == [:organized]
|
72
|
+
@sheets.new_states.should == [:organized]
|
73
|
+
@sheets.process_event(:present).should ==[:defocused]
|
74
|
+
sheets = MINT::AIContainer.first(:name=>"sheets")
|
75
|
+
sheets.states.should == [:defocused]
|
76
|
+
sheets.process_event(:focus).should == [:focused]
|
77
|
+
end
|
44
78
|
end
|
45
79
|
|
46
80
|
it 'option list should recover state after save and reload' do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
81
|
+
connect(true) do |redis|
|
82
|
+
# Sync AIO to focused
|
83
|
+
parser = MINT::MappingParser.new
|
84
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml"
|
85
|
+
m.start
|
86
|
+
|
87
|
+
parser = MINT::MappingParser.new
|
88
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_present_to_cio_display.xml"
|
89
|
+
m.start
|
90
|
+
|
91
|
+
|
92
|
+
check_result = Proc.new {
|
93
|
+
@option.children.each do |c|
|
94
|
+
c.process_event(:focus)
|
95
|
+
c.states.should == [:focused, :unchosen]
|
96
|
+
end
|
97
|
+
option = MINT::AISingleChoice.first(:name=>"option")
|
98
|
+
option.states.should == [:defocused, :listing]
|
99
|
+
option.process_event(:focus).should == [:focused, :listing]
|
100
|
+
option.children.each do |c|
|
101
|
+
c.states.should == [:focused, :unchosen]
|
102
|
+
end
|
103
|
+
done
|
104
|
+
}
|
105
|
+
|
106
|
+
|
107
|
+
test_complex_state_flow_w_name redis,[["Interactor.AIO.AIOUT.AIContainer.AISingleChoice","option" ,["initialized","organized",["p", "presenting", "dropping", "wait_for_children", "listing"],"children_finished","defocused"]]],check_result do |count|
|
108
|
+
Helper.create_structure
|
109
|
+
Helper.create_structure_CUI
|
110
|
+
@interactive_sheet = MINT::AIContainer.first
|
111
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
112
|
+
@option = MINT::AISingleChoice.first(:name=>"option")
|
113
|
+
|
114
|
+
@option.states.should == [:organized]
|
115
|
+
@option.new_states.should == [:organized]
|
116
|
+
@option.process_event(:present).should ==[:wait_for_children, :listing]
|
117
|
+
end
|
118
|
+
|
61
119
|
end
|
62
120
|
end
|
63
121
|
|
64
122
|
it 'lists options should recover state after save and reload' do
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
123
|
+
connect do |redis|
|
124
|
+
Helper.create_structure
|
125
|
+
@interactive_sheet = MINT::AIContainer.first
|
126
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
127
|
+
@option = MINT::AISingleChoice.first(:name=>"option")
|
128
|
+
|
129
|
+
@option.states.should == [:organized]
|
130
|
+
@option.new_states.should == [:organized]
|
131
|
+
|
132
|
+
#manually set what is usually done by a mapping
|
133
|
+
@option.process_event(:present).should ==[:wait_for_children, :listing]
|
134
|
+
@option.present_children
|
135
|
+
|
136
|
+
@option.process_event(:children_finished).should ==[:defocused, :listing]
|
137
|
+
|
138
|
+
|
139
|
+
#recover one of its children and alter its state
|
140
|
+
nodding = MINT::AISingleChoiceElement.first(:name=>"nodding")
|
141
|
+
nodding.states.should == [:defocused, :unchosen]
|
142
|
+
nodding.process_event(:focus).should == [:focused, :unchosen]
|
143
|
+
nodding.process_event(:choose).should == [:focused, :chosen]
|
144
|
+
|
145
|
+
#recover child and check
|
146
|
+
nodding = MINT::AISingleChoiceElement.first(:name=>"nodding")
|
147
|
+
nodding.states.should == [:focused, :chosen]
|
148
|
+
|
149
|
+
#recover another child and alter its state
|
150
|
+
tilting = MINT::AISingleChoiceElement.first(:name=>"tilting")
|
151
|
+
tilting.process_event(:focus).should == [:focused, :unchosen]
|
152
|
+
|
153
|
+
#recover child and check
|
154
|
+
tilting = MINT::AISingleChoiceElement.first(:name=>"tilting")
|
155
|
+
tilting.states.should == [:focused, :unchosen]
|
156
|
+
|
157
|
+
# choose option tilting, thus unchoosing nodding
|
158
|
+
tilting.process_event(:choose)
|
159
|
+
tilting.states.should == [:focused, :chosen]
|
160
|
+
|
161
|
+
# recover nodding to see the change made
|
162
|
+
nodding = MINT::AISingleChoiceElement.first(:name=>"nodding")
|
163
|
+
nodding.states.should == [:focused, :unchosen]
|
164
|
+
|
165
|
+
#recover and check
|
166
|
+
tilting = MINT::AISingleChoiceElement.first(:name=>"tilting")
|
167
|
+
tilting.states.should == [:focused, :chosen]
|
168
|
+
end
|
99
169
|
end
|
100
170
|
end
|
101
171
|
|
102
172
|
describe "AUI/CUI synchronization" do
|
103
|
-
before :each do
|
104
|
-
MINT::CIC.create(:name =>"interactive_sheet",:x=>15, :y=>15, :width =>1280, :height => 1000,:layer=>0, :rows=>2, :cols=>1,:states=>[:positioned])
|
105
|
-
MINT::SingleHighlight.create(:name => "sheets", :width=>1198, :height => 820,:states=>[:positioned])
|
106
|
-
|
107
|
-
MINT::RadioButtonGroup.create(:name =>"option", :x=>30,:y=>840, :width=>1200, :height => 100,:rows=>1,:cols=>3,:states=>[:positioned])
|
108
|
-
MINT::RadioButton.create(:name => "nodding",:x=>40, :y=>850, :width=>200, :height => 80,:states=>[:positioned])
|
109
|
-
MINT::RadioButton.create(:name => "tilting",:x=>440, :y=>850,:width=>200, :height => 80,:states=>[:positioned])
|
110
|
-
MINT::RadioButton.create(:name => "turning",:x=>840, :y=>850,:width=>200, :height => 80,:states=>[:positioned])
|
111
|
-
end
|
112
173
|
|
113
174
|
it "should sync to displayed" do
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
175
|
+
connect true do |redis|
|
176
|
+
|
177
|
+
parser = MINT::MappingParser.new
|
178
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml"
|
179
|
+
m.start
|
180
|
+
|
181
|
+
parser = MINT::MappingParser.new
|
182
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_present_to_cio_display.xml"
|
183
|
+
m.start
|
184
|
+
|
185
|
+
|
186
|
+
check_result = Proc.new {
|
187
|
+
MINT::CIC.first(:name=>"interactive_sheet").states.should == [:displayed]
|
188
|
+
MINT::SingleHighlight.first(:name=>"sheets").states.should == [:displayed]
|
189
|
+
MINT::RadioButtonGroup.first(:name=>"option").states.should == [:displayed]
|
190
|
+
MINT::RadioButton.first(:name=>"nodding").states.should == [:unselected, :displayed]
|
191
|
+
MINT::RadioButton.first(:name=>"tilting").states.should == [:unselected, :displayed]
|
192
|
+
MINT::RadioButton.first(:name=>"turning").states.should == [:unselected, :displayed]
|
193
|
+
done
|
194
|
+
}
|
195
|
+
|
196
|
+
test_complex_state_flow_w_name redis,[["Interactor.AIO.AIOUT.AIContainer.AISingleChoice","option" ,["initialized","organized",["p", "presenting", "dropping", "wait_for_children", "listing"],"children_finished","defocused"]]],check_result do |count|
|
197
|
+
|
198
|
+
Helper.create_structure
|
199
|
+
Helper.create_structure_CUI
|
200
|
+
@interactive_sheet = MINT::AIContainer.first
|
201
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
202
|
+
@interactive_sheet.process_event(:present)
|
203
|
+
end
|
204
|
+
end
|
122
205
|
end
|
123
206
|
|
124
207
|
it "should sync interactive_sheet to highlighted" do
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
MINT::SingleHighlight.first(:name=>"sheets").states.should == [:displayed]
|
130
|
-
MINT::RadioButtonGroup.first(:name=>"option").states.should == [:displayed]
|
131
|
-
MINT::RadioButton.first(:name=>"nodding").states.should == [:displayed, :listed]
|
132
|
-
MINT::RadioButton.first(:name=>"tilting").states.should == [:displayed, :listed]
|
133
|
-
MINT::RadioButton.first(:name=>"turning").states.should == [:displayed, :listed]
|
134
|
-
end
|
208
|
+
connect true,10 do |redis|
|
209
|
+
parser = MINT::MappingParser.new
|
210
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml"
|
211
|
+
m.start
|
135
212
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
213
|
+
parser = MINT::MappingParser.new
|
214
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_present_to_cio_display.xml"
|
215
|
+
m.start
|
216
|
+
|
217
|
+
parser = MINT::MappingParser.new
|
218
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml"
|
219
|
+
m.start
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
check_result_2 = Proc.new {
|
226
|
+
MINT::CIC.first(:name=>"interactive_sheet").states.should == [:highlighted]
|
227
|
+
MINT::SingleHighlight.first(:name=>"sheets").states.should == [:displayed]
|
228
|
+
MINT::RadioButtonGroup.first(:name=>"option").states.should == [:displayed]
|
229
|
+
MINT::RadioButton.first(:name=>"nodding").states.should == [:unselected, :displayed]
|
230
|
+
MINT::RadioButton.first(:name=>"tilting").states.should == [:unselected, :displayed]
|
231
|
+
MINT::RadioButton.first(:name=>"turning").states.should == [:unselected, :displayed]
|
232
|
+
done
|
233
|
+
}
|
234
|
+
|
235
|
+
check_result = Proc.new {
|
236
|
+
test_complex_state_flow_w_name redis,[["Interactor.CIO.CIC","interactive_sheet" ,["highlighted"]]],check_result_2 do |count|
|
237
|
+
@interactive_sheet = MINT::AIContainer.first(:name => "interactive_sheet")
|
238
|
+
@interactive_sheet.process_event(:focus)
|
239
|
+
end
|
240
|
+
}
|
241
|
+
|
242
|
+
test_complex_state_flow_w_name redis,[["Interactor.AIO.AIOUT.AIContainer.AISingleChoice","option" ,["initialized","organized",["p", "presenting", "dropping", "wait_for_children", "listing"],"children_finished","defocused"]]],check_result do |count|
|
243
|
+
Helper.create_structure
|
244
|
+
Helper.create_structure_CUI
|
245
|
+
@interactive_sheet = MINT::AIContainer.first
|
246
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
247
|
+
@interactive_sheet.process_event(:present)
|
248
|
+
end
|
249
|
+
end
|
147
250
|
end
|
148
251
|
|
149
|
-
it "should sync
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
252
|
+
it "should sync interactive_sheet to highlighted" do
|
253
|
+
connect true do |redis|
|
254
|
+
parser = MINT::MappingParser.new
|
255
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml"
|
256
|
+
m.start
|
257
|
+
|
258
|
+
parser = MINT::MappingParser.new
|
259
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_present_to_cio_display.xml"
|
260
|
+
m.start
|
261
|
+
|
262
|
+
parser = MINT::MappingParser.new
|
263
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml"
|
264
|
+
m.start
|
265
|
+
|
266
|
+
check_result_2 = Proc.new {
|
267
|
+
MINT::CIC.first(:name=>"interactive_sheet").states.should == [:highlighted]
|
268
|
+
MINT::SingleHighlight.first(:name=>"sheets").states.should == [:displayed]
|
269
|
+
MINT::RadioButtonGroup.first(:name=>"option").states.should == [:displayed]
|
270
|
+
MINT::RadioButton.first(:name=>"nodding").states.should == [:unselected, :displayed]
|
271
|
+
MINT::RadioButton.first(:name=>"tilting").states.should == [:unselected, :displayed]
|
272
|
+
MINT::RadioButton.first(:name=>"turning").states.should == [:unselected, :displayed]
|
273
|
+
done
|
274
|
+
}
|
275
|
+
|
276
|
+
check_result = Proc.new {
|
277
|
+
test_complex_state_flow_w_name redis,[["Interactor.CIO.CIC","interactive_sheet" ,["highlighted"]]],check_result_2 do |count|
|
278
|
+
@sheets = MINT::AIContainer.first(:name=>"interactive_sheet")
|
279
|
+
@sheets.process_event(:focus)
|
280
|
+
end
|
281
|
+
}
|
282
|
+
|
283
|
+
test_complex_state_flow_w_name redis,[["Interactor.AIO.AIOUT.AIContainer.AISingleChoice","option" ,["initialized","organized",["p", "presenting", "dropping", "wait_for_children", "listing"],"children_finished","defocused"]]],check_result do |count|
|
284
|
+
|
285
|
+
Helper.create_structure
|
286
|
+
Helper.create_structure_CUI
|
287
|
+
@interactive_sheet = MINT::AIContainer.first
|
288
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
289
|
+
@interactive_sheet.process_event(:present)
|
290
|
+
end
|
291
|
+
|
292
|
+
end
|
161
293
|
end
|
162
294
|
|
295
|
+
|
296
|
+
|
163
297
|
it "should sync only one RadioButton to selected at a time" do
|
164
|
-
|
298
|
+
connect true do |redis|
|
299
|
+
|
300
|
+
parser = MINT::MappingParser.new
|
301
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml"
|
302
|
+
m.start
|
303
|
+
|
304
|
+
parser = MINT::MappingParser.new
|
305
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_present_to_cio_display.xml"
|
306
|
+
m.start
|
307
|
+
|
308
|
+
parser = MINT::MappingParser.new
|
309
|
+
m = parser.build_from_scxml File.dirname(__FILE__) +"/../lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml"
|
310
|
+
m.start
|
311
|
+
|
312
|
+
check_result_2 = Proc.new {
|
313
|
+
MINT::AISingleChoiceElement.first(:name=>"nodding").process_event(:choose)
|
314
|
+
MINT::AISingleChoiceElement.first(:name=>"nodding").states.should == [:focused, :chosen]
|
315
|
+
MINT::AISingleChoiceElement.first(:name=>"tilting").states.should == [:defocused, :unchosen]
|
316
|
+
MINT::AISingleChoiceElement.first(:name=>"turning").states.should == [:defocused, :unchosen]
|
165
317
|
|
166
|
-
MINT::AISingleChoiceElement.first(:name=>"nodding").process_event(:choose)
|
167
318
|
|
168
|
-
|
169
|
-
|
170
|
-
|
319
|
+
MINT::RadioButton.first(:name=>"nodding").states.should == [:unselected, :highlighted]
|
320
|
+
MINT::RadioButton.first(:name=>"tilting").states.should == [:unselected, :displayed]
|
321
|
+
MINT::RadioButton.first(:name=>"turning").states.should == [:unselected, :displayed]
|
171
322
|
|
172
|
-
|
173
|
-
|
174
|
-
|
323
|
+
done
|
324
|
+
}
|
325
|
+
|
326
|
+
check_result = Proc.new {
|
327
|
+
test_complex_state_flow_w_name redis,[["Interactor.CIO.RadioButton","nodding" ,["highlighted"]]],check_result_2 do |count|
|
328
|
+
MINT::AISingleChoiceElement.first(:name=>"nodding").process_event(:focus)
|
329
|
+
end
|
330
|
+
}
|
331
|
+
|
332
|
+
test_complex_state_flow_w_name redis,[["Interactor.AIO.AIOUT.AIContainer.AISingleChoice","option" ,["initialized","organized",["p", "presenting", "dropping", "wait_for_children", "listing"],"children_finished","defocused"]]],check_result do |count|
|
333
|
+
Helper.create_structure
|
334
|
+
Helper.create_structure_CUI
|
335
|
+
@interactive_sheet = MINT::AIContainer.first
|
336
|
+
AUIControl.organize(@interactive_sheet,nil,0)
|
337
|
+
|
338
|
+
@interactive_sheet.process_event(:present)
|
339
|
+
end
|
340
|
+
end
|
175
341
|
end
|
176
342
|
|
177
343
|
end
|