flash_tool 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of flash_tool might be problematic. Click here for more details.

@@ -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
@@ -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
- class FlashToolsTest < Test::Unit::TestCase
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
- assert(File.exist?(output_file))
46
- ensure
47
- File.delete(output_file)
48
- end
49
- end
50
- def test_pdf_create_with_password
51
- output_file = "#{CURRENT_DIR}/test_password.swf"
52
- begin
53
- flash_object = FlashObject.new(PDF_PASSW_PROTECTED)
54
- flash_object.jpegquality(80)
55
- flash_object.password("test")
56
- flash_object.save(output_file)
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 test_pdf_create_with_password_without_save_declaration
64
- output_file = "#{CURRENT_DIR}/test_password.swf"
65
- begin
66
- flash_object = FlashObject.new(PDF_PASSW_PROTECTED)
67
- flash_object.jpegquality(80)
68
- flash_object.password("test")
69
- flash_object.output(output_file)
70
- flash_object.save()
71
- assert(File.exist?(output_file))
72
- ensure
73
- File.delete(output_file)
74
- end
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 test_gif_create
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
- def test_png_create
100
- output_file = "#{CURRENT_DIR}/png.swf"
101
- begin
102
- flash_object = FlashObject.new(PNG_FILE)
103
- flash_object.save(output_file)
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 test_jpg_create
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
- def test_create_from_blob
122
- output_file = "#{CURRENT_DIR}/jpg.swf"
123
- begin
124
- tt = File.open(JPG_FILE, "rb")
125
- flash_object = FlashObject.from_blob(tt.read, 'jpg')
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
- def test_creating_viewer
134
- output_file = "#{CURRENT_DIR}/jpg.swf"
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
- def test_file_not_exist
153
- assert_raise(FlashToolError) { flash_object = FlashObject.new("nofile.jpg") }
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 test_wrong_file_type
157
- assert_raise(FlashToolError) {flash_object = FlashObject.new("bad_ext.txt")}
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
- - 5
7
+ - 6
8
8
  - 0
9
- version: 0.5.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-20 00:00:00 +01:00
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
- - test/25-1.gif
43
- - test/bad_ext.txt
44
- - test/bad_swf.swf
45
- - test/jpeg.swf
46
- - test/liberationserif_bold.ttf
47
- - test/rfxview.swf
48
- - test/test.jpg
49
- - test/test.pdf
50
- - test/test.png
51
- - test/test_flash_data.rb
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: flashtool
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/test_flash_data.rb
97
+ - test/test_flash_object.rb
@@ -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