flashsdk 1.0.29.pre → 1.0.33.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ class ACOMPCTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "An ACOMPC tool" do
7
+
8
+ setup do
9
+ @fixture = File.join 'test', 'fixtures', 'acompc', 'simple'
10
+ @input = File.join @fixture, 'SomeAirFile.as'
11
+ @expected_output = File.join @fixture, 'SomeAirFile.swc'
12
+ end
13
+
14
+ teardown do
15
+ remove_file @expected_output
16
+ end
17
+
18
+ should "accept input" do
19
+ as_a_unix_system do
20
+ compc = FlashSDK::ACOMPC.new
21
+ compc.output = @expected_output
22
+ compc.include_sources << @fixture
23
+ assert_equal '--output=test/fixtures/acompc/simple/SomeAirFile.swc --include-sources+=test/fixtures/acompc/simple', compc.to_shell
24
+ end
25
+ end
26
+
27
+ should "compile a swc" do
28
+ compc = FlashSDK::ACOMPC.new
29
+ compc.include_sources << @fixture
30
+ compc.output = @expected_output
31
+ compc.execute
32
+ assert_file @expected_output
33
+ end
34
+
35
+ end
36
+ end
37
+
@@ -6,21 +6,21 @@ class ADLTest < Test::Unit::TestCase
6
6
  context "An ADL tool" do
7
7
 
8
8
  setup do
9
- @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
- @app_desc = File.join @fixture, 'SomeProject.xml'
11
- @profile = 'mobileDevice'
12
- @screensize = 'NexusOne'
9
+ @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
+ @app_desc = File.join @fixture, 'SomeProject.xml'
11
+ @profile = 'mobileDevice'
12
+ @screensize = 'NexusOne'
13
13
  end
14
14
 
15
15
  teardown do
16
16
  end
17
17
 
18
18
  should "accept input" do
19
- adl = FlashSDK::ADL.new
20
- adl.app_desc = @app_desc
21
- adl.root_dir = Dir.pwd
22
- adl.screensize = @screensize
23
- adl.profile = @profile
19
+ adl = FlashSDK::ADL.new
20
+ adl.app_desc = @app_desc
21
+ adl.root_dir = Dir.pwd
22
+ adl.screensize = @screensize
23
+ adl.profile = @profile
24
24
  assert_equal "-profile #{@profile} -screensize #{@screensize} #{@app_desc} #{Dir.pwd}", adl.to_shell
25
25
  # Uncomment to actually launch
26
26
  # the AIR application:
@@ -6,21 +6,20 @@ class ADTTest < Test::Unit::TestCase
6
6
  context "An ADT tool" do
7
7
 
8
8
  setup do
9
- @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
- @application_xml = File.join @fixture, 'SomeProject.xml'
11
- @expected_output = File.join @fixture, 'SomeProject.air'
12
- @apk_input = File.join @fixture, 'SomeProject.apk'
13
- @ipa_output = File.join @fixture, 'SomeProject.ipa'
14
- @swf_input = File.join @fixture, 'SomeProject.swf'
15
- @swf_main = File.join @fixture, 'SomeProject.mxml'
16
-
17
- @certificate = File.join @fixture, 'SomeProject.pfx'
18
- @ipa_cert = File.join @fixture, 'SomeProject.p12'
19
- @provisioning_profile = File.join @fixture, 'Profile.mobileprovision'
20
- @platform = 'android'
21
- @target = 'apk-debug'
22
- @appid = 'com.foo.bar.SomeProject'
23
- @cert_password = 'samplePassword'
9
+ @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
+ @application_xml = File.join @fixture, 'SomeProject.xml'
11
+ @expected_output = File.join @fixture, 'SomeProject.air'
12
+ @apk_input = File.join @fixture, 'SomeProject.apk'
13
+ @ipa_output = File.join @fixture, 'SomeProject.ipa'
14
+ @swf_input = File.join @fixture, 'SomeProject.swf'
15
+ @swf_main = File.join @fixture, 'SomeProject.mxml'
16
+ @certificate = File.join @fixture, 'SomeProject.pfx'
17
+ @ipa_cert = File.join @fixture, 'SomeProject.p12'
18
+ @provisioning_profile = File.join @fixture, 'Profile.mobileprovision'
19
+ @platform = 'android'
20
+ @target = 'apk-debug'
21
+ @appid = 'com.foo.bar.SomeProject'
22
+ @cert_password = 'samplePassword'
24
23
  end
