flash_tool 0.5.0 → 0.6.0
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.
Potentially problematic release.
This version of flash_tool might be problematic. Click here for more details.
- data/.gitignore +1 -0
- data/README.rdoc +63 -15
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/flash_tool.gemspec +28 -18
- data/lib/flash_tool.rb +76 -170
- data/lib/flash_tool/flash.rb +114 -0
- data/lib/flash_tool/flash_combine.rb +82 -0
- data/lib/flash_tool/flash_object.rb +73 -0
- data/lib/flash_tool/flash_script.rb +36 -0
- data/test/{25-1.gif → test_files/25-1.gif} +0 -0
- data/test/test_files/bad.sc +1 -0
- data/test/{bad_ext.txt → test_files/bad_ext.txt} +0 -0
- data/test/{bad_swf.swf → test_files/bad_swf.swf} +0 -0
- data/test/{jpeg.swf → test_files/jpeg.swf} +0 -0
- data/test/{liberationserif_bold.ttf → test_files/liberationserif_bold.ttf} +0 -0
- data/test/{rfxview.swf → test_files/rfxview.swf} +0 -0
- data/test/test_files/script.sc +8 -0
- data/test/{test.jpg → test_files/test.jpg} +0 -0
- data/test/{test.pdf → test_files/test.pdf} +0 -0
- data/test/{test.png → test_files/test.png} +0 -0
- data/test/{test_with_password.pdf → test_files/test_with_password.pdf} +0 -0
- data/test/{tester.swf → test_files/tester.swf} +0 -0
- data/test/test_flash_combine.rb +88 -0
- data/test/test_flash_object.rb +230 -0
- data/test/test_flash_script.rb +52 -0
- data/test/test_flash_tool.rb +47 -140
- metadata +27 -17
- data/test/test_flash_data.rb +0 -69
@@ -0,0 +1,52 @@
|
|
1
|
+
|
2
|
+
require File.join(File.dirname(__FILE__), '../lib/flash_tool.rb')
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class Test_Flash_Script < Test::Unit::TestCase
|
7
|
+
include FlashTool
|
8
|
+
CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) + "/test_files/"
|
9
|
+
TEST_SCRIPT = CURRENT_DIR + "script.sc"
|
10
|
+
BAD_SCRIPT = CURRENT_DIR + "bad.sc"
|
11
|
+
|
12
|
+
def test_script_create
|
13
|
+
output_file = "#{CURRENT_DIR}/script.swf"
|
14
|
+
begin
|
15
|
+
flash_object = FlashScript.new(TEST_SCRIPT)
|
16
|
+
flash_object.save(output_file)
|
17
|
+
assert(File.exist?(output_file))
|
18
|
+
ensure
|
19
|
+
File.delete(output_file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_bad_script
|
24
|
+
output_file = "#{CURRENT_DIR}/script.swf"
|
25
|
+
flash_object = FlashScript.new(BAD_SCRIPT)
|
26
|
+
assert_raise(FlashToolError) { flash_object.save(output_file)}
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_cgi_out
|
30
|
+
|
31
|
+
flash_object = FlashScript.new(TEST_SCRIPT)
|
32
|
+
assert_kind_of String, flash_object.cgi
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_static_cgi_out
|
36
|
+
|
37
|
+
flash_object = FlashScript.flash_data(TEST_SCRIPT)
|
38
|
+
assert_kind_of String, flash_object
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_static_create
|
42
|
+
|
43
|
+
output_file = "#{CURRENT_DIR}/script.swf"
|
44
|
+
begin
|
45
|
+
flash_object = FlashScript.create(TEST_SCRIPT, output_file)
|
46
|
+
assert(File.exist?(output_file))
|
47
|
+
ensure
|
48
|
+
File.delete(output_file)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
data/test/test_flash_tool.rb
CHANGED
@@ -1,162 +1,69 @@
|
|
1
1
|
# To change this template, choose Tools | Templates
|
2
2
|
# and open the template in the editor.
|
3
3
|
|
4
|
-
require 'test/unit'
|
5
4
|
require File.join(File.dirname(__FILE__), '../lib/flash_tool.rb')
|
6
5
|
|
7
|
-
|
8
|
-
include FlashTool
|
9
|
-
|
10
|
-
CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) + "/"
|
11
|
-
|
12
|
-
PDF_FILE = CURRENT_DIR + "test.pdf"
|
13
|
-
PDF_PASSW_PROTECTED = CURRENT_DIR + "test_with_password.pdf"
|
14
|
-
GIF_FILE = CURRENT_DIR + "25-1.gif"
|
15
|
-
FONT_FILE = CURRENT_DIR + "liberationserif_bold.ttf"
|
16
|
-
JPG_FILE = CURRENT_DIR + "test.jpg"
|
17
|
-
PNG_FILE = CURRENT_DIR + "test.png"
|
18
|
-
VIEW_SWF = CURRENT_DIR + "rfxview.swf"
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
def test_flash_object_from_blob
|
23
|
-
File.open(JPG_FILE, "rb") do |f|
|
24
|
-
flash_object = FlashObject.from_blob(f.read, 'jpg')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
def test_flash_object_new
|
30
|
-
flash_object = FlashObject.new(JPG_FILE)
|
31
|
-
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# Testing file type detection and creation by file type
|
35
|
-
#
|
36
|
-
#
|
37
|
-
|
38
|
-
def test_pdf_create
|
39
|
-
begin
|
40
|
-
output_file = "#{CURRENT_DIR}/test.swf"
|
41
|
-
flash_object = FlashObject.new(PDF_FILE)
|
42
|
-
flash_object.jpegquality(80)
|
43
|
-
flash_object.save(output_file)
|
6
|
+
require 'test/unit'
|
44
7
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
assert(File.exist?(output_file))
|
58
|
-
ensure
|
59
|
-
File.delete(output_file)
|
60
|
-
end
|
8
|
+
class Test_Flash_Data < Test::Unit::TestCase
|
9
|
+
include FlashTool
|
10
|
+
CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) + "/test_files/"
|
11
|
+
TEST_SWF = CURRENT_DIR + "tester.swf"
|
12
|
+
BAD_FILE = CURRENT_DIR + "bad_ext.txt"
|
13
|
+
JPG_SWF = CURRENT_DIR + "jpeg.swf"
|
14
|
+
NO_FILE = CURRENT_DIR + "jpegswf.swf"
|
15
|
+
BAD_SWF = CURRENT_DIR + "bad_swf.swf"
|
16
|
+
|
17
|
+
def test_get_info
|
18
|
+
info = FlashTool.flash_info(TEST_SWF)
|
19
|
+
assert_kind_of Hash, info
|
61
20
|
end
|
62
21
|
|
63
|
-
def
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
22
|
+
def test_missing_methods
|
23
|
+
assert_kind_of(Integer, FlashTool.width(TEST_SWF))
|
24
|
+
assert_kind_of(Integer, FlashTool.height(TEST_SWF))
|
25
|
+
assert_kind_of(Integer, FlashTool.frames(TEST_SWF))
|
26
|
+
assert_kind_of(Float, FlashTool.rate(TEST_SWF))
|
27
|
+
assert_kind_of(String, FlashTool.html(TEST_SWF))
|
28
|
+
assert_kind_of(String, FlashTool.xhtml(TEST_SWF))
|
29
|
+
assert_kind_of(String, FlashTool.full(TEST_SWF))
|
30
|
+
assert_kind_of(String, FlashTool.hex(TEST_SWF))
|
31
|
+
assert_kind_of(String, FlashTool.buttons(TEST_SWF))
|
32
|
+
assert_kind_of(String, FlashTool.placements(TEST_SWF))
|
33
|
+
assert_kind_of(String, FlashTool.fonts(TEST_SWF))
|
76
34
|
|
77
|
-
def test_font_create
|
78
|
-
output_file = "#{CURRENT_DIR}/arial.swf"
|
79
|
-
begin
|
80
|
-
flash_object = FlashObject.new(FONT_FILE)
|
81
|
-
flash_object.save(output_file)
|
82
|
-
assert(File.exist?(output_file))
|
83
|
-
ensure
|
84
|
-
File.delete(output_file)
|
85
|
-
end
|
86
35
|
end
|
87
36
|
|
88
|
-
def
|
89
|
-
output_file = "#{CURRENT_DIR}/gif.swf"
|
90
|
-
begin
|
91
|
-
flash_object = FlashObject.new(GIF_FILE)
|
92
|
-
flash_object.save(output_file)
|
93
|
-
assert(File.exist?(output_file))
|
94
|
-
ensure
|
95
|
-
File.delete(output_file)
|
96
|
-
end
|
97
|
-
end
|
37
|
+
def test_bad_file
|
98
38
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
assert(File.exist?(output_file))
|
105
|
-
ensure
|
106
|
-
File.delete(output_file)
|
107
|
-
end
|
39
|
+
assert_raise(FlashToolError) { FlashTool.flash_info(BAD_FILE) }
|
40
|
+
assert_raise(FlashToolError) { FlashTool.full(BAD_FILE) }
|
41
|
+
assert_raise(FlashToolError) { FlashTool.width(BAD_FILE) }
|
42
|
+
assert_raise(FlashToolError) { FlashTool.parse_text(BAD_FILE) }
|
43
|
+
assert_raise(FlashToolError) { FlashTool.swfdump(BAD_FILE, 'width') }
|
108
44
|
end
|
109
45
|
|
110
|
-
def
|
111
|
-
output_file = "#{CURRENT_DIR}/jpg.swf"
|
112
|
-
begin
|
113
|
-
flash_object = FlashObject.new(JPG_FILE)
|
114
|
-
flash_object.save(output_file)
|
115
|
-
assert(File.exist?(output_file))
|
116
|
-
ensure
|
117
|
-
File.delete(output_file)
|
118
|
-
end
|
119
|
-
end
|
46
|
+
def test_no_file
|
120
47
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
flash_object.quality(80)
|
127
|
-
flash_object.save(output_file)
|
128
|
-
ensure
|
129
|
-
File.delete(output_file)
|
130
|
-
end
|
48
|
+
assert_raise(FlashToolError) { FlashTool.flash_info(NO_FILE) }
|
49
|
+
assert_raise(FlashToolError) { FlashTool.full(NO_FILE) }
|
50
|
+
assert_raise(FlashToolError) { FlashTool.width(NO_FILE) }
|
51
|
+
assert_raise(FlashToolError) { FlashTool.parse_text(NO_FILE) }
|
52
|
+
assert_raise(FlashToolError) { FlashTool.swfdump(NO_FILE, 'width') }
|
131
53
|
end
|
132
54
|
|
133
|
-
|
134
|
-
|
135
|
-
output_file = "#{CURRENT_DIR}/test_viewer.swf"
|
136
|
-
begin
|
137
|
-
flash_object = FlashObject.new(PDF_FILE)
|
138
|
-
flash_object.jpegquality(80)
|
139
|
-
flash_object.viewer(VIEW_SWF)
|
140
|
-
flash_object.save(output_file)
|
141
|
-
assert(File.exist?(output_file))
|
142
|
-
ensure
|
143
|
-
File.delete(output_file)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
|
148
|
-
#
|
149
|
-
# Testing errors and bad types
|
150
|
-
#
|
55
|
+
# Testing bad swf
|
56
|
+
def test_bad_swf_file
|
151
57
|
|
152
|
-
|
153
|
-
assert_raise(FlashToolError) {
|
58
|
+
assert_raise(FlashToolError) { FlashTool.flash_info(BAD_SWF) }
|
59
|
+
assert_raise(FlashToolError) { FlashTool.full(BAD_SWF) }
|
60
|
+
assert_raise(FlashToolError) { FlashTool.width(BAD_SWF) }
|
61
|
+
assert_raise(FlashToolError) { FlashTool.parse_text(BAD_SWF) }
|
62
|
+
assert_raise(FlashToolError) { FlashTool.swfdump(BAD_SWF, 'width') }
|
154
63
|
end
|
155
64
|
|
156
|
-
def
|
157
|
-
|
65
|
+
def test_parse_text
|
66
|
+
assert_equal "",FlashTool.parse_text(JPG_SWF) #image flash
|
67
|
+
assert (FlashTool.parse_text(TEST_SWF).length > 100 ) #test number of charachters
|
158
68
|
end
|
159
|
-
|
160
|
-
|
161
69
|
end
|
162
|
-
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 6
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.6.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Bojan Milosavljevic
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-23 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -39,19 +39,27 @@ files:
|
|
39
39
|
- VERSION
|
40
40
|
- flash_tool.gemspec
|
41
41
|
- lib/flash_tool.rb
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
- test/
|
47
|
-
- test/
|
48
|
-
- test/
|
49
|
-
- test/
|
50
|
-
- test/
|
51
|
-
- test/
|
42
|
+
- lib/flash_tool/flash.rb
|
43
|
+
- lib/flash_tool/flash_combine.rb
|
44
|
+
- lib/flash_tool/flash_object.rb
|
45
|
+
- lib/flash_tool/flash_script.rb
|
46
|
+
- test/test_files/25-1.gif
|
47
|
+
- test/test_files/bad.sc
|
48
|
+
- test/test_files/bad_ext.txt
|
49
|
+
- test/test_files/bad_swf.swf
|
50
|
+
- test/test_files/jpeg.swf
|
51
|
+
- test/test_files/liberationserif_bold.ttf
|
52
|
+
- test/test_files/rfxview.swf
|
53
|
+
- test/test_files/script.sc
|
54
|
+
- test/test_files/test.jpg
|
55
|
+
- test/test_files/test.pdf
|
56
|
+
- test/test_files/test.png
|
57
|
+
- test/test_files/test_with_password.pdf
|
58
|
+
- test/test_files/tester.swf
|
59
|
+
- test/test_flash_combine.rb
|
60
|
+
- test/test_flash_object.rb
|
61
|
+
- test/test_flash_script.rb
|
52
62
|
- test/test_flash_tool.rb
|
53
|
-
- test/test_with_password.pdf
|
54
|
-
- test/tester.swf
|
55
63
|
has_rdoc: true
|
56
64
|
homepage: http://github.com/milboj/flash_tool
|
57
65
|
licenses: []
|
@@ -77,11 +85,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
85
|
version: "0"
|
78
86
|
requirements: []
|
79
87
|
|
80
|
-
rubyforge_project:
|
88
|
+
rubyforge_project: flash_tool
|
81
89
|
rubygems_version: 1.3.6
|
82
90
|
signing_key:
|
83
91
|
specification_version: 3
|
84
92
|
summary: Simple and mini tool for creating swf (flash) files from pdf, jpg, png and gif with swftools
|
85
93
|
test_files:
|
94
|
+
- test/test_flash_script.rb
|
95
|
+
- test/test_flash_combine.rb
|
86
96
|
- test/test_flash_tool.rb
|
87
|
-
- test/
|
97
|
+
- test/test_flash_object.rb
|
data/test/test_flash_data.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# To change this template, choose Tools | Templates
|
2
|
-
# and open the template in the editor.
|
3
|
-
|
4
|
-
require File.join(File.dirname(__FILE__), '../lib/flash_tool.rb')
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class Test_Flash_Data < Test::Unit::TestCase
|
9
|
-
include FlashTool
|
10
|
-
CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) + "/"
|
11
|
-
TEST_SWF = CURRENT_DIR + "tester.swf"
|
12
|
-
BAD_FILE = CURRENT_DIR + "bad_ext.txt"
|
13
|
-
JPG_SWF = CURRENT_DIR + "jpeg.swf"
|
14
|
-
NO_FILE = CURRENT_DIR + "jpegswf.swf"
|
15
|
-
BAD_SWF = CURRENT_DIR + "bad_swf.swf"
|
16
|
-
|
17
|
-
def test_get_info
|
18
|
-
info = FlashTool.flash_info(TEST_SWF)
|
19
|
-
assert_kind_of Hash, info
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_missing_methods
|
23
|
-
assert_kind_of(Integer, FlashTool.width(TEST_SWF))
|
24
|
-
assert_kind_of(Integer, FlashTool.height(TEST_SWF))
|
25
|
-
assert_kind_of(Integer, FlashTool.frames(TEST_SWF))
|
26
|
-
assert_kind_of(Float, FlashTool.rate(TEST_SWF))
|
27
|
-
assert_kind_of(String, FlashTool.html(TEST_SWF))
|
28
|
-
assert_kind_of(String, FlashTool.xhtml(TEST_SWF))
|
29
|
-
assert_kind_of(String, FlashTool.full(TEST_SWF))
|
30
|
-
assert_kind_of(String, FlashTool.hex(TEST_SWF))
|
31
|
-
assert_kind_of(String, FlashTool.buttons(TEST_SWF))
|
32
|
-
assert_kind_of(String, FlashTool.placements(TEST_SWF))
|
33
|
-
assert_kind_of(String, FlashTool.fonts(TEST_SWF))
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_bad_file
|
38
|
-
|
39
|
-
assert_raise(FlashToolError) { FlashTool.flash_info(BAD_FILE) }
|
40
|
-
assert_raise(FlashToolError) { FlashTool.full(BAD_FILE) }
|
41
|
-
assert_raise(FlashToolError) { FlashTool.width(BAD_FILE) }
|
42
|
-
assert_raise(FlashToolError) { FlashTool.parse_text(BAD_FILE) }
|
43
|
-
assert_raise(FlashToolError) { FlashTool.swfdump(BAD_FILE, 'width') }
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_no_file
|
47
|
-
|
48
|
-
assert_raise(FlashToolError) { FlashTool.flash_info(NO_FILE) }
|
49
|
-
assert_raise(FlashToolError) { FlashTool.full(NO_FILE) }
|
50
|
-
assert_raise(FlashToolError) { FlashTool.width(NO_FILE) }
|
51
|
-
assert_raise(FlashToolError) { FlashTool.parse_text(NO_FILE) }
|
52
|
-
assert_raise(FlashToolError) { FlashTool.swfdump(NO_FILE, 'width') }
|
53
|
-
end
|
54
|
-
|
55
|
-
# Testing bad swf
|
56
|
-
def test_bad_swf_file
|
57
|
-
|
58
|
-
assert_raise(FlashToolError) { FlashTool.flash_info(BAD_SWF) }
|
59
|
-
assert_raise(FlashToolError) { FlashTool.full(BAD_SWF) }
|
60
|
-
assert_raise(FlashToolError) { FlashTool.width(BAD_SWF) }
|
61
|
-
assert_raise(FlashToolError) { FlashTool.parse_text(BAD_SWF) }
|
62
|
-
assert_raise(FlashToolError) { FlashTool.swfdump(BAD_SWF, 'width') }
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_parse_text
|
66
|
-
assert_equal "",FlashTool.parse_text(JPG_SWF) #image flash
|
67
|
-
assert_true(FlashTool.parse_text(TEST_SWF).length > 100 ) #test number of charachters
|
68
|
-
end
|
69
|
-
end
|