limelight 0.2.1-java → 0.3.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ll.bat +1 -1
- data/lib/i4jruntime.jar +0 -0
- data/lib/junit-4.4.jar +0 -0
- data/lib/limelight.jar +0 -0
- data/lib/limelight/animation.rb +3 -3
- data/lib/limelight/builtin/players.rb +2 -1
- data/lib/limelight/builtin/players/combo_box.rb +8 -2
- data/lib/limelight/builtin/players/image.rb +47 -0
- data/lib/limelight/builtin/styles.rb +1 -1
- data/lib/limelight/casting_director.rb +70 -39
- data/lib/limelight/commands/command.rb +150 -0
- data/lib/limelight/commands/create_command.rb +79 -0
- data/lib/limelight/commands/freeze_command.rb +113 -0
- data/lib/limelight/commands/open_command.rb +49 -0
- data/lib/limelight/commands/pack_command.rb +45 -0
- data/lib/limelight/dsl/build_exception.rb +51 -0
- data/lib/limelight/dsl/menu_bar.rb +71 -0
- data/lib/limelight/dsl/production_builder.rb +71 -0
- data/lib/limelight/dsl/prop_builder.rb +155 -0
- data/lib/limelight/dsl/stage_builder.rb +105 -0
- data/lib/limelight/dsl/styles_builder.rb +134 -0
- data/lib/limelight/file_loader.rb +46 -0
- data/lib/limelight/gems.rb +45 -0
- data/lib/limelight/java_couplings.rb +7 -2
- data/lib/limelight/java_util.rb +2 -15
- data/lib/limelight/main.rb +7 -5
- data/lib/limelight/producer.rb +87 -66
- data/lib/limelight/production.rb +42 -4
- data/lib/limelight/prop.rb +84 -70
- data/lib/limelight/scene.rb +75 -20
- data/lib/limelight/specs/spec_helper.rb +58 -0
- data/lib/limelight/stage.rb +11 -6
- data/lib/limelight/string.rb +35 -0
- data/lib/limelight/studio.rb +29 -0
- data/lib/limelight/templates/production_templater.rb +42 -0
- data/lib/limelight/templates/scene_templater.rb +41 -0
- data/lib/limelight/templates/sources/freezing/limelight_init.rb.template +5 -0
- data/lib/limelight/templates/sources/production/init.rb.template +15 -0
- data/lib/limelight/templates/sources/production/production.rb.template +9 -0
- data/lib/limelight/templates/sources/production/stages.rb.template +17 -0
- data/lib/limelight/templates/sources/production/styles.rb.template +12 -0
- data/lib/limelight/templates/sources/scene/props.rb.template +6 -0
- data/lib/limelight/templates/sources/scene/styles.rb.template +18 -0
- data/lib/limelight/templates/templater.rb +128 -0
- data/lib/limelight/templates/templater_logger.rb +36 -0
- data/lib/limelight/theater.rb +21 -7
- data/lib/limelight/util.rb +22 -6
- data/lib/limelight/version.rb +2 -2
- data/productions/examples/8thlight.com/styles.rb +1 -1
- data/productions/examples/langstons_ant/html_javascript/ant.html +1 -1
- data/productions/examples/langstons_ant/init.rb +1 -0
- data/productions/examples/langstons_ant/players/log.rb +2 -2
- data/productions/examples/langstons_ant/players/world.rb +0 -26
- data/productions/examples/sandbox.llp +0 -0
- data/productions/examples/sandbox/click_me/players/chromaton.rb +10 -4
- data/productions/examples/sandbox/floaters/players/floater.rb +4 -2
- data/productions/examples/sandbox/gradients/players/spinner.rb +5 -1
- data/productions/examples/sandbox/gradients/players/teaser.rb +2 -2
- data/productions/examples/sandbox/gradients/players/wave.rb +2 -2
- data/productions/examples/sandbox/gradients/players/waves.rb +2 -2
- data/productions/examples/sandbox/header.rb +1 -0
- data/productions/examples/sandbox/images/logo.png +0 -0
- data/productions/examples/sandbox/images_scene/props.rb +25 -0
- data/productions/examples/sandbox/images_scene/styles.rb +30 -0
- data/productions/examples/sandbox/inputs/styles.rb +1 -1
- data/productions/examples/sandbox/scrolling/props.rb +12 -12
- data/productions/examples/sandbox/teaser/players/fader.rb +2 -8
- data/productions/stage_composer/inspector/styles.rb +2 -2
- data/productions/startup/styles.rb +2 -2
- data/spec/builtin/players/button_spec.rb +0 -1
- data/spec/builtin/players/image_spec.rb +41 -0
- data/spec/casting_director_spec.rb +114 -44
- data/spec/commands/command_spec.rb +18 -0
- data/spec/commands/create_command_spec.rb +74 -0
- data/spec/commands/freeze_command_spec.rb +59 -0
- data/spec/commands/open_command_spec.rb +30 -0
- data/spec/commands/pack_command_spec.rb +23 -0
- data/spec/dsl/production_builder_spec.rb +46 -0
- data/spec/{prop_builder_spec.rb → dsl/prop_builder_spec.rb} +80 -24
- data/spec/{stage_builder_spec.rb → dsl/stage_builder_spec.rb} +4 -4
- data/spec/{styles_builder_spec.rb → dsl/styles_builder_spec.rb} +6 -6
- data/spec/{loaders/file_loader_spec.rb → file_loader_spec.rb} +4 -4
- data/spec/gems_spec.rb +83 -0
- data/spec/java_util_spec.rb +1 -17
- data/spec/main_spec.rb +17 -0
- data/spec/producer_spec.rb +89 -79
- data/spec/production_spec.rb +28 -3
- data/spec/prop_spec.rb +82 -16
- data/spec/scene_spec.rb +73 -3
- data/spec/spec_helper.rb +37 -1
- data/spec/stage_spec.rb +10 -1
- data/spec/string_spec.rb +35 -0
- data/spec/studio_spec.rb +14 -0
- data/spec/styles_spec.rb +14 -0
- data/spec/templates/production_templater_spec.rb +44 -0
- data/spec/templates/scene_templater_spec.rb +25 -0
- data/spec/templates/templater_logger_spec.rb +38 -0
- data/spec/templates/templater_spec.rb +104 -0
- data/spec/theater_spec.rb +12 -21
- metadata +75 -23
- data/bin/icons/splash.png +0 -0
- data/lib/limelight/build_exception.rb +0 -48
- data/lib/limelight/commands.rb +0 -52
- data/lib/limelight/loaders/file_scene_loader.rb +0 -49
- data/lib/limelight/menu_bar.rb +0 -68
- data/lib/limelight/production_builder.rb +0 -66
- data/lib/limelight/prop_builder.rb +0 -119
- data/lib/limelight/stage_builder.rb +0 -103
- data/lib/limelight/styles_builder.rb +0 -131
- data/spec/commands_spec.rb +0 -34
- data/spec/production_builder_spec.rb +0 -48
data/spec/java_util_spec.rb
CHANGED
|
@@ -34,20 +34,4 @@ describe Class do
|
|
|
34
34
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
it "should convert into camel case" do
|
|
40
|
-
"class_name".camalized.should == "ClassName"
|
|
41
|
-
"once_upon_a_time".camalized.should == "OnceUponATime"
|
|
42
|
-
"AbC_eFg_hiJ".camalized.should == "AbcEfgHij"
|
|
43
|
-
"with spaces".camalized.should == "WithSpaces"
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "should convert into camel case" do
|
|
47
|
-
"class_name".camalized(:lower).should == "className"
|
|
48
|
-
"once_upon_a_time".camalized(:lower).should == "onceUponATime"
|
|
49
|
-
"AbC_eFg_hiJ".camalized(:lower).should == "abcEfgHij"
|
|
50
|
-
"with spaces".camalized(:lower).should == "withSpaces"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
end
|
|
37
|
+
|
data/spec/main_spec.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
|
2
|
+
require 'limelight/main'
|
|
3
|
+
|
|
4
|
+
describe Limelight::Main do
|
|
5
|
+
|
|
6
|
+
it "should run the specified command" do
|
|
7
|
+
command_class = make_mock("command_class")
|
|
8
|
+
command = make_mock("command")
|
|
9
|
+
|
|
10
|
+
Limelight::Commands.should_receive(:[]).with("mock").and_return(command_class)
|
|
11
|
+
command_class.should_receive(:new).and_return(command)
|
|
12
|
+
command.should_receive(:run).with(["1", "2", "3"])
|
|
13
|
+
|
|
14
|
+
Limelight::Main.run(["mock", "1", "2", "3"])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
data/spec/producer_spec.rb
CHANGED
|
@@ -5,163 +5,173 @@ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
|
|
5
5
|
require 'limelight/producer'
|
|
6
6
|
|
|
7
7
|
describe Limelight::Producer do
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
before(:each) do
|
|
10
|
+
TestDir.clean
|
|
10
11
|
Limelight::Production.clear_index
|
|
11
|
-
@
|
|
12
|
-
@
|
|
12
|
+
@root_dir = TestDir.path("test_prod")
|
|
13
|
+
@producer = Limelight::Producer.new(@root_dir)
|
|
13
14
|
end
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
it "should have loader on creation" do
|
|
16
|
-
@producer.
|
|
17
|
+
@producer.production.root.root.should == @root_dir
|
|
17
18
|
end
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
it "should take an optional theater on creation" do
|
|
20
21
|
theater = make_mock("theater")
|
|
21
22
|
producer = Limelight::Producer.new("/tmp", theater)
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
producer.theater.should == theater
|
|
24
25
|
end
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
it "should build a new theater if none is passing in constructor" do
|
|
27
28
|
@producer.theater.should_not == nil
|
|
28
29
|
@producer.theater.class.should == Limelight::Theater
|
|
29
30
|
end
|
|
30
|
-
|
|
31
|
+
|
|
31
32
|
it "should load props" do
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
scene
|
|
33
|
+
TestDir.create_file("test_prod/props.rb", "child :id => 321")
|
|
34
|
+
|
|
35
|
+
scene = @producer.load_props(:path => TestDir.path("test_prod"), :casting_director => make_mock("casting_director", :fill_cast => nil))
|
|
36
|
+
scene.illuminate
|
|
36
37
|
scene.children.size.should == 1
|
|
37
38
|
scene.children[0].name.should == "child"
|
|
38
|
-
scene.children[0].id.should == 321
|
|
39
|
+
scene.children[0].id.should == "321"
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
it "should load props even when props.rd doesn't exist." do
|
|
42
|
-
@
|
|
43
|
-
|
|
44
|
-
scene = @producer.load_props(".", :casting_director => make_mock("casting_director", :fill_cast => nil))
|
|
43
|
+
scene = @producer.load_props(:path => TestDir.path("test_prod"), :casting_director => make_mock("casting_director", :fill_cast => nil))
|
|
45
44
|
scene.children.size.should == 0
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
it "should load builtin styles" do
|
|
49
|
-
@
|
|
50
|
-
|
|
51
|
-
styles = @producer.load_styles(".")
|
|
48
|
+
styles = @producer.load_styles(Limelight::Scene.new())
|
|
52
49
|
|
|
53
50
|
styles["limelight_builtin_players_combo_box_popup_list"].should_not == nil
|
|
54
51
|
end
|
|
55
|
-
|
|
52
|
+
|
|
56
53
|
it "should load styles" do
|
|
54
|
+
TestDir.create_file("test_prod/styles.rb", "alpha { width 100 }")
|
|
57
55
|
@producer.builtin_styles = {}
|
|
58
|
-
|
|
59
|
-
@
|
|
60
|
-
|
|
61
|
-
styles = @producer.load_styles(".")
|
|
56
|
+
|
|
57
|
+
styles = @producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod")))
|
|
62
58
|
styles.size.should == 1
|
|
63
59
|
styles["alpha"].width.should == "100"
|
|
64
60
|
end
|
|
65
|
-
|
|
61
|
+
|
|
66
62
|
it "should format prop errors well" do
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
TestDir.create_file("test_prod/props.rb", "one\n+\nthree")
|
|
64
|
+
|
|
70
65
|
begin
|
|
71
|
-
result = @producer.load_props(
|
|
66
|
+
result = @producer.load_props(:path => TestDir.path("test_prod"), :casting_director => make_mock("casting_director", :fill_cast => nil))
|
|
72
67
|
result.should == nil # should never perform
|
|
73
|
-
rescue Limelight::BuildException => e
|
|
68
|
+
rescue Limelight::DSL::BuildException => e
|
|
74
69
|
e.line_number.should == 3
|
|
75
|
-
e.filename.should == "
|
|
76
|
-
e.message.should include("
|
|
70
|
+
e.filename.should == TestDir.path("test_prod/props.rb")
|
|
71
|
+
e.message.should include("/props.rb:3: undefined method `+@' for ")
|
|
77
72
|
end
|
|
78
73
|
end
|
|
79
|
-
|
|
74
|
+
|
|
80
75
|
it "should format styles errors well" do
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
TestDir.create_file("test_prod/styles.rb", "one {}\ntwo {}\n-\nthree {}")
|
|
77
|
+
|
|
84
78
|
begin
|
|
85
|
-
result = @producer.load_styles(
|
|
79
|
+
result = @producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod")))
|
|
86
80
|
result.should == nil # should never perform
|
|
87
|
-
rescue Limelight::BuildException => e
|
|
81
|
+
rescue Limelight::DSL::BuildException => e
|
|
88
82
|
e.line_number.should == 4
|
|
89
|
-
e.filename.should == "
|
|
90
|
-
e.message.should include("
|
|
83
|
+
e.filename.should == TestDir.path("test_prod/styles.rb")
|
|
84
|
+
e.message.should include("/styles.rb:4: undefined method `-@' for #<Java::LimelightStyles::RichStyle:0x")
|
|
91
85
|
end
|
|
92
86
|
end
|
|
93
|
-
|
|
87
|
+
|
|
94
88
|
it "should load a stage when stages.rb exists" do
|
|
95
|
-
|
|
96
|
-
@loader.should_receive(:exists?).with("init.rb").and_return(false)
|
|
97
|
-
@loader.should_receive(:exists?).with("stages.rb").and_return true
|
|
98
|
-
@producer.should_receive(:load_stages).and_return([make_mock("stage", :default_scene => "abc", :name => "Default")])
|
|
89
|
+
TestDir.create_file("test_prod/stages.rb", "stage 'Default' do\n default_scene 'abc'\n end")
|
|
99
90
|
@producer.should_receive(:open_scene).with("abc", anything)
|
|
100
|
-
|
|
91
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
92
|
+
|
|
101
93
|
@producer.open
|
|
102
94
|
end
|
|
103
|
-
|
|
95
|
+
|
|
104
96
|
it "should load a scene when stages.rb doesn't exists" do
|
|
105
|
-
@loader.should_receive(:exists?).with("production.rb").and_return(false)
|
|
106
|
-
@loader.should_receive(:exists?).with("init.rb").and_return(false)
|
|
107
|
-
@loader.should_receive(:exists?).with("stages.rb").and_return false
|
|
108
97
|
@producer.should_not_receive(:open_stages)
|
|
109
|
-
@producer.should_receive(:open_scene).with(
|
|
110
|
-
|
|
98
|
+
@producer.should_receive(:open_scene).with(:root, anything)
|
|
99
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
100
|
+
|
|
111
101
|
@producer.open
|
|
112
102
|
end
|
|
113
|
-
|
|
103
|
+
|
|
114
104
|
it "should have one default stage when no stages.rb is provided" do
|
|
115
|
-
@loader.should_receive(:exists?).with("production.rb").and_return(false)
|
|
116
|
-
@loader.should_receive(:exists?).with("init.rb").and_return(false)
|
|
117
|
-
@loader.should_receive(:exists?).with("stages.rb").and_return false
|
|
118
105
|
@producer.stub!(:open_scene)
|
|
119
|
-
|
|
106
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
107
|
+
|
|
120
108
|
@producer.open
|
|
121
|
-
|
|
109
|
+
|
|
122
110
|
@producer.theater.stages.size.should == 1
|
|
123
111
|
@producer.theater["Limelight"].should_not == nil
|
|
124
112
|
end
|
|
125
|
-
|
|
113
|
+
|
|
114
|
+
it "should load a stage but not open it if it has no default scene" do
|
|
115
|
+
TestDir.create_file("test_prod/stages.rb", "stage 'Default' do\n default_scene 'abc'\n end\n\nstage 'Hidden' do\n default_scene nil\n end")
|
|
116
|
+
@producer.should_receive(:open_scene).with("abc", anything)
|
|
117
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
118
|
+
|
|
119
|
+
@producer.open
|
|
120
|
+
end
|
|
121
|
+
|
|
126
122
|
it "should open a scene" do
|
|
127
123
|
stage = make_mock("stage")
|
|
128
124
|
scene = make_mock("scene")
|
|
125
|
+
@producer.should_receive(:load_props).with(:production => @producer.production, :casting_director => anything, :path => TestDir.path("test_prod/name"), :name => "name").and_return(scene)
|
|
129
126
|
@producer.should_receive(:load_styles).and_return("styles")
|
|
130
127
|
@producer.should_receive(:merge_with_root_styles).with("styles")
|
|
131
|
-
|
|
128
|
+
scene.should_receive(:styles=)
|
|
132
129
|
stage.should_receive(:open).with(scene)
|
|
133
|
-
|
|
134
|
-
@producer.open_scene("
|
|
130
|
+
|
|
131
|
+
@producer.open_scene("name", stage)
|
|
135
132
|
end
|
|
136
|
-
|
|
133
|
+
|
|
137
134
|
it "should load empty styles if styles.rb doesn't exist" do
|
|
138
135
|
@producer.builtin_styles = {}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
@producer.load_styles(".").should == {}
|
|
136
|
+
|
|
137
|
+
@producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod"))).should == {}
|
|
142
138
|
end
|
|
143
139
|
|
|
144
140
|
it "should use the ProductionBuilder if production.rb is present" do
|
|
145
|
-
|
|
146
|
-
@loader.should_receive(:exists?).with("init.rb").and_return(false)
|
|
147
|
-
@loader.should_receive(:load).with("production.rb").and_return("name 'Fido'")
|
|
148
|
-
@loader.should_receive(:exists?).with("stages.rb").and_return(false)
|
|
141
|
+
TestDir.create_file("test_prod/production.rb", "name 'Fido'")
|
|
149
142
|
@producer.stub!(:open_scene)
|
|
143
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
150
144
|
|
|
151
145
|
@producer.open
|
|
152
146
|
|
|
153
147
|
@producer.production.name.should == "Fido"
|
|
154
148
|
end
|
|
155
|
-
|
|
149
|
+
|
|
156
150
|
it "should load init.rb if it exists" do
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
@loader.should_receive(:exists?).with("stages.rb").and_return(false)
|
|
151
|
+
TestDir.create_file("test_prod/production.rb", "name 'Fido'")
|
|
152
|
+
TestDir.create_file("test_prod/init.rb", "")
|
|
153
|
+
|
|
161
154
|
@producer.stub!(:open_scene)
|
|
162
|
-
Kernel.should_receive(:load).with("/
|
|
163
|
-
|
|
155
|
+
Kernel.should_receive(:load).with(TestDir.path("test_prod/init.rb"))
|
|
156
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
157
|
+
|
|
164
158
|
@producer.open
|
|
165
159
|
end
|
|
166
|
-
|
|
160
|
+
|
|
161
|
+
it "should not load init.rb when told not to" do
|
|
162
|
+
TestDir.create_file("test_prod/init.rb", "$init_loaded = true")
|
|
163
|
+
Limelight::Gems.should_receive(:install_gems_in_production)
|
|
164
|
+
|
|
165
|
+
$init_loaded = false;
|
|
166
|
+
@producer.load(:ignore_init => true)
|
|
167
|
+
|
|
168
|
+
$init_loaded.should == false;
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "should give the same buildin_styles hash twice" do
|
|
172
|
+
@producer.builtin_styles.should_not be(@producer.builtin_styles)
|
|
173
|
+
# Try again
|
|
174
|
+
@producer.builtin_styles.should_not be(@producer.builtin_styles)
|
|
175
|
+
end
|
|
176
|
+
|
|
167
177
|
end
|
data/spec/production_spec.rb
CHANGED
|
@@ -9,12 +9,15 @@ describe Limelight::Production, "Instance methods" do
|
|
|
9
9
|
before(:each) do
|
|
10
10
|
@producer = make_mock("producer")
|
|
11
11
|
@theater = make_mock("theater")
|
|
12
|
-
@production = Limelight::Production.new(
|
|
12
|
+
@production = Limelight::Production.new("/tmp")
|
|
13
|
+
@production.producer = @producer
|
|
14
|
+
@production.theater = @theater
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
it "should know it
|
|
17
|
+
it "should know it path, producer, and theater" do
|
|
16
18
|
@production.producer.should == @producer
|
|
17
19
|
@production.theater.should == @theater
|
|
20
|
+
@production.path.should == "/tmp"
|
|
18
21
|
end
|
|
19
22
|
|
|
20
23
|
it "should be indexed" do
|
|
@@ -24,10 +27,32 @@ describe Limelight::Production, "Instance methods" do
|
|
|
24
27
|
it "should raise an error when setting the name to a duplicate name" do
|
|
25
28
|
@production.name = "Bill"
|
|
26
29
|
|
|
27
|
-
production = Limelight::Production.new(
|
|
30
|
+
production = Limelight::Production.new("/tmp")
|
|
28
31
|
lambda { production.name = "Bill" }.should raise_error(Limelight::LimelightException, "Production name 'Bill' is already taken")
|
|
29
32
|
end
|
|
30
33
|
|
|
34
|
+
it "should know it's init file" do
|
|
35
|
+
@production.init_file.should == "/tmp/init.rb"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should know it's stages file" do
|
|
39
|
+
@production.stages_file.should == "/tmp/stages.rb"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should know it's styles file" do
|
|
43
|
+
@production.styles_file.should == "/tmp/styles.rb"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should know it's gems directory" do
|
|
47
|
+
@production.gems_directory.should == "/tmp/__resources/gems"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should provide paths to it's scenes" do
|
|
51
|
+
@production.scene_directory("one").should == "/tmp/one"
|
|
52
|
+
@production.scene_directory("two").should == "/tmp/two"
|
|
53
|
+
@production.scene_directory(:root).should == "/tmp"
|
|
54
|
+
end
|
|
55
|
+
|
|
31
56
|
end
|
|
32
57
|
|
|
33
58
|
describe Limelight::Production, "Class methods" do
|
data/spec/prop_spec.rb
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
|
5
5
|
require 'limelight/prop'
|
|
6
|
-
require 'limelight/styles_builder'
|
|
6
|
+
require 'limelight/dsl/styles_builder'
|
|
7
7
|
require 'limelight/scene'
|
|
8
|
+
require 'limelight/production'
|
|
8
9
|
|
|
9
10
|
describe Limelight::Prop do
|
|
10
11
|
|
|
@@ -12,6 +13,7 @@ describe Limelight::Prop do
|
|
|
12
13
|
@casting_director = make_mock("casting_director", :fill_cast => nil)
|
|
13
14
|
@scene = Limelight::Scene.new(:casting_director => @casting_director)
|
|
14
15
|
@prop = Limelight::Prop.new(:id => "root", :name => "root_class")
|
|
16
|
+
@scene.illuminate
|
|
15
17
|
@scene << @prop
|
|
16
18
|
end
|
|
17
19
|
|
|
@@ -47,6 +49,7 @@ describe Limelight::Prop do
|
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
it "should have an id" do
|
|
52
|
+
@prop.illuminate
|
|
50
53
|
@prop.id.should == "root"
|
|
51
54
|
end
|
|
52
55
|
|
|
@@ -65,14 +68,14 @@ describe Limelight::Prop do
|
|
|
65
68
|
|
|
66
69
|
it "should find children by id" do
|
|
67
70
|
build_prop_tree
|
|
68
|
-
@
|
|
69
|
-
@
|
|
70
|
-
@
|
|
71
|
-
@
|
|
72
|
-
@
|
|
73
|
-
@
|
|
74
|
-
@
|
|
75
|
-
@
|
|
71
|
+
@scene.find("blah").should == nil
|
|
72
|
+
@scene.find("root").should be(@prop)
|
|
73
|
+
@scene.find("child1").should be(@child1)
|
|
74
|
+
@scene.find("child2").should be(@child2)
|
|
75
|
+
@scene.find("grand_child1").should be(@grand_child1)
|
|
76
|
+
@scene.find("grand_child2").should be(@grand_child2)
|
|
77
|
+
@scene.find("grand_child3").should be(@grand_child3)
|
|
78
|
+
@scene.find("grand_child4").should be(@grand_child4)
|
|
76
79
|
end
|
|
77
80
|
|
|
78
81
|
it "should find children by name" do
|
|
@@ -110,7 +113,7 @@ describe Limelight::Prop do
|
|
|
110
113
|
@scene << prop
|
|
111
114
|
|
|
112
115
|
prop.style.width.should == "100"
|
|
113
|
-
prop.style.text_color.should == "
|
|
116
|
+
prop.style.text_color.should == "#ffffffff"
|
|
114
117
|
prop.style.background_image.should == "apple.jpg"
|
|
115
118
|
end
|
|
116
119
|
|
|
@@ -138,6 +141,7 @@ describe Limelight::Prop do
|
|
|
138
141
|
styles = Limelight::build_styles { child { width 123 } }
|
|
139
142
|
scene = Limelight::Scene.new(:casting_director => @casting_director, :styles => styles)
|
|
140
143
|
prop = Limelight::Prop.new(:name => "child")
|
|
144
|
+
scene.illuminate
|
|
141
145
|
|
|
142
146
|
scene << prop
|
|
143
147
|
|
|
@@ -218,7 +222,7 @@ describe Limelight::Prop do
|
|
|
218
222
|
end
|
|
219
223
|
|
|
220
224
|
it "should make dimensions accessible" do
|
|
221
|
-
@prop.panel.should_receive(:
|
|
225
|
+
@prop.panel.should_receive(:get_bounding_box).and_return("whole area")
|
|
222
226
|
@prop.panel.should_receive(:get_box_inside_borders).and_return("area inside borders")
|
|
223
227
|
|
|
224
228
|
@prop.area.should == "whole area"
|
|
@@ -252,8 +256,9 @@ describe Limelight::Prop do
|
|
|
252
256
|
|
|
253
257
|
@prop.panel.after_paint_action.should == nil
|
|
254
258
|
end
|
|
255
|
-
|
|
259
|
+
|
|
256
260
|
it "should build children" do
|
|
261
|
+
@prop.scene.production = Limelight::Production.new("some/path")
|
|
257
262
|
@prop.build do
|
|
258
263
|
one
|
|
259
264
|
two do
|
|
@@ -269,13 +274,74 @@ describe Limelight::Prop do
|
|
|
269
274
|
end
|
|
270
275
|
|
|
271
276
|
it "should play sound" do
|
|
272
|
-
|
|
273
|
-
@scene.
|
|
274
|
-
|
|
277
|
+
production = Limelight::Production.new("/blah")
|
|
278
|
+
@scene.production = production
|
|
279
|
+
production.root.should_receive(:path_to).with("some.au").and_return("/full/path/to/some.au");
|
|
275
280
|
@prop.panel.should_receive(:play_sound).with("/full/path/to/some.au");
|
|
276
281
|
|
|
277
282
|
@prop.play_sound("some.au")
|
|
278
283
|
end
|
|
284
|
+
|
|
285
|
+
it "should remember when it has been illuminated" do
|
|
286
|
+
prop = Limelight::Prop.new
|
|
287
|
+
prop.illuminated?.should == false
|
|
288
|
+
|
|
289
|
+
@scene << prop
|
|
290
|
+
|
|
291
|
+
prop.illuminated?.should == true;
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
#TODO remove_all should not remove scrollbars
|
|
295
|
+
|
|
296
|
+
describe "events" do
|
|
297
|
+
|
|
298
|
+
it "should not accept mouse_clicked events to start with" do
|
|
299
|
+
@prop.accepts_mouse_clicked().should == false
|
|
300
|
+
@prop.instance_eval("def mouse_clicked(e); puts 'hi'; end;")
|
|
301
|
+
@prop.accepts_mouse_clicked().should == true
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
it "should not accept mouse_pressed events to start with" do
|
|
305
|
+
@prop.accepts_mouse_pressed().should == false
|
|
306
|
+
@prop.instance_eval("def mouse_pressed(e); puts 'hi'; end;")
|
|
307
|
+
@prop.accepts_mouse_pressed().should == true
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
it "should not accept mouse_released events to start with" do
|
|
311
|
+
@prop.accepts_mouse_released().should == false
|
|
312
|
+
@prop.instance_eval("def mouse_released(e); puts 'hi'; end;")
|
|
313
|
+
@prop.accepts_mouse_released().should == true
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
describe "id" do
|
|
319
|
+
|
|
320
|
+
it "should index its id when illuminated" do
|
|
321
|
+
@scene.find("root").should == @prop
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
it "should unindex ids when removing children" do
|
|
325
|
+
child = Limelight::Prop.new(:id => "child")
|
|
326
|
+
@prop << child
|
|
327
|
+
@scene.find("child").should == child
|
|
328
|
+
|
|
329
|
+
@prop.remove(child)
|
|
330
|
+
|
|
331
|
+
@scene.find("child").should == nil
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
it "should unindex ids when removing all children" do
|
|
335
|
+
child1 = Limelight::Prop.new(:id => "child1")
|
|
336
|
+
child2 = Limelight::Prop.new(:id => "child2")
|
|
337
|
+
@prop << child1 << child2
|
|
338
|
+
|
|
339
|
+
@prop.remove_all
|
|
340
|
+
|
|
341
|
+
@scene.find("child1").should == nil
|
|
342
|
+
@scene.find("child2").should == nil
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
end
|
|
279
346
|
|
|
280
347
|
end
|
|
281
|
-
|