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.
Files changed (111) hide show
  1. data/bin/ll.bat +1 -1
  2. data/lib/i4jruntime.jar +0 -0
  3. data/lib/junit-4.4.jar +0 -0
  4. data/lib/limelight.jar +0 -0
  5. data/lib/limelight/animation.rb +3 -3
  6. data/lib/limelight/builtin/players.rb +2 -1
  7. data/lib/limelight/builtin/players/combo_box.rb +8 -2
  8. data/lib/limelight/builtin/players/image.rb +47 -0
  9. data/lib/limelight/builtin/styles.rb +1 -1
  10. data/lib/limelight/casting_director.rb +70 -39
  11. data/lib/limelight/commands/command.rb +150 -0
  12. data/lib/limelight/commands/create_command.rb +79 -0
  13. data/lib/limelight/commands/freeze_command.rb +113 -0
  14. data/lib/limelight/commands/open_command.rb +49 -0
  15. data/lib/limelight/commands/pack_command.rb +45 -0
  16. data/lib/limelight/dsl/build_exception.rb +51 -0
  17. data/lib/limelight/dsl/menu_bar.rb +71 -0
  18. data/lib/limelight/dsl/production_builder.rb +71 -0
  19. data/lib/limelight/dsl/prop_builder.rb +155 -0
  20. data/lib/limelight/dsl/stage_builder.rb +105 -0
  21. data/lib/limelight/dsl/styles_builder.rb +134 -0
  22. data/lib/limelight/file_loader.rb +46 -0
  23. data/lib/limelight/gems.rb +45 -0
  24. data/lib/limelight/java_couplings.rb +7 -2
  25. data/lib/limelight/java_util.rb +2 -15
  26. data/lib/limelight/main.rb +7 -5
  27. data/lib/limelight/producer.rb +87 -66
  28. data/lib/limelight/production.rb +42 -4
  29. data/lib/limelight/prop.rb +84 -70
  30. data/lib/limelight/scene.rb +75 -20
  31. data/lib/limelight/specs/spec_helper.rb +58 -0
  32. data/lib/limelight/stage.rb +11 -6
  33. data/lib/limelight/string.rb +35 -0
  34. data/lib/limelight/studio.rb +29 -0
  35. data/lib/limelight/templates/production_templater.rb +42 -0
  36. data/lib/limelight/templates/scene_templater.rb +41 -0
  37. data/lib/limelight/templates/sources/freezing/limelight_init.rb.template +5 -0
  38. data/lib/limelight/templates/sources/production/init.rb.template +15 -0
  39. data/lib/limelight/templates/sources/production/production.rb.template +9 -0
  40. data/lib/limelight/templates/sources/production/stages.rb.template +17 -0
  41. data/lib/limelight/templates/sources/production/styles.rb.template +12 -0
  42. data/lib/limelight/templates/sources/scene/props.rb.template +6 -0
  43. data/lib/limelight/templates/sources/scene/styles.rb.template +18 -0
  44. data/lib/limelight/templates/templater.rb +128 -0
  45. data/lib/limelight/templates/templater_logger.rb +36 -0
  46. data/lib/limelight/theater.rb +21 -7
  47. data/lib/limelight/util.rb +22 -6
  48. data/lib/limelight/version.rb +2 -2
  49. data/productions/examples/8thlight.com/styles.rb +1 -1
  50. data/productions/examples/langstons_ant/html_javascript/ant.html +1 -1
  51. data/productions/examples/langstons_ant/init.rb +1 -0
  52. data/productions/examples/langstons_ant/players/log.rb +2 -2
  53. data/productions/examples/langstons_ant/players/world.rb +0 -26
  54. data/productions/examples/sandbox.llp +0 -0
  55. data/productions/examples/sandbox/click_me/players/chromaton.rb +10 -4
  56. data/productions/examples/sandbox/floaters/players/floater.rb +4 -2
  57. data/productions/examples/sandbox/gradients/players/spinner.rb +5 -1
  58. data/productions/examples/sandbox/gradients/players/teaser.rb +2 -2
  59. data/productions/examples/sandbox/gradients/players/wave.rb +2 -2
  60. data/productions/examples/sandbox/gradients/players/waves.rb +2 -2
  61. data/productions/examples/sandbox/header.rb +1 -0
  62. data/productions/examples/sandbox/images/logo.png +0 -0
  63. data/productions/examples/sandbox/images_scene/props.rb +25 -0
  64. data/productions/examples/sandbox/images_scene/styles.rb +30 -0
  65. data/productions/examples/sandbox/inputs/styles.rb +1 -1
  66. data/productions/examples/sandbox/scrolling/props.rb +12 -12
  67. data/productions/examples/sandbox/teaser/players/fader.rb +2 -8
  68. data/productions/stage_composer/inspector/styles.rb +2 -2
  69. data/productions/startup/styles.rb +2 -2
  70. data/spec/builtin/players/button_spec.rb +0 -1
  71. data/spec/builtin/players/image_spec.rb +41 -0
  72. data/spec/casting_director_spec.rb +114 -44
  73. data/spec/commands/command_spec.rb +18 -0
  74. data/spec/commands/create_command_spec.rb +74 -0
  75. data/spec/commands/freeze_command_spec.rb +59 -0
  76. data/spec/commands/open_command_spec.rb +30 -0
  77. data/spec/commands/pack_command_spec.rb +23 -0
  78. data/spec/dsl/production_builder_spec.rb +46 -0
  79. data/spec/{prop_builder_spec.rb → dsl/prop_builder_spec.rb} +80 -24
  80. data/spec/{stage_builder_spec.rb → dsl/stage_builder_spec.rb} +4 -4
  81. data/spec/{styles_builder_spec.rb → dsl/styles_builder_spec.rb} +6 -6
  82. data/spec/{loaders/file_loader_spec.rb → file_loader_spec.rb} +4 -4
  83. data/spec/gems_spec.rb +83 -0
  84. data/spec/java_util_spec.rb +1 -17
  85. data/spec/main_spec.rb +17 -0
  86. data/spec/producer_spec.rb +89 -79
  87. data/spec/production_spec.rb +28 -3
  88. data/spec/prop_spec.rb +82 -16
  89. data/spec/scene_spec.rb +73 -3
  90. data/spec/spec_helper.rb +37 -1
  91. data/spec/stage_spec.rb +10 -1
  92. data/spec/string_spec.rb +35 -0
  93. data/spec/studio_spec.rb +14 -0
  94. data/spec/styles_spec.rb +14 -0
  95. data/spec/templates/production_templater_spec.rb +44 -0
  96. data/spec/templates/scene_templater_spec.rb +25 -0
  97. data/spec/templates/templater_logger_spec.rb +38 -0
  98. data/spec/templates/templater_spec.rb +104 -0
  99. data/spec/theater_spec.rb +12 -21
  100. metadata +75 -23
  101. data/bin/icons/splash.png +0 -0
  102. data/lib/limelight/build_exception.rb +0 -48
  103. data/lib/limelight/commands.rb +0 -52
  104. data/lib/limelight/loaders/file_scene_loader.rb +0 -49
  105. data/lib/limelight/menu_bar.rb +0 -68
  106. data/lib/limelight/production_builder.rb +0 -66
  107. data/lib/limelight/prop_builder.rb +0 -119
  108. data/lib/limelight/stage_builder.rb +0 -103
  109. data/lib/limelight/styles_builder.rb +0 -131
  110. data/spec/commands_spec.rb +0 -34
  111. data/spec/production_builder_spec.rb +0 -48