25
24
 
26
25
  teardown do
@@ -46,8 +45,28 @@ class ADTTest < Test::Unit::TestCase
46
45
  #assert_file @expected_output
47
46
  end
48
47
  end
48
+
49
+ should "package a SWF and complex assets with an application.xml" do
50
+ as_a_unix_system do
51
+ t = adt @expected_output do |t|
52
+ t.package = true
53
+ t.target = @target
54
+ t.package_input = @application_xml
55
+ t.package_output = @expected_output
56
+ t.storetype = 'PKCS12'
57
+ t.keystore = @certificate
58
+ t.storepass = @cert_password
59
+ t.included_files << @swf_input
60
+ t.file_options << 'bin path/to/asset.xml'
61
+ end
62
+ assert_equal "-package -target #{@target} -storetype PKCS12 -keystore test/fixtures/air/simple/SomeProject.pfx -storepass samplePassword test/fixtures/air/simple/SomeProject.air test/fixtures/air/simple/SomeProject.xml test/fixtures/air/simple/SomeProject.swf -C bin path/to/asset.xml", t.to_shell
63
+
64
+ #t.execute
65
+ #assert_file @expected_output
66
+ end
67
+ end
49
68
 
50
- should "package an iOS swf with a provisioning profile" do
69
+ should "package an iOS swf with a provisioning profile" do
51
70
  as_a_unix_system do
52
71
  t = adt @ipa_output do |t|
53
72
  t.package = true
@@ -57,7 +76,7 @@ class ADTTest < Test::Unit::TestCase
57
76
  t.storetype = 'PKCS12'
58
77
  t.keystore = @ipa_cert
59
78
  t.storepass = @cert_password
60
- t.provisioning_profile = @provisioning_profile
79
+ t.provisioning_profile = @provisioning_profile
61
80
  t.included_files << @swf_input
62
81
  end
63
82
  assert_equal "-package -target ipa-test -storetype PKCS12 -keystore #{@ipa_cert} -storepass #{@cert_password} -provisioning-profile #{@provisioning_profile} #{@ipa_output} #{@application_xml} #{@swf_input}", t.to_shell
@@ -67,13 +86,13 @@ class ADTTest < Test::Unit::TestCase
67
86
  end
68
87
  end
69
88
 
70
- should "install an APK" do
89
+ should "install an APK" do
71
90
  as_a_unix_system do
72
91
  t = adt @expected_output do |t|
73
- t.installApp = true
74
- t.platform = @platform
75
- t.package = true
76
- t.package_input = @apk_input
92
+ t.installApp = true
93
+ t.platform = @platform
94
+ t.package = true
95
+ t.package_input = @apk_input
77
96
  end
78
97
  assert_equal "-installApp -platform #{@platform} -package #{@apk_input}", t.to_shell
79
98
 
@@ -82,12 +101,12 @@ class ADTTest < Test::Unit::TestCase
82
101
  end
83
102
  end
84
103
 
85
- should "uninstall an APK" do
104
+ should "uninstall an APK" do
86
105
  as_a_unix_system do
87
106
  t = adt @expected_output do |t|
88
- t.uninstallApp = true
89
- t.platform = @platform
90
- t.appid = @appid
107
+ t.uninstallApp = true
108
+ t.platform = @platform
109
+ t.appid = @appid
91
110
  end
92
111
  assert_equal "-uninstallApp -platform #{@platform} -appid #{@appid}", t.to_shell
93
112
 
@@ -96,12 +115,12 @@ class ADTTest < Test::Unit::TestCase
96
115
  end
97
116
  end
98
117
 
99
- should "launch an app" do
118
+ should "launch an app" do
100
119
  as_a_unix_system do
101
120
  t = adt @expected_output do |t|
102
- t.launchApp = true
103
- t.platform = @platform
104
- t.appid = @appid
121
+ t.launchApp = true
122
+ t.platform = @platform
123
+ t.appid = @appid
105
124
  end
106
125
  assert_equal "-launchApp -platform #{@platform} -appid #{@appid}", t.to_shell
107
126
 
@@ -20,7 +20,7 @@ class AMXMLCTest < Test::Unit::TestCase
20
20
  amxmlc = FlashSDK::AMXMLC.new
21
21
  amxmlc.input = @input
