limelight 0.3.1-java → 0.4.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/init.rb +5 -2
- data/lib/limelight/animation.rb +2 -2
- data/lib/limelight/builtin/players/button.rb +1 -1
- data/lib/limelight/builtin/players/check_box.rb +1 -1
- data/lib/limelight/builtin/players/combo_box.rb +2 -4
- data/lib/limelight/builtin/players/combo_box_popup_list.rb +1 -1
- data/lib/limelight/builtin/players/combo_box_popup_list_item.rb +1 -1
- data/lib/limelight/builtin/players/curtains.rb +1 -1
- data/lib/limelight/builtin/players/image.rb +3 -0
- data/lib/limelight/builtin/players/password_box.rb +1 -1
- data/lib/limelight/builtin/players/radio_button.rb +1 -1
- data/lib/limelight/builtin/players/text_area.rb +1 -1
- data/lib/limelight/builtin/players/text_box.rb +1 -1
- data/lib/limelight/builtin/players.rb +1 -1
- data/lib/limelight/builtin/styles.rb +1 -1
- data/lib/limelight/builtin/utilities_production/alert/props.rb +5 -0
- data/lib/limelight/builtin/utilities_production/alert/styles.rb +7 -0
- data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +17 -0
- data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +9 -0
- data/lib/limelight/builtin/utilities_production/production.rb +59 -0
- data/lib/limelight/builtin/utilities_production/stages.rb +9 -0
- data/lib/limelight/builtin/utilities_production/styles.rb +50 -0
- data/lib/limelight/button_group_cache.rb +1 -1
- data/lib/limelight/casting_director.rb +1 -1
- data/lib/limelight/client/playbills.rb +3 -0
- data/lib/limelight/commands/command.rb +13 -7
- data/lib/limelight/commands/create_command.rb +13 -8
- data/lib/limelight/commands/freeze_command.rb +3 -0
- data/lib/limelight/commands/help_command.rb +12 -1
- data/lib/limelight/commands/open_command.rb +11 -1
- data/lib/limelight/commands/pack_command.rb +1 -1
- data/lib/limelight/commands/unpack_command.rb +1 -1
- data/lib/limelight/commands/version_command.rb +1 -1
- data/lib/limelight/data.rb +4 -14
- data/lib/limelight/dsl/build_exception.rb +12 -8
- data/lib/limelight/dsl/menu_bar.rb +1 -1
- data/lib/limelight/dsl/production_builder.rb +1 -1
- data/lib/limelight/dsl/prop_builder.rb +2 -2
- data/lib/limelight/dsl/stage_builder.rb +3 -3
- data/lib/limelight/dsl/styles_builder.rb +2 -1
- data/lib/limelight/file_chooser.rb +1 -1
- data/lib/limelight/file_filter.rb +1 -1
- data/lib/limelight/file_loader.rb +1 -1
- data/lib/limelight/gems.rb +4 -0
- data/lib/limelight/java_couplings.rb +3 -2
- data/lib/limelight/java_util.rb +1 -1
- data/lib/limelight/limelight_exception.rb +1 -1
- data/lib/limelight/main.rb +1 -1
- data/lib/limelight/paint_action.rb +1 -1
- data/lib/limelight/pen.rb +1 -1
- data/lib/limelight/producer.rb +52 -37
- data/lib/limelight/production.rb +81 -43
- data/lib/limelight/prop.rb +32 -13
- data/lib/limelight/scene.rb +19 -14
- data/lib/limelight/specs/spec_helper.rb +55 -28
- data/lib/limelight/stage.rb +163 -23
- data/lib/limelight/string.rb +3 -0
- data/lib/limelight/studio.rb +143 -6
- data/lib/limelight/styles.rb +14 -1
- data/lib/limelight/templates/production_templater.rb +6 -2
- data/lib/limelight/templates/scene_templater.rb +12 -7
- data/lib/limelight/templates/sources/production/production.rb.template +46 -6
- data/lib/limelight/templates/sources/production/spec/spec_helper.rb.template +5 -0
- data/lib/limelight/templates/sources/scene_spec/scene_spec.rb.template +13 -0
- data/lib/limelight/templates/templater.rb +4 -1
- data/lib/limelight/templates/templater_logger.rb +3 -0
- data/lib/limelight/theater.rb +15 -6
- data/lib/limelight/util/downloader.rb +3 -1
- data/lib/limelight/util.rb +8 -7
- data/lib/limelight/version.rb +3 -3
- data/lib/limelight.jar +0 -0
- data/productions/examples/8thlight.com/about/props.rb +1 -1
- data/productions/examples/8thlight.com/about/styles.rb +1 -1
- data/productions/examples/8thlight.com/footer.rb +1 -1
- data/productions/examples/8thlight.com/home/props.rb +1 -1
- data/productions/examples/8thlight.com/home/styles.rb +1 -1
- data/productions/examples/8thlight.com/menu.rb +1 -1
- data/productions/examples/8thlight.com/services/props.rb +1 -1
- data/productions/examples/8thlight.com/services/styles.rb +1 -1
- data/productions/examples/8thlight.com/stages.rb +1 -1
- data/productions/examples/8thlight.com/styles.rb +1 -1
- data/productions/examples/calculator/players/button.rb +1 -1
- data/productions/examples/calculator/players/calculator.rb +1 -1
- data/productions/examples/calculator/players/calculator_model.rb +1 -1
- data/productions/examples/calculator/props.rb +1 -1
- data/productions/examples/calculator/styles.rb +1 -1
- data/productions/examples/langstons_ant/init.rb +3 -0
- data/productions/examples/langstons_ant/players/ant.rb +1 -1
- data/productions/examples/langstons_ant/players/log.rb +1 -1
- data/productions/examples/langstons_ant/players/start_stop_button.rb +1 -1
- data/productions/examples/langstons_ant/players/world.rb +1 -1
- data/productions/examples/langstons_ant/props.rb +1 -1
- data/productions/examples/langstons_ant/styles.rb +1 -1
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +7 -0
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +29 -0
- data/productions/examples/sandbox/alerts/incompatible_production/production.rb +49 -0
- data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +13 -0
- data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +5 -0
- data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +17 -0
- data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +12 -0
- data/productions/examples/sandbox/alerts/players/alerts.rb +14 -0
- data/productions/examples/sandbox/alerts/props.rb +7 -0
- data/productions/examples/sandbox/alerts/styles.rb +43 -0
- data/productions/examples/sandbox/background_images/props.rb +19 -0
- data/productions/examples/sandbox/background_images/styles.rb +40 -0
- data/productions/examples/sandbox/click_me/players/chromaton.rb +1 -1
- data/productions/examples/sandbox/click_me/props.rb +1 -1
- data/productions/examples/sandbox/click_me/styles.rb +1 -1
- data/productions/examples/sandbox/floaters/players/floater.rb +9 -5
- data/productions/examples/sandbox/floaters/players/surface.rb +1 -1
- data/productions/examples/sandbox/floaters/props.rb +1 -1
- data/productions/examples/sandbox/floaters/styles.rb +13 -13
- data/productions/examples/sandbox/frameing/players/sandbox.rb +3 -0
- data/productions/examples/sandbox/frameing/props.rb +3 -0
- data/productions/examples/sandbox/frameing/styles.rb +3 -0
- data/productions/examples/sandbox/gradients/players/spinner.rb +1 -1
- data/productions/examples/sandbox/gradients/players/teaser.rb +1 -1
- data/productions/examples/sandbox/gradients/players/wave.rb +1 -1
- data/productions/examples/sandbox/gradients/players/waves.rb +1 -1
- data/productions/examples/sandbox/gradients/props.rb +1 -1
- data/productions/examples/sandbox/gradients/styles.rb +1 -1
- data/productions/examples/sandbox/header.rb +4 -1
- data/productions/examples/sandbox/homer/players/homer.rb +1 -1
- data/productions/examples/sandbox/homer/props.rb +1 -1
- data/productions/examples/sandbox/homer/styles.rb +2 -2
- data/productions/examples/sandbox/images/space.png +0 -0
- data/productions/examples/sandbox/images_scene/props.rb +3 -0
- data/productions/examples/sandbox/images_scene/styles.rb +3 -0
- data/productions/examples/sandbox/inputs/players/button_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/check_box_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/combo_box_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/radio_button_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/text_area_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/text_box_input.rb +1 -1
- data/productions/examples/sandbox/inputs/props.rb +1 -1
- data/productions/examples/sandbox/inputs/styles.rb +1 -1
- data/productions/examples/sandbox/kiosk/players/kiosk.rb +36 -0
- data/productions/examples/sandbox/kiosk/props.rb +6 -0
- data/productions/examples/sandbox/kiosk/styles.rb +34 -0
- data/productions/examples/sandbox/players/sandbox.rb +1 -1
- data/productions/examples/sandbox/rounded_corners/players/box.rb +1 -1
- data/productions/examples/sandbox/rounded_corners/props.rb +1 -1
- data/productions/examples/sandbox/rounded_corners/styles.rb +1 -1
- data/productions/examples/sandbox/scrolling/players/add_button.rb +1 -1
- data/productions/examples/sandbox/scrolling/players/cell.rb +1 -1
- data/productions/examples/sandbox/scrolling/props.rb +1 -1
- data/productions/examples/sandbox/scrolling/styles.rb +1 -1
- data/productions/examples/sandbox/sketching/players/sketchpad.rb +1 -1
- data/productions/examples/sandbox/sketching/props.rb +1 -1
- data/productions/examples/sandbox/sketching/styles.rb +1 -1
- data/productions/examples/sandbox/sounds/players/clip.rb +1 -1
- data/productions/examples/sandbox/sounds/props.rb +1 -1
- data/productions/examples/sandbox/sounds/styles.rb +1 -1
- data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +13 -0
- data/productions/examples/sandbox/stages.rb +2 -1
- data/productions/examples/sandbox/styles.rb +1 -1
- data/productions/examples/sandbox/teaser/players/fader.rb +1 -1
- data/productions/examples/sandbox/teaser/props.rb +1 -1
- data/productions/examples/sandbox/teaser/styles.rb +1 -1
- data/productions/examples/tutorials/tutorial_1/players/sample.rb +1 -1
- data/productions/examples/tutorials/tutorial_1/props.rb +1 -1
- data/productions/examples/tutorials/tutorial_1/styles.rb +1 -1
- data/productions/stage_composer/init.rb +1 -1
- data/productions/stage_composer/inspector/players/inspector.rb +1 -1
- data/productions/stage_composer/inspector/players/prop_row.rb +1 -1
- data/productions/stage_composer/inspector/players/prop_tree.rb +1 -1
- data/productions/stage_composer/inspector/players/style_table.rb +1 -1
- data/productions/stage_composer/inspector/players/style_value.rb +1 -1
- data/productions/stage_composer/inspector/props.rb +1 -1
- data/productions/stage_composer/inspector/styles.rb +1 -1
- data/productions/stage_composer/lib/init.rb +1 -1
- data/productions/stage_composer/lib/limelight/composer/controller.rb +1 -1
- data/productions/stage_composer/lib/limelight/composer/lethargy.rb +1 -1
- data/productions/stage_composer/production.rb +1 -1
- data/productions/stage_composer/stages.rb +1 -1
- data/productions/startup/production.rb +49 -0
- data/productions/startup/spec/default_scene/default_scene_spec.rb +13 -0
- data/productions/startup/spec/spec_helper.rb +5 -0
- data/productions/startup/stages.rb +5 -2
- data/productions/startup/styles.rb +12 -0
- data/productions/startup/welcome/players/browse_button.rb +1 -1
- data/productions/startup/welcome/players/download_button.rb +1 -1
- data/productions/startup/welcome/players/sandbox_button.rb +1 -1
- data/productions/startup/welcome/props.rb +2 -2
- data/productions/startup/welcome/styles.rb +1 -1
- data/spec/builtin/players/button_spec.rb +1 -1
- data/spec/builtin/players/check_box_spec.rb +1 -1
- data/spec/builtin/players/combo_box_spec.rb +1 -1
- data/spec/builtin/players/image_spec.rb +3 -0
- data/spec/builtin/players/password_box_spec.rb +1 -1
- data/spec/builtin/players/radio_button_spec.rb +7 -7
- data/spec/builtin/players/text_area_spec.rb +1 -1
- data/spec/builtin/players/text_box_spec.rb +1 -1
- data/spec/builtin/utilities_production/spec_helper.rb +4 -0
- data/spec/builtin/utilities_production/utilities_production_spec.rb +143 -0
- data/spec/casting_director_spec.rb +7 -7
- data/spec/client/playbills_spec.rb +3 -0
- data/spec/commands/command_spec.rb +9 -1
- data/spec/commands/create_command_spec.rb +35 -5
- data/spec/commands/freeze_command_spec.rb +3 -0
- data/spec/commands/help_command_spec.rb +6 -3
- data/spec/commands/open_command_spec.rb +24 -2
- data/spec/commands/pack_command_spec.rb +3 -0
- data/spec/commands/unpack_command_spec.rb +4 -1
- data/spec/data_spec.rb +5 -16
- data/spec/dsl/production_builder_spec.rb +1 -1
- data/spec/dsl/prop_builder_spec.rb +19 -19
- data/spec/dsl/stage_builder_spec.rb +1 -1
- data/spec/dsl/styles_builder_spec.rb +1 -1
- data/spec/file_chooser_spec.rb +1 -1
- data/spec/file_filter_spec.rb +1 -1
- data/spec/file_loader_spec.rb +1 -1
- data/spec/gems_spec.rb +3 -0
- data/spec/java_util_spec.rb +1 -1
- data/spec/main_spec.rb +4 -1
- data/spec/paint_action_spec.rb +1 -1
- data/spec/pen_spec.rb +1 -1
- data/spec/producer_spec.rb +73 -32
- data/spec/production_spec.rb +23 -44
- data/spec/prop_spec.rb +102 -64
- data/spec/scene_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -2
- data/spec/stage_spec.rb +172 -36
- data/spec/string_spec.rb +3 -0
- data/spec/studio_spec.rb +131 -3
- data/spec/styles_spec.rb +3 -0
- data/spec/templates/production_templater_spec.rb +12 -1
- data/spec/templates/scene_templater_spec.rb +17 -2
- data/spec/templates/templater_logger_spec.rb +3 -0
- data/spec/templates/templater_spec.rb +3 -0
- data/spec/theater_spec.rb +16 -1
- data/spec/util/downloader_spec.rb +3 -0
- metadata +56 -6
- data/lib/i4jruntime.jar +0 -0
- data/lib/junit-4.4.jar +0 -0
data/spec/prop_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
1
|
+
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
@@ -28,31 +28,43 @@ describe Limelight::Prop do
|
|
28
28
|
|
29
29
|
@prop.children.size.should == 1
|
30
30
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_method
|
31
|
+
|
32
|
+
module TestPlayer
|
33
|
+
class << self
|
34
|
+
attr_reader :extended_prop
|
35
|
+
|
36
|
+
def extended(prop)
|
37
|
+
@extended_prop = (prop)
|
42
38
|
end
|
43
39
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
|
41
|
+
def test_method
|
42
|
+
end
|
43
|
+
|
44
|
+
attr_reader :was_casted
|
45
|
+
def casted
|
46
|
+
@was_casted = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should extend added controllers and invoke the extended hook" do
|
51
|
+
@prop.include_player(TestPlayer)
|
52
|
+
|
53
|
+
TestPlayer.extended_prop.should == @prop
|
48
54
|
@prop.respond_to?(:test_method).should == true
|
49
55
|
end
|
50
|
-
|
56
|
+
|
57
|
+
it "should call the player's casted method" do
|
58
|
+
@prop.include_player(TestPlayer)
|
59
|
+
|
60
|
+
@prop.was_casted.should == true
|
61
|
+
end
|
62
|
+
|
51
63
|
it "should have an id" do
|
52
64
|
@prop.illuminate
|
53
65
|
@prop.id.should == "root"
|
54
66
|
end
|
55
|
-
|
67
|
+
|
56
68
|
def build_prop_tree
|
57
69
|
@child1 = Limelight::Prop.new(:id => "child1", :name => "child_class")
|
58
70
|
@child2 = Limelight::Prop.new(:id => "child2", :name => "child_class")
|
@@ -60,12 +72,12 @@ describe Limelight::Prop do
|
|
60
72
|
@grand_child2 = Limelight::Prop.new(:id => "grand_child2", :name => "grand_child_class")
|
61
73
|
@grand_child3 = Limelight::Prop.new(:id => "grand_child3", :name => "grand_child_class")
|
62
74
|
@grand_child4 = Limelight::Prop.new(:id => "grand_child4", :name => "grand_child_class")
|
63
|
-
|
75
|
+
|
64
76
|
@prop << @child1 << @child2
|
65
77
|
@child1 << @grand_child1 << @grand_child2
|
66
78
|
@child2 << @grand_child3 << @grand_child4
|
67
79
|
end
|
68
|
-
|
80
|
+
|
69
81
|
it "should find children by id" do
|
70
82
|
build_prop_tree
|
71
83
|
@scene.find("blah").should == nil
|
@@ -77,14 +89,14 @@ describe Limelight::Prop do
|
|
77
89
|
@scene.find("grand_child3").should be(@grand_child3)
|
78
90
|
@scene.find("grand_child4").should be(@grand_child4)
|
79
91
|
end
|
80
|
-
|
92
|
+
|
81
93
|
it "should find children by name" do
|
82
94
|
build_prop_tree
|
83
95
|
@prop.find_by_name("root_class").should == [@prop]
|
84
96
|
@prop.find_by_name("child_class").should == [@child1, @child2]
|
85
97
|
@prop.find_by_name("grand_child_class").should == [@grand_child1, @grand_child2, @grand_child3, @grand_child4]
|
86
98
|
end
|
87
|
-
|
99
|
+
|
88
100
|
it "should get and set text" do
|
89
101
|
@prop.text = "blah"
|
90
102
|
@prop.text.should == "blah"
|
@@ -93,77 +105,77 @@ describe Limelight::Prop do
|
|
93
105
|
@prop.text = nil
|
94
106
|
@prop.text.should == ""
|
95
107
|
end
|
96
|
-
|
108
|
+
|
97
109
|
it "should have controllers" do
|
98
110
|
prop = Limelight::Prop.new(:players => "abc, xyz")
|
99
111
|
@scene << prop
|
100
112
|
prop.players.should == "abc, xyz"
|
101
113
|
end
|
102
|
-
|
114
|
+
|
103
115
|
it "should get populated through constructor" do
|
104
116
|
prop = Limelight::Prop.new(:name => "my_name", :id => "123", :players => "a, b, c")
|
105
117
|
@scene << prop
|
106
|
-
|
118
|
+
|
107
119
|
prop.name.should == "my_name"
|
108
120
|
prop.id.should == "123"
|
109
121
|
end
|
110
|
-
|
122
|
+
|
111
123
|
it "should populate styles through constructor" do
|
112
124
|
prop = Limelight::Prop.new(:width => "100", :text_color => "white", :background_image => "apple.jpg")
|
113
125
|
@scene << prop
|
114
|
-
|
126
|
+
|
115
127
|
prop.style.width.should == "100"
|
116
128
|
prop.style.text_color.should == "#ffffffff"
|
117
129
|
prop.style.background_image.should == "apple.jpg"
|
118
130
|
end
|
119
|
-
|
131
|
+
|
120
132
|
it "should define event through constructor using a string" do
|
121
133
|
prop = Limelight::Prop.new(:on_mouse_entered => "return event")
|
122
134
|
@scene << prop
|
123
|
-
|
135
|
+
|
124
136
|
value = prop.mouse_entered("my event")
|
125
|
-
|
137
|
+
|
126
138
|
value.should == "my event"
|
127
139
|
end
|
128
|
-
|
140
|
+
|
129
141
|
it "should pass scene on to children" do
|
130
142
|
child = Limelight::Prop.new(:name => "child")
|
131
|
-
|
143
|
+
|
132
144
|
@prop.parent.should == @scene
|
133
145
|
@prop.scene.should == @scene
|
134
|
-
|
146
|
+
|
135
147
|
@prop << child
|
136
148
|
child.parent.should == @prop
|
137
149
|
child.scene.should == @scene
|
138
150
|
end
|
139
|
-
|
151
|
+
|
140
152
|
it "should set styles upon adding to parent" do
|
141
153
|
styles = Limelight::build_styles { child { width 123 } }
|
142
154
|
scene = Limelight::Scene.new(:casting_director => @casting_director, :styles => styles)
|
143
155
|
prop = Limelight::Prop.new(:name => "child")
|
144
156
|
scene.illuminate
|
145
|
-
|
157
|
+
|
146
158
|
scene << prop
|
147
|
-
|
159
|
+
|
148
160
|
prop.style.width.should == "123"
|
149
161
|
end
|
150
|
-
|
162
|
+
|
151
163
|
it "should set styles upon adding to parent" do
|
152
164
|
prop = Limelight::Prop.new(:name => "child")
|
153
|
-
|
165
|
+
|
154
166
|
@casting_director.should_receive(:fill_cast).with(prop)
|
155
|
-
|
167
|
+
|
156
168
|
@scene << prop
|
157
169
|
end
|
158
|
-
|
170
|
+
|
159
171
|
it "should use populate data included by players" do
|
160
172
|
prop = Limelight::Prop.new(:name => "child", :foo => "bar")
|
161
173
|
@casting_director.should_receive(:fill_cast).with(prop) do
|
162
174
|
prop.instance_eval "def foo=(value); @foo = value; end; def foo; return @foo; end;"
|
163
175
|
end
|
164
|
-
|
176
|
+
|
165
177
|
@scene << prop
|
166
|
-
|
178
|
+
|
167
179
|
prop.foo.should == "bar"
|
168
180
|
end
|
169
181
|
|
@@ -206,54 +218,54 @@ describe Limelight::Prop do
|
|
206
218
|
prop.hover_style.should == style2
|
207
219
|
prop.hover_style.should have_extension(style4)
|
208
220
|
end
|
209
|
-
|
221
|
+
|
210
222
|
it "should be able to remove children" do
|
211
223
|
child1 = Limelight::Prop.new()
|
212
224
|
child2 = Limelight::Prop.new()
|
213
225
|
child3 = Limelight::Prop.new()
|
214
226
|
@prop << child1 << child2 << child3
|
215
|
-
|
227
|
+
|
216
228
|
@prop.remove(child2)
|
217
|
-
|
229
|
+
|
218
230
|
@prop.children.length.should == 2
|
219
|
-
@prop.children.
|
231
|
+
@prop.children.include?(child2).should == false
|
220
232
|
@prop.panel.children.length.should == 2
|
221
|
-
@prop.panel.children.
|
233
|
+
@prop.panel.children.include?(child2.panel).should == false
|
222
234
|
end
|
223
|
-
|
235
|
+
|
224
236
|
it "should make dimensions accessible" do
|
225
237
|
@prop.panel.should_receive(:get_bounding_box).and_return("whole area")
|
226
238
|
@prop.panel.should_receive(:get_box_inside_borders).and_return("area inside borders")
|
227
|
-
|
239
|
+
|
228
240
|
@prop.area.should == "whole area"
|
229
241
|
@prop.bordered_area.should == "area inside borders"
|
230
242
|
end
|
231
|
-
|
243
|
+
|
232
244
|
it "should give you a pen" do
|
233
245
|
graphics = make_mock("graphics", :setColor => nil, :setStroke => nil, :setRenderingHint => nil)
|
234
246
|
@prop.panel.should_receive(:getGraphics).and_return(graphics)
|
235
|
-
|
247
|
+
|
236
248
|
pen = @prop.pen
|
237
|
-
|
249
|
+
|
238
250
|
pen.context.should be(graphics)
|
239
251
|
end
|
240
|
-
|
252
|
+
|
241
253
|
it "should set after paint action" do
|
242
254
|
block = Proc.new { |pen| }
|
243
|
-
|
255
|
+
|
244
256
|
@prop.after_painting &block
|
245
|
-
|
257
|
+
|
246
258
|
action = @prop.panel.after_paint_action
|
247
259
|
action.should_not == nil
|
248
260
|
action.class.should == Limelight::PaintAction
|
249
261
|
action.block.should == block
|
250
262
|
end
|
251
|
-
|
263
|
+
|
252
264
|
it "should clear after paint action" do
|
253
265
|
@prop.after_painting { |pen| puts "blah" }
|
254
|
-
|
266
|
+
|
255
267
|
@prop.after_painting nil
|
256
|
-
|
268
|
+
|
257
269
|
@prop.panel.after_paint_action.should == nil
|
258
270
|
end
|
259
271
|
|
@@ -265,7 +277,7 @@ describe Limelight::Prop do
|
|
265
277
|
three
|
266
278
|
end
|
267
279
|
end
|
268
|
-
|
280
|
+
|
269
281
|
@prop.children.length.should == 2
|
270
282
|
@prop.children[0].name.should == "one"
|
271
283
|
@prop.children[1].name.should == "two"
|
@@ -280,9 +292,9 @@ describe Limelight::Prop do
|
|
280
292
|
two do
|
281
293
|
three
|
282
294
|
end
|
283
|
-
|
295
|
+
|
284
296
|
end
|
285
|
-
|
297
|
+
|
286
298
|
@prop.children.length.should == 2
|
287
299
|
@prop.children[0].name.should == "one"
|
288
300
|
@prop.children[0].text.should == "hello"
|
@@ -329,14 +341,14 @@ describe Limelight::Prop do
|
|
329
341
|
@prop.accepts_mouse_released().should == false
|
330
342
|
@prop.instance_eval("def mouse_released(e); puts 'hi'; end;")
|
331
343
|
@prop.accepts_mouse_released().should == true
|
332
|
-
end
|
344
|
+
end
|
333
345
|
|
334
346
|
end
|
335
347
|
|
336
348
|
describe "id" do
|
337
349
|
|
338
350
|
it "should index its id when illuminated" do
|
339
|
-
@scene.find("root").should == @prop
|
351
|
+
@scene.find("root").should == @prop
|
340
352
|
end
|
341
353
|
|
342
354
|
it "should unindex ids when removing children" do
|
@@ -360,6 +372,32 @@ describe Limelight::Prop do
|
|
360
372
|
@scene.find("child2").should == nil
|
361
373
|
end
|
362
374
|
|
375
|
+
it "should unindex grandchildren on remove all" do
|
376
|
+
grandchild = Limelight::Prop.new(:id => "grandchild")
|
377
|
+
child = Limelight::Prop.new(:id => "child")
|
378
|
+
child << grandchild
|
379
|
+
@prop << child
|
380
|
+
|
381
|
+
@prop.remove_all
|
382
|
+
|
383
|
+
@scene.find("child").should == nil
|
384
|
+
@scene.find("grandchild").should == nil
|
385
|
+
end
|
386
|
+
|
363
387
|
end
|
364
|
-
|
388
|
+
|
389
|
+
describe "launch" do
|
390
|
+
|
391
|
+
it "should launch a url" do
|
392
|
+
os = mock("Limelight OS")
|
393
|
+
instance = mock("Limelight OS instance", :os => os)
|
394
|
+
Java::limelight.Context.stub!(:instance).and_return(instance)
|
395
|
+
|
396
|
+
os.should_receive(:launch).with("http://www.google.com")
|
397
|
+
|
398
|
+
@prop.launch("http://www.google.com")
|
399
|
+
end
|
400
|
+
|
401
|
+
end
|
402
|
+
|
365
403
|
end
|
data/spec/scene_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
1
|
+
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
@@ -135,7 +135,7 @@ describe Limelight::Scene do
|
|
135
135
|
|
136
136
|
@scene.find("grandchild_id").should == nil
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
it "should convert ids to string when finding" do
|
140
140
|
prop = Limelight::Prop.new(:id => 123)
|
141
141
|
@scene << prop
|
@@ -143,5 +143,5 @@ describe Limelight::Scene do
|
|
143
143
|
@scene.find(123).should == prop
|
144
144
|
end
|
145
145
|
end
|
146
|
-
|
146
|
+
|
147
147
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
1
|
+
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/../lib/init")
|
5
5
|
|
6
6
|
require 'spec'
|
7
7
|
|
8
|
+
Limelight::Main.new.configureTestContext
|
8
9
|
context = Limelight::Context.instance
|
9
|
-
context.frameManager = Java::limelight.ui.model.
|
10
|
+
context.frameManager = Java::limelight.ui.model.InertFrameManager.new
|
10
11
|
|
11
12
|
def make_mock(name, stubs = {})
|
12
13
|
the_mock = mock(name)
|
data/spec/stage_spec.rb
CHANGED
@@ -1,66 +1,202 @@
|
|
1
|
-
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
1
|
+
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
5
5
|
require 'limelight/stage'
|
6
|
+
require 'limelight/scene'
|
7
|
+
require 'limelight/theater'
|
8
|
+
require 'limelight/studio'
|
6
9
|
|
7
10
|
describe Limelight::Stage do
|
8
11
|
|
9
12
|
before(:each) do
|
10
|
-
@theater =
|
11
|
-
@
|
13
|
+
@theater = Limelight::Theater.new
|
14
|
+
@stage = @theater.add_stage("George")
|
15
|
+
@stage.should_remain_hidden = true
|
16
|
+
Limelight::Context.instance.frameManager = Java::limelight.ui.model.InertFrameManager.new
|
12
17
|
end
|
13
|
-
|
18
|
+
|
14
19
|
it "should have a name" do
|
15
20
|
stage = Limelight::Stage.new(@theater, "Jose")
|
16
21
|
stage.theater.should be(@theater)
|
17
22
|
stage.name.should == "Jose"
|
18
23
|
end
|
19
|
-
|
24
|
+
|
20
25
|
it "should have a title which default to it's name" do
|
21
|
-
@
|
22
|
-
|
23
|
-
@
|
24
|
-
|
25
|
-
@
|
26
|
+
@stage.title.should == "George"
|
27
|
+
|
28
|
+
@stage.title = "Once Upon a Test"
|
29
|
+
|
30
|
+
@stage.title.should == "Once Upon a Test"
|
26
31
|
end
|
27
|
-
|
32
|
+
|
28
33
|
it "should have size" do
|
29
|
-
@
|
30
|
-
|
31
|
-
@
|
32
|
-
|
33
|
-
|
34
|
+
@stage.size.should == ["500", "500"]
|
35
|
+
|
36
|
+
@stage.size = 123, 456
|
37
|
+
@stage.size.should == ["123", "456"]
|
38
|
+
|
39
|
+
@stage.size = [123, 456]
|
40
|
+
@stage.size.should == ["123", "456"]
|
41
|
+
|
42
|
+
@stage.size = "50%", "100%"
|
43
|
+
@stage.size.should == ["50%", "100%"]
|
34
44
|
end
|
35
|
-
|
45
|
+
|
36
46
|
it "should have location" do
|
37
|
-
@
|
38
|
-
|
39
|
-
@
|
40
|
-
|
41
|
-
|
47
|
+
@stage.location.should == ["center", "center"]
|
48
|
+
|
49
|
+
@stage.location = 123, 456
|
50
|
+
@stage.location.should == ["123", "456"]
|
51
|
+
|
52
|
+
@stage.location = [123, 456]
|
53
|
+
@stage.location.should == ["123", "456"]
|
54
|
+
|
55
|
+
@stage.location = "left", "top"
|
56
|
+
@stage.location.should == ["left", "top"]
|
57
|
+
|
58
|
+
@stage.location = "20%", "40%"
|
59
|
+
@stage.location.should == ["20%", "40%"]
|
42
60
|
end
|
43
|
-
|
61
|
+
|
44
62
|
it "should not allow name changes" do
|
45
|
-
lambda { @
|
63
|
+
lambda { @stage.name = "new name" }.should raise_error
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should set the background color" do
|
67
|
+
@stage.background_color = "red"
|
68
|
+
|
69
|
+
@stage.background_color.should == "#FF0000"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should be framed or not" do
|
73
|
+
@stage.framed = false
|
74
|
+
@stage.frame.should be_undecorated
|
75
|
+
@stage.should_not be_framed
|
76
|
+
|
77
|
+
@stage.framed = true
|
78
|
+
@stage.frame.should_not be_undecorated
|
79
|
+
@stage.should be_framed
|
46
80
|
end
|
47
81
|
|
48
|
-
it "should
|
49
|
-
|
50
|
-
|
82
|
+
it "should be always on top" do
|
83
|
+
@stage.always_on_top = true
|
84
|
+
@stage.should be_always_on_top
|
85
|
+
@stage.frame.should be_always_on_top
|
51
86
|
|
52
|
-
@
|
53
|
-
@
|
54
|
-
@
|
87
|
+
@stage.always_on_top = false
|
88
|
+
@stage.should_not be_always_on_top
|
89
|
+
@stage.frame.should_not be_always_on_top
|
55
90
|
end
|
56
91
|
|
57
|
-
it "should
|
58
|
-
|
59
|
-
|
92
|
+
it "should set kiosk mode" do
|
93
|
+
@stage.kiosk?.should == false
|
94
|
+
@stage.frame.should_not be_kiosk
|
95
|
+
|
96
|
+
@stage.kiosk = true
|
97
|
+
@stage.kiosk?.should == true
|
98
|
+
@stage.frame.should be_kiosk
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should ask the scene if close is allowed" do
|
102
|
+
@stage.should_allow_close.should == true
|
103
|
+
|
104
|
+
scene = mock("scene")
|
105
|
+
@stage.stub_current_scene scene
|
106
|
+
@stage.should_allow_close.should == true
|
107
|
+
|
108
|
+
scene.stub!(:allow_close?).and_return false
|
109
|
+
@stage.should_allow_close.should == false
|
110
|
+
|
111
|
+
scene.stub!(:allow_close?).and_return true
|
112
|
+
@stage.should_allow_close.should == true
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should allow contructor options" do
|
116
|
+
stage = Limelight::Stage.new(@theater, "Ringo", :framed => false, :background_color => "blue")
|
117
|
+
stage.framed?.should == false
|
118
|
+
stage.background_color.should == "#0000FF"
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should handle vitality" do
|
122
|
+
@stage.vital?.should == true
|
123
|
+
@stage.vital = false
|
124
|
+
@stage.vital?.should == false
|
125
|
+
@stage.frame.isVital.should == false
|
126
|
+
end
|
127
|
+
|
128
|
+
describe "when opening a scene" do
|
129
|
+
before(:each) do
|
130
|
+
@scene = Limelight::Scene.new
|
131
|
+
@scene.stub!(:illuminate)
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should call scene.scene_opened at the end of opening a scene" do
|
135
|
+
@scene.should_receive(:scene_opened)
|
136
|
+
|
137
|
+
@stage.open(@scene)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should illuminate the scene when opening it" do
|
141
|
+
@scene.should_receive(:illuminate)
|
142
|
+
|
143
|
+
@stage.open(@scene)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should set the stage on the scene" do
|
147
|
+
@scene.should_receive(:stage=).with(@stage)
|
148
|
+
|
149
|
+
@stage.open(@scene)
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should hide and show" do
|
153
|
+
@stage.open(@scene)
|
154
|
+
@stage.should_remain_hidden = false
|
155
|
+
@stage.frame.should_receive(:visible=).with(false)
|
156
|
+
@stage.hide
|
157
|
+
|
158
|
+
@stage.frame.should_receive(:visible=).with(true)
|
159
|
+
@stage.show
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should open the frame when opening" do
|
163
|
+
@stage.should_remain_hidden = false
|
164
|
+
@stage.frame.should_receive(:open)
|
165
|
+
|
166
|
+
@stage.open(@scene)
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should not open the frame when opening and in hidden mode" do
|
170
|
+
@stage.should_remain_hidden = true
|
171
|
+
@stage.frame.should_not_receive(:open)
|
172
|
+
|
173
|
+
@stage.open(@scene)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should clean up on close" do
|
177
|
+
@stage.open(@scene)
|
178
|
+
|
179
|
+
@stage.close
|
180
|
+
|
181
|
+
@scene.visible?.should == false
|
182
|
+
@stage.current_scene.should == nil
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should be removed from the theater when closed" do
|
186
|
+
@stage.open(@scene)
|
187
|
+
@theater["George"].should be(@stage)
|
188
|
+
|
189
|
+
@stage.close
|
190
|
+
@theater["George"].should == nil
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should open an alert" do
|
194
|
+
Limelight::Studio.utilities_production.should_receive(:alert).with("Some Message")
|
195
|
+
|
196
|
+
@stage.alert("Some Message")
|
197
|
+
sleep(0.01)
|
198
|
+
end
|
60
199
|
|
61
|
-
@__stage__.frame.stub!(:open)
|
62
|
-
@__stage__.stub!(:load_scene)
|
63
|
-
@__stage__.open(scene)
|
64
200
|
end
|
65
201
|
|
66
202
|
end
|
data/spec/string_spec.rb
CHANGED