@@ -34,20 +34,4 @@ describe Class do
34
34
 
35
35
  end
36
36
 
37
- describe String do
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
@@ -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
- @producer = Limelight::Producer.new("/tmp")
12
- @loader = @producer.loader
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.loader.root.should == "/tmp"
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
- @loader.should_receive(:exists?).with("./props.rb").and_return(true)
33
- @loader.should_receive(:load).with("./props.rb").and_return("child :id => 321")
34
-
35
- scene = @producer.load_props(".", :casting_director => make_mock("casting_director", :fill_cast => nil))
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
- @loader.should_receive(:exists?).with("./props.rb").and_return(false)
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
- @loader.should_receive(:exists?).with("./styles.rb").and_return(false)
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
- @loader.should_receive(:exists?).with("./styles.rb").and_return(true)
59
- @loader.should_receive(:load).with("./styles.rb").and_return("alpha { width 100 }")
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
- @loader.should_receive(:exists?).with("./props.rb").and_return(true)
68
- @loader.should_receive(:load).with("./props.rb").and_return("one\n+\nthree")
69
-
63
+ TestDir.create_file("test_prod/props.rb", "one\n+\nthree")
64
+
70
65
  begin
71
- result = @producer.load_props(".", :casting_director => make_mock("casting_director", :fill_cast => nil))
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 == "./props.rb"
76
- e.message.should include("./props.rb:3: undefined method `+@' for ")
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
- @loader.should_receive(:exists?).with("./styles.rb").and_return(true)
82
- @loader.should_receive(:load).with("./styles.rb").and_return("one {}\ntwo {}\n-\nthree {}")
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 == "./styles.rb"
90
- e.message.should include("./styles.rb:4: undefined method `-@' for #<Java::LimelightStyles::RichStyle:0x")
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
- @loader.should_receive(:exists?).with("production.rb").and_return(false)
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(".", anything)
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
- @producer.should_receive(:load_props).with("some path", :styles => "styles", :production => @producer.production, :casting_director => anything, :loader => @loader, :path => "some path").and_return(scene)
128
+ scene.should_receive(:styles=)
132
129
  stage.should_receive(:open).with(scene)
133
-
134
- @producer.open_scene("some path", stage)
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
- @loader.should_receive(:exists?).with("./styles.rb").and_return(false)
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
- @loader.should_receive(:exists?).with("production.rb").and_return(true)
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
- @loader.should_receive(:exists?).with("production.rb").and_return(true)
158
- @loader.should_receive(:exists?).with("init.rb").and_return(true)
159
- @loader.should_receive(:load).with("production.rb").and_return("name 'Fido'")
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("/tmp/init.rb")
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
@@ -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(@producer, @theater)
12
+ @production = Limelight::Production.new("/tmp")
13
+ @production.producer = @producer
14
+ @production.theater = @theater
13
15
  end
14
16
 
15
- it "should know it producder and theater" do
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(@producer, @theater)
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
- @prop.find("blah").should == nil
69
- @prop.find("root").should be(@prop)
70
- @prop.find("child1").should be(@child1)
71
- @prop.find("child2").should be(@child2)
72
- @prop.find("grand_child1").should be(@grand_child1)
73
- @prop.find("grand_child2").should be(@grand_child2)
74
- @prop.find("grand_child3").should be(@grand_child3)
75
- @prop.find("grand_child4").should be(@grand_child4)
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 == "white"
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(:get_box).and_return("whole area")
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
- loader = make_mock("loader")
273
- @scene.loader = loader
274
- loader.should_receive(:path_to).with("some.au").and_return("/full/path/to/some.au");
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
-