22
22
  amxmlc.source_path << @fixture
23
- assert_equal '-source-path+=test/fixtures/air/simple -static-link-runtime-shared-libraries test/fixtures/air/simple/SomeProject.as', amxmlc.to_shell
23
+ assert_equal '-source-path+=test/fixtures/air/simple test/fixtures/air/simple/SomeProject.as', amxmlc.to_shell
24
24
  end
25
25
  end
26
26
 
@@ -39,7 +39,6 @@ class AMXMLCTest < Test::Unit::TestCase
39
39
  should "assign default-size" do
40
40
  amxmlc = FlashSDK::AMXMLC.new
41
41
  amxmlc.default_size = '800,500'
42
- amxmlc.static_link_runtime_shared_libraries = false
43
42
  assert_equal '-default-size=800,500', amxmlc.to_shell
44
43
  end
45
44
 
@@ -48,7 +47,7 @@ class AMXMLCTest < Test::Unit::TestCase
48
47
  t = amxmlc 'bin/SomeProject.swf' do |t|
49
48
  t.input = @input
50
49
  end
51
- assert_equal '-output=bin/SomeProject.swf -static-link-runtime-shared-libraries test/fixtures/air/simple/SomeProject.as', t.to_shell
50
+ assert_equal '-output=bin/SomeProject.swf test/fixtures/air/simple/SomeProject.as', t.to_shell
52
51
  end
53
52
  end
54
53
  end
@@ -20,7 +20,7 @@ class COMPCTest < Test::Unit::TestCase
20
20
  compc = FlashSDK::COMPC.new
21
21
  compc.output = @expected_output
22
22
  compc.include_sources << @fixture
23
- assert_equal '--output=test/fixtures/compc/simple/SomeFile.swc --static-link-runtime-shared-libraries --include-sources+=test/fixtures/compc/simple', compc.to_shell
23
+ assert_equal '--output=test/fixtures/compc/simple/SomeFile.swc --include-sources+=test/fixtures/compc/simple', compc.to_shell
24
24
  end
25
25
  end
26
26
 
@@ -19,7 +19,7 @@ class FCSHTest < Test::Unit::TestCase
19
19
  teardown do
20
20
  remove_file @expected_output
21
21
  end
22
-
22
+ =begin
23
23
  should "collect errors as needed" do
24
24
  mxmlc = FlashSDK::MXMLC.new
25
25
  mxmlc.input = @broken_input
@@ -49,7 +49,7 @@ class FCSHTest < Test::Unit::TestCase
49
49
 
50
50
  assert_file @expected_output
51
51
  end
52
-
52
+ =end
53
53
  end
54
54
  end
55
55
 
@@ -0,0 +1,213 @@
1
+ require 'test_helper'
2
+
3
+ class FlexCompilerOptionsTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ # formal tests for a variety of Flex compiler options and how they should appear on the CLI based on true/false settings
7
+ context "A Flex compiler's options" do
8
+
9
+ setup do
10
+ @mxmlc = FlashSDK::MXMLC.new
11
+ end
12
+
13
+ teardown do
14
+ end
15
+
16
+ # -as3
17
+ should "default to as3=true" do
18
+ assert_equal true, @mxmlc.as3
19
+ end
20
+
21
+ should "not include a -as3 flag if :as3 is set to true" do
22
+ @mxmlc.as3 = true
23
+ assert_no_match /-as3/, @mxmlc.to_shell
24
+ end
25
+
26
+ should "include -as3=false flag if :as3 is set to false" do
27
+ @mxmlc.as3 = false
28
+ assert_equal '-as3=false', @mxmlc.to_shell
29
+ end
30
+
31
+ # -benchmark
32
+ should "default to benchmark=true" do
33
+ assert_equal true, @mxmlc.benchmark
34
+ end
35
+
36
+ should "not include a -benchmark flag if :benchmark is set to true" do
37
+ @mxmlc.benchmark = true
38
+ assert_no_match /-benchmark/, @mxmlc.to_shell
39
+ end
40
+
41
+ should "include -benchmark=false flag if :benchmark is set to false" do
42
+ @mxmlc.benchmark = false
43
+ assert_equal '-benchmark=false', @mxmlc.to_shell
44
+ end
45
+
46
+ # -debug
47
+ should "default to debug=false" do
48
+ assert_equal false, @mxmlc.debug
49
+ end
50
+
51
+ should "not include a -debug flag if :debug is set to false" do
52
+ assert_no_match /-debug/, @mxmlc.to_shell
53
+ end
54
+
55
+ should "include -debug flag if :debug is set to true" do
56
+ @mxmlc.debug = true
57
+ assert_equal '-debug', @mxmlc.to_shell
58
+ end
59
+
60
+ # -use-network
61
+ should "default to use_network=false" do
62
+ assert_equal true, @mxmlc.use_network
63
+ end
64
+
65
+ should "not include a -use-network flag if :use_network is set to true" do
66
+ @mxmlc.use_network = true
67
+ assert_no_match /-use-network/, @mxmlc.to_shell
68
+ end
69
+
70
+ should "include -use-network=false flag if :use_network is set to false" do
71
+ @mxmlc.use_network = false
72
+ assert_equal '-use-network=false', @mxmlc.to_shell
73
+ end
74
+
75
+ # -optimize
76
+ should "default to optimize=true" do
77
+ assert_equal true, @mxmlc.optimize
78
+ end
79
+
80
+ should "not include a -optimize flag if :optimize is set to true" do
81
+ @mxmlc.optimize = true
82
+ assert_no_match /-optimize/, @mxmlc.to_shell
83
+ end
84
+
85
+ should "include -optimize=false flag if :optimize is set to false" do
86
+ @mxmlc.optimize = false
87
+ assert_equal '-optimize=false', @mxmlc.to_shell
88
+ end
89
+
90
+ # -show-actionscript-warnings
91
+ should "default to show-actionscript-warnings=true" do
92
+ assert_equal true, @mxmlc.show_actionscript_warnings
93
+ end
94
+
95
+ should "not include a -show-actionscript-warnings flag if :show-actionscript-warnings is set to true" do
96
+ @mxmlc.show_actionscript_warnings = true
97
+ assert_no_match /-show-actionscript-warnings/, @mxmlc.to_shell
98
+ end
99
+
100
+ should "include -show-actionscript-warnings=false flag if :show-actionscript-warnings is set to false" do
101
+ @mxmlc.show_actionscript_warnings = false
102
+ assert_equal '-show-actionscript-warnings=false', @mxmlc.to_shell
103
+ end
104
+
105
+ # -show-binding-warnings
106
+ should "default to show-binding-warnings=true" do
107
+ assert_equal true, @mxmlc.show_binding_warnings
108
+ end
109
+
110
+ should "not include a -show-binding-warnings flag if :show-binding-warnings is set to true" do
111
+ @mxmlc.show_binding_warnings = true
112
+ assert_no_match /-show-binding-warnings/, @mxmlc.to_shell
113
+ end
114
+
115
+ should "include -show-binding-warnings=false flag if :show-binding-warnings is set to false" do
116
+ @mxmlc.show_binding_warnings = false
117
+ assert_equal '-show-binding-warnings=false', @mxmlc.to_shell
118
+ end
119
+
120
+ # -show-shadowed-device-font-warnings
121
+ should "default to show-shadowed-device-font-warnings=true" do
122
+ assert_equal true, @mxmlc.show_shadowed_device_font_warnings
123
+ end
124
+
125
+ should "not include a -show-shadowed-device-font-warnings flag if :show-shadowed-device-font-warnings is set to true" do
126
+ @mxmlc.show_shadowed_device_font_warnings = true
127
+ assert_no_match /-show-shadowed-device-font-warnings/, @mxmlc.to_shell
128
+ end
129
+
130
+ should "include -show-shadowed-device-font-warnings=false flag if :show-shadowed-device-font-warnings is set to false" do
131
+ @mxmlc.show_shadowed_device_font_warnings = false
132
+ assert_equal '-show-shadowed-device-font-warnings=false', @mxmlc.to_shell
133
+ end
134
+
135
+ # -show-unused-type-selector-warnings
136
+ should "default to show-unused-type-selector-warnings=true" do
137
+ assert_equal true, @mxmlc.show_unused_type_selector_warnings
138
+ end
139
+
140
+ should "not include a -show-unused-type-selector-warnings flag if :show-unused-type-selector-warnings is set to true" do
141
+ @mxmlc.show_unused_type_selector_warnings = true
142
+ assert_no_match /-show-unused-type-selector-warnings/, @mxmlc.to_shell
143
+ end
144
+
145
+ should "include -show-unused-type-selector-warnings=false flag if :show-unused-type-selector-warnings is set to false" do
146
+ @mxmlc.show_unused_type_selector_warnings = false
147
+ assert_equal '-show-unused-type-selector-warnings=false', @mxmlc.to_shell
148
+ end
149
+
150
+ # -static-link-runtime-shared-libraries
151
+ should "default to static-link-runtime-shared-libraries=false" do
152
+ assert_equal false, @mxmlc.static_link_runtime_shared_libraries
153
+ end
154
+
155
+ should "include a -static-link-runtime-shared-libraries=true flag if :static-link-runtime-shared-libraries is set to true" do
156
+ @mxmlc.static_link_runtime_shared_libraries = true
157
+ assert_equal '-static-link-runtime-shared-libraries=true', @mxmlc.to_shell
158
+ end
159
+
160
+ should "not include -static-link-runtime-shared-libraries=false flag if :static-link-runtime-shared-libraries is set to false" do
161
+ @mxmlc.static_link_runtime_shared_libraries = false
162
+ assert_no_match /-static-link-runtime-shared-libraries/, @mxmlc.to_shell
163
+ end
164
+
165
+ # -strict
166
+ should "default to strict=true" do
167
+ assert_equal true, @mxmlc.strict
168
+ end
169
+
170
+ should "not include a -strict flag if :strict is set to true" do
171
+ @mxmlc.strict = true
172
+ assert_no_match /-strict/, @mxmlc.to_shell
173
+ end
174
+
175
+ should "include -strict=false flag if :strict is set to false" do
176
+ @mxmlc.strict = false
177
+ assert_equal '-strict=false', @mxmlc.to_shell
178
+ end
179
+
180
+ # -use-resource-bundle-metadata
181
+ should "default to use-resource-bundle-metadata=true" do
182
+ assert_equal true, @mxmlc.use_resource_bundle_metadata
183
+ end
184
+
185
+ should "not include a -use-resource-bundle-metadata flag if :use-resource-bundle-metadata is set to true" do
186
+ @mxmlc.use_resource_bundle_metadata = true
187
+ assert_no_match /-use-resource-bundle-metadata/, @mxmlc.to_shell
188
+ end
189
+
190
+ should "include -use-resource-bundle-metadata=false flag if :use-resource-bundle-metadata is set to false" do
191
+ @mxmlc.use_resource_bundle_metadata = false
192
+ assert_equal '-use-resource-bundle-metadata=false', @mxmlc.to_shell
193
+ end
194
+
195
+ # -warnings
196
+ should "default to warnings=true" do
197
+ assert_equal true, @mxmlc.warnings
198
+ end
199
+
200
+ should "not include a -warnings flag if :warnings is set to true" do
201
+ @mxmlc.warnings = true
202
+ assert_no_match /-warnings/, @mxmlc.to_shell
203
+ end
204
+
205
+ should "include -warnings=false flag if :warnings is set to false" do
206
+ @mxmlc.warnings = false
207
+ assert_equal '-warnings=false', @mxmlc.to_shell
208
+ end
209
+
210
+
211
+ end
212
+ end
213
+
@@ -34,14 +34,13 @@ class MXMLCTest < Test::Unit::TestCase
34
34
  mxmlc = FlashSDK::MXMLC.new
35
35
  mxmlc.input = 'test/fixtures/mxmlc/simple/SomeFile.as'
36
36
  mxmlc.source_path << 'test/fixtures/mxmlc/simple'
37
- assert_equal '-source-path+=test/fixtures/mxmlc/simple -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as', mxmlc.to_shell
37
+ assert_equal '-source-path+=test/fixtures/mxmlc/simple test/fixtures/mxmlc/simple/SomeFile.as', mxmlc.to_shell
38
38
  end
39
39
  end
40
40
 
41
41
  should "assign default-size" do
42
42
  mxmlc = FlashSDK::MXMLC.new
43
43
  mxmlc.default_size = '800,500'
44
- mxmlc.static_link_runtime_shared_libraries = false
45
44
  assert_equal '-default-size=800,500', mxmlc.to_shell
46
45
  end
47
46
 
@@ -61,7 +60,6 @@ class MXMLCTest < Test::Unit::TestCase
61
60
  mxmlc.use_fcsh = true
62
61
  mxmlc.execute
63
62
  end
64
-
65
63
  end
66
64
  end
67
65