libis-format 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +14 -4
  3. data/base/Dockerfile +13 -0
  4. data/lib/libis/format/config.rb +11 -9
  5. data/lib/libis/format/converter/audio_converter.rb +1 -1
  6. data/lib/libis/format/converter/image_converter.rb +1 -1
  7. data/lib/libis/format/converter/jp2_converter.rb +1 -1
  8. data/lib/libis/format/converter/pdf_converter.rb +8 -6
  9. data/lib/libis/format/tool/droid.rb +2 -2
  10. data/lib/libis/format/tool/ffmpeg.rb +1 -1
  11. data/lib/libis/format/tool/fido.rb +1 -1
  12. data/lib/libis/format/tool/fop_pdf.rb +1 -1
  13. data/lib/libis/format/tool/office_to_pdf.rb +1 -1
  14. data/lib/libis/format/tool/pdf_copy.rb +1 -1
  15. data/lib/libis/format/tool/pdf_merge.rb +1 -1
  16. data/lib/libis/format/tool/pdf_split.rb +1 -1
  17. data/lib/libis/format/tool/pdf_to_pdfa.rb +1 -2
  18. data/lib/libis/format/tool/pdfa_validator.rb +3 -4
  19. data/lib/libis/format/tool/spreadsheet_to_ods.rb +1 -1
  20. data/lib/libis/format/version.rb +1 -1
  21. data/libis-format.gemspec +2 -2
  22. data/tools/fop/build/fop.jar +0 -0
  23. data/tools/fop/conf/fop.xconf +466 -0
  24. data/tools/fop/fop +258 -0
  25. data/tools/fop/fop.bat +75 -0
  26. data/tools/fop/fop.cmd +31 -0
  27. data/tools/fop/fop.js +341 -0
  28. data/tools/fop/lib/README.txt +243 -0
  29. data/tools/fop/lib/avalon-framework-api-4.3.1.jar +0 -0
  30. data/tools/fop/lib/avalon-framework-impl-4.3.1.jar +0 -0
  31. data/tools/fop/lib/avalon-framework.LICENSE.txt +175 -0
  32. data/tools/fop/lib/avalon-framework.NOTICE.TXT +11 -0
  33. data/tools/fop/lib/batik-all-1.10.jar +0 -0
  34. data/tools/fop/lib/batik.LICENSE.txt +201 -0
  35. data/tools/fop/lib/batik.NOTICE.txt +18 -0
  36. data/tools/fop/lib/commons-io-1.3.1.jar +0 -0
  37. data/tools/fop/lib/commons-io.LICENSE.txt +203 -0
  38. data/tools/fop/lib/commons-io.NOTICE.txt +6 -0
  39. data/tools/fop/lib/commons-logging-1.0.4.jar +0 -0
  40. data/tools/fop/lib/commons-logging.LICENSE.txt +202 -0
  41. data/tools/fop/lib/commons-logging.NOTICE.txt +3 -0
  42. data/tools/fop/lib/fontbox-2.0.7.jar +0 -0
  43. data/tools/fop/lib/serializer-2.7.2.jar +0 -0
  44. data/tools/fop/lib/serializer.LICENSE.txt +201 -0
  45. data/tools/fop/lib/serializer.NOTICE.txt +15 -0
  46. data/tools/fop/lib/xalan-2.7.2.jar +0 -0
  47. data/tools/fop/lib/xalan.BCEL.LICENSE.txt +52 -0
  48. data/tools/fop/lib/xalan.LICENSE.txt +202 -0
  49. data/tools/fop/lib/xalan.NOTICE.txt +44 -0
  50. data/tools/fop/lib/xalan.regexp.LICENSE.txt +52 -0
  51. data/tools/fop/lib/xalan.runtime.LICENSE.txt +20 -0
  52. data/tools/fop/lib/xerces.LICENSE.txt +56 -0
  53. data/tools/fop/lib/xercesImpl-2.9.1.jar +0 -0
  54. data/tools/fop/lib/xercesImpl.LICENSE.txt +201 -0
  55. data/tools/fop/lib/xercesImpl.NOTICE.txt +14 -0
  56. data/tools/fop/lib/xml-apis-1.3.04.jar +0 -0
  57. data/tools/fop/lib/xml-apis-ext-1.3.04.jar +0 -0
  58. data/tools/fop/lib/xml-apis-ext.LICENSE.dom-documentation.txt +73 -0
  59. data/tools/fop/lib/xml-apis-ext.LICENSE.dom-software.txt +61 -0
  60. data/tools/fop/lib/xml-apis-ext.LICENSE.sac.html +75 -0
  61. data/tools/fop/lib/xml-apis-ext.LICENSE.txt +202 -0
  62. data/tools/fop/lib/xml-apis-ext.NOTICE.txt +16 -0
  63. data/tools/fop/lib/xml-apis-ext.README.dom.txt +56 -0
  64. data/tools/fop/lib/xml-apis.LICENSE-SAX.html +17 -0
  65. data/tools/fop/lib/xml-apis.LICENSE.DOM-documentation.html +74 -0
  66. data/tools/fop/lib/xml-apis.LICENSE.DOM-software.html +66 -0
  67. data/tools/fop/lib/xml-apis.LICENSE.txt +201 -0
  68. data/tools/fop/lib/xml-apis.NOTICE.txt +13 -0
  69. data/tools/fop/lib/xmlgraphics-commons-2.3.jar +0 -0
  70. data/tools/fop/lib/xmlgraphics-commons.LICENSE.txt +202 -0
  71. data/tools/fop/lib/xmlgraphics-commons.NOTICE.txt +5 -0
  72. data/tools/pdfbox/pdfbox-app-2.0.13.jar +0 -0
  73. data/tools/pdfbox/{pdfbox-app-1.8.10.jar → preflight-app-2.0.13.jar} +0 -0
  74. metadata +57 -236
  75. data/spec/converter_audio_spec.rb +0 -66
  76. data/spec/converter_fop_spec.rb +0 -37
  77. data/spec/converter_image_spec.rb +0 -166
  78. data/spec/converter_office_spec.rb +0 -84
  79. data/spec/converter_pdf_spec.rb +0 -30
  80. data/spec/converter_repository_spec.rb +0 -97
  81. data/spec/converter_spreadsheet_spec.rb +0 -39
  82. data/spec/converter_video_spec.rb +0 -97
  83. data/spec/converter_xsl_spec.rb +0 -56
  84. data/spec/data/Cevennes2.bmp +0 -0
  85. data/spec/data/Cevennes2.jp2 +0 -0
  86. data/spec/data/Cevennes2.ppm +0 -22492
  87. data/spec/data/NikonRaw-CameraRaw.TIF +0 -0
  88. data/spec/data/NikonRaw-CaptureOne.tif +0 -0
  89. data/spec/data/audio/carlin_disappointed.aac +0 -0
  90. data/spec/data/audio/carlin_disappointed.ac3 +0 -0
  91. data/spec/data/audio/carlin_disappointed.aiff +0 -0
  92. data/spec/data/audio/carlin_disappointed.au +0 -0
  93. data/spec/data/audio/carlin_disappointed.flac +0 -0
  94. data/spec/data/audio/carlin_disappointed.m4a +0 -0
  95. data/spec/data/audio/carlin_disappointed.mka +0 -0
  96. data/spec/data/audio/carlin_disappointed.mp3 +0 -0
  97. data/spec/data/audio/carlin_disappointed.ogg +0 -0
  98. data/spec/data/audio/carlin_disappointed.ra +0 -0
  99. data/spec/data/audio/carlin_disappointed.voc +0 -0
  100. data/spec/data/audio/carlin_disappointed.wav +0 -0
  101. data/spec/data/audio/carlin_disappointed.wma +0 -0
  102. data/spec/data/audio/greensleeves.aac +0 -0
  103. data/spec/data/audio/greensleeves.ac3 +0 -0
  104. data/spec/data/audio/greensleeves.aiff +0 -0
  105. data/spec/data/audio/greensleeves.au +0 -0
  106. data/spec/data/audio/greensleeves.flac +0 -0
  107. data/spec/data/audio/greensleeves.m4a +0 -0
  108. data/spec/data/audio/greensleeves.mka +0 -0
  109. data/spec/data/audio/greensleeves.mp3 +0 -0
  110. data/spec/data/audio/greensleeves.ogg +0 -0
  111. data/spec/data/audio/greensleeves.ra +0 -0
  112. data/spec/data/audio/greensleeves.voc +0 -0
  113. data/spec/data/audio/greensleeves.wav +0 -0
  114. data/spec/data/audio/greensleeves.wma +0 -0
  115. data/spec/data/audio/king_nonviolence.aac +0 -0
  116. data/spec/data/audio/king_nonviolence.ac3 +0 -0
  117. data/spec/data/audio/king_nonviolence.aiff +0 -0
  118. data/spec/data/audio/king_nonviolence.au +0 -0
  119. data/spec/data/audio/king_nonviolence.flac +0 -0
  120. data/spec/data/audio/king_nonviolence.m4a +0 -0
  121. data/spec/data/audio/king_nonviolence.mka +0 -0
  122. data/spec/data/audio/king_nonviolence.mp3 +0 -0
  123. data/spec/data/audio/king_nonviolence.ogg +0 -0
  124. data/spec/data/audio/king_nonviolence.ra +0 -0
  125. data/spec/data/audio/king_nonviolence.voc +0 -0
  126. data/spec/data/audio/king_nonviolence.wav +0 -0
  127. data/spec/data/audio/king_nonviolence.wma +0 -0
  128. data/spec/data/audio/top_gun_secret.aac +0 -0
  129. data/spec/data/audio/top_gun_secret.ac3 +0 -0
  130. data/spec/data/audio/top_gun_secret.aiff +0 -0
  131. data/spec/data/audio/top_gun_secret.au +0 -0
  132. data/spec/data/audio/top_gun_secret.flac +0 -0
  133. data/spec/data/audio/top_gun_secret.m4a +0 -0
  134. data/spec/data/audio/top_gun_secret.mka +0 -0
  135. data/spec/data/audio/top_gun_secret.mp3 +0 -0
  136. data/spec/data/audio/top_gun_secret.ogg +0 -0
  137. data/spec/data/audio/top_gun_secret.ra +0 -0
  138. data/spec/data/audio/top_gun_secret.voc +0 -0
  139. data/spec/data/audio/top_gun_secret.wav +0 -0
  140. data/spec/data/audio/top_gun_secret.wma +0 -0
  141. data/spec/data/multipage.tif +0 -0
  142. data/spec/data/multipage.tif.jp2 +0 -0
  143. data/spec/data/test-ead.xml +0 -392
  144. data/spec/data/test-jpg.tif +0 -0
  145. data/spec/data/test-lzw.tif +0 -0
  146. data/spec/data/test-options.jpg +0 -0
  147. data/spec/data/test-options.png +0 -0
  148. data/spec/data/test.bmp +0 -0
  149. data/spec/data/test.doc +0 -0
  150. data/spec/data/test.docx +0 -0
  151. data/spec/data/test.gif +0 -0
  152. data/spec/data/test.jpg +0 -0
  153. data/spec/data/test.ods +0 -0
  154. data/spec/data/test.odt +0 -0
  155. data/spec/data/test.pdf +0 -0
  156. data/spec/data/test.pdf.tif +0 -0
  157. data/spec/data/test.png +0 -0
  158. data/spec/data/test.ps +0 -8631
  159. data/spec/data/test.psd +0 -0
  160. data/spec/data/test.rtf +0 -1455
  161. data/spec/data/test.tif +0 -0
  162. data/spec/data/test.txt +0 -12
  163. data/spec/data/test.xcf +0 -0
  164. data/spec/data/test.xls +0 -0
  165. data/spec/data/test.xlsx +0 -0
  166. data/spec/data/test.xml +0 -4
  167. data/spec/data/test_pdfa.pdf +0 -0
  168. data/spec/data/video/SampleVideo_1080x720_2mb.flv +0 -0
  169. data/spec/data/video/SampleVideo_1080x720_2mb.mkv +0 -0
  170. data/spec/data/video/SampleVideo_1080x720_2mb.mp4 +0 -0
  171. data/spec/data/video/SampleVideo_176x144_2mb.3gp +0 -0
  172. data/spec/data/video/SampleVideo_320x240_2mb.3gp +0 -0
  173. data/spec/data/video/SampleVideo_360x240_2mb.flv +0 -0
  174. data/spec/data/video/SampleVideo_360x240_2mb.mkv +0 -0
  175. data/spec/data/video/SampleVideo_360x240_2mb.mp4 +0 -0
  176. data/spec/data/video/copyright.png +0 -0
  177. data/spec/data/xml/134476_ead.XML +0 -1
  178. data/spec/data/xml/134476_ead.pdf +0 -0
  179. data/spec/data/xml/134476_fo.XML +0 -383
  180. data/spec/data/xml/134476_raw.XML +0 -141
  181. data/spec/data/xml/ead2fo_pdf.xsl +0 -1453
  182. data/spec/data/xml/header_nolink_pdf.xsl +0 -120
  183. data/spec/data/xml/lookupLists.xsl +0 -488
  184. data/spec/data/xml/scope_eadToHTML.xsl +0 -2376
  185. data/spec/data/xml/scope_xmlToEAD_dom.xsl +0 -952
  186. data/spec/identifier_spec.rb +0 -161
  187. data/spec/spec_helper.rb +0 -58
  188. data/spec/test_types.yml +0 -12
  189. data/spec/type_database_spec.rb +0 -140
  190. data/tools/pdfbox/preflight-app-1.8.10.jar +0 -0
@@ -1,66 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- require 'libis/format/converter/audio_converter'
5
-
6
- describe 'Converters' do
7
-
8
- let(:repository) {Libis::Format::Converter::Repository}
9
- let(:file_dir) {File.dirname(__FILE__)}
10
-
11
- before(:all) {
12
- Libis::Tools::Config.logger.level = 'off'
13
- }
14
-
15
- context 'Audio Converter' do
16
-
17
- let(:converter) {Libis::Format::Converter::AudioConverter.new}
18
- extensions = %w'aac aiff au flac m4a mka mp3 ra voc wav wma'
19
- confidence = {
20
- aac: 0.86,
21
- aiff: 0.99,
22
- au: 0.99,
23
- flac: 0.99,
24
- m4a: 0.93,
25
- mka: 0.94,
26
- mp3: 0.95,
27
- ra: 0.92,
28
- voc: 0.99,
29
- wav: 0.99,
30
- wma: 0.9
31
- }
32
- targets = %w'mp3 flac wav'
33
- sources = %w'carlin_disappointed greensleeves king_nonviolence top_gun_secret'
34
- quality = {
35
- carlin_disappointed: 1.0,
36
- greensleeves: 0.95,
37
- king_nonviolence: 1.0,
38
- top_gun_secret: 0.95
39
- }
40
-
41
- let(:data_dir) {File.join(file_dir, 'data', 'audio')}
42
-
43
- context 'converts' do
44
- sources.each do |source|
45
- extensions.each do |ext|
46
- next unless (File.exists?(File.join(File.dirname(__FILE__), 'data', 'audio', "#{source}.#{ext}")))
47
- (targets - [ext]).each do |tgt|
48
- it "#{source} #{ext} to #{tgt}" do
49
- src_file = File.join(data_dir, "#{source}.#{ext}")
50
- ref_file = File.join(data_dir, "#{source}.#{tgt}")
51
- tgt_file = File.join('', 'tmp', "test.#{source}.#{ext}.#{tgt}")
52
- FileUtils.remove tgt_file, force: true
53
- FileUtils.mkdir_p File.dirname(tgt_file)
54
- result = converter.convert(src_file, tgt_file, tgt.upcase.to_sym)
55
- expect(result).to eq tgt_file
56
- expect(result).to sound_like ref_file, confidence[ext.to_sym] * quality[source.to_sym], 11025, 1
57
- FileUtils.remove tgt_file, force: true
58
- end
59
- end
60
- end
61
- end
62
- end
63
-
64
- end
65
-
66
- end
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- require 'fileutils'
5
- require 'rspec/matchers'
6
-
7
- require 'libis/format/converter/fop_pdf_converter'
8
-
9
- describe 'Converters' do
10
-
11
- let(:repository) {Libis::Format::Converter::Repository}
12
- let(:file_dir) {File.dirname(__FILE__)}
13
-
14
- before(:all) {
15
- Libis::Tools::Config.logger.level = 'error'
16
- }
17
-
18
- context 'Apache FOP-PDF Converter' do
19
-
20
- let(:converter) {Libis::Format::Converter::FopPdfConverter.new}
21
- let(:data_dir) {File.join(file_dir, 'data', 'xml')}
22
-
23
- it 'converts XML-FO to PDF' do
24
- if File.exist?(Libis::Format::Config[:fop_jar])
25
- src_file = File.join data_dir, '134476_fo.XML'
26
- tgt_file = File.join '', 'tmp', '134476_ead.pdf'
27
- cmp_file = File.join data_dir, '134476_ead.pdf'
28
- FileUtils.remove tgt_file, force: true
29
- FileUtils.mkdir_p File.dirname(tgt_file)
30
- result = converter.convert src_file, tgt_file, :PDF
31
- expect(result).to eq tgt_file
32
- end
33
- end
34
-
35
- end
36
-
37
- end
@@ -1,166 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- require 'libis/format/converter/image_converter'
5
- require 'libis/format/converter/jp2_converter'
6
-
7
- describe 'Converters' do
8
-
9
- let(:repository) {Libis::Format::Converter::Repository}
10
- let(:file_dir) {File.dirname(__FILE__)}
11
-
12
- before(:all) {
13
- Libis::Tools::Config.logger.level = 'off'
14
- }
15
-
16
- context 'Image Converter' do
17
-
18
- let(:converter) {Libis::Format::Converter::ImageConverter.new}
19
- let(:diff_file) {File.join('', 'tmp', 'diff.jpg')}
20
-
21
- it 'converts TIFF to JPEG' do
22
- src_file = File.join(file_dir, 'data', 'test.tif')
23
- ref_file = File.join(file_dir, 'data', 'test.jpg')
24
- tgt_file = File.join('', 'tmp', 'test.jpg')
25
- FileUtils.mkdir_p File.dirname(tgt_file)
26
- converter.delete_date
27
- result = converter.convert(src_file, tgt_file, :JPG)
28
- expect(result).to eq tgt_file
29
- compare = MiniMagick::Tool::Compare.new
30
- compare << ref_file << tgt_file
31
- compare.metric << 'MAE'
32
- compare.fuzz << '1%'
33
- compare << diff_file
34
- compare.call {|_, _, status| expect(status).to be 0}
35
- FileUtils.rm tgt_file, force: true
36
- FileUtils.rm diff_file, force: true
37
- end
38
-
39
- it 'converts TIFF to PNG' do
40
- src_file = File.join(file_dir, 'data', 'test.tif')
41
- ref_file = File.join(file_dir, 'data', 'test.png')
42
- tgt_file = File.join('', 'tmp', 'test.png')
43
- FileUtils.mkdir_p File.dirname(tgt_file)
44
- converter.delete_date
45
- converter.page(0)
46
- result = converter.convert(src_file, tgt_file, :PNG)
47
- expect(result).to eq tgt_file
48
- compare = MiniMagick::Tool::Compare.new
49
- compare << ref_file << tgt_file
50
- compare.metric << 'MAE'
51
- compare << diff_file
52
- compare.call {|_, _, status| expect(status).to be 0}
53
- FileUtils.rm tgt_file, force: true
54
- FileUtils.rm diff_file, force: true
55
- end
56
-
57
- it 'converts PDF to TIFF' do
58
- src_file = File.join(file_dir, 'data', 'test.pdf')
59
- ref_file = File.join(file_dir, 'data', 'test.pdf.tif')
60
- tgt_file = File.join('', 'tmp', 'test.pdf.tif')
61
- FileUtils.mkdir_p File.dirname(tgt_file)
62
- converter.delete_date
63
- result = converter.convert(src_file, tgt_file, :TIFF)
64
- expect(result).to eq tgt_file
65
- compare = MiniMagick::Tool::Compare.new
66
- compare << ref_file << tgt_file
67
- compare.metric << 'AE'
68
- compare.fuzz << '100%'
69
- compare << diff_file
70
- compare.call {|_, _, status| expect(status).to be 0}
71
- FileUtils.rm tgt_file, force: true
72
- FileUtils.rm diff_file, force: true
73
- end
74
-
75
- it 'converts TIFF to PNG with many options' do
76
- src_file = File.join(file_dir, 'data', 'test.tif')
77
- ref_file = File.join(file_dir, 'data', 'test-options.png')
78
- tgt_file = File.join('', 'tmp', 'test-options.png')
79
- FileUtils.mkdir_p File.dirname(tgt_file)
80
- converter.watermark(text: 'RSPEC', size: 5, opacity: 0.1, rotation: 15, gap: 0.5, composition: 'modulate')
81
- converter.delete_date
82
- result = converter.convert(src_file, tgt_file, :PNG, options: {scale: '150%'})
83
- expect(result).to eq tgt_file
84
- compare = MiniMagick::Tool::Compare.new
85
- compare << ref_file << tgt_file
86
- compare.metric << 'AE'
87
- compare.fuzz << '100%'
88
- compare << diff_file
89
- compare.call do |_stdin, _stdout, status|
90
- expect(status).to be 0
91
- end
92
- FileUtils.rm tgt_file, force: true
93
- FileUtils.rm diff_file, force: true
94
- end
95
-
96
- it 'converts only first page of multipage TIFF to JP2' do
97
- src_file = File.join(file_dir, 'data', 'multipage.tif')
98
- ref_file = File.join(file_dir, 'data', 'multipage.tif.jp2')
99
- tgt_file = File.join('', 'tmp', 'test.jp2')
100
- FileUtils.mkdir_p File.dirname(tgt_file)
101
- converter.delete_date
102
- converter.quiet(true)
103
- converter.page(0)
104
- result = converter.convert(src_file, tgt_file, :JP2)
105
- expect(result).to eq tgt_file
106
- expect(File.exist?(tgt_file)).to be_truthy
107
- compare = MiniMagick::Tool::Compare.new
108
- compare << ref_file << tgt_file
109
- compare.metric << 'MAE'
110
- compare.fuzz << '10%'
111
- compare << diff_file
112
- compare.call {|_, _, status| expect(status).to be 0}
113
- FileUtils.rm tgt_file, force: true
114
- FileUtils.rm diff_file, force: true
115
- end
116
-
117
- it 'converts TIFF to JP2' do
118
- src_file = File.join(file_dir, 'data', 'test.tif')
119
- tgt_file = File.join('', 'tmp', 'test.jp2')
120
- FileUtils.mkdir_p File.dirname(tgt_file)
121
- converter.delete_date
122
- result = converter.convert(src_file, tgt_file, :JP2)
123
- expect(result).to eq tgt_file
124
- expect(File.exist?(tgt_file)).to be_truthy
125
- FileUtils.rm tgt_file, force: true
126
- end
127
-
128
-
129
- end
130
-
131
- context 'JP2 Converter', if: File.exists?(Libis::Format::Config[:j2kdriver]) do
132
-
133
- let(:converter) {Libis::Format::Converter::Jp2Converter.new}
134
- let(:diff_file) {File.join('', 'tmp', 'diff.jpg')}
135
-
136
- it 'converts TIFF to JP2' do
137
- src_file = File.join(file_dir, 'data', 'test.tif')
138
- tgt_file = File.join('', 'tmp', 'test.jp2')
139
- FileUtils.mkdir_p File.dirname(tgt_file)
140
- result = converter.convert(src_file, tgt_file, :JP2)
141
- expect(result).to eq tgt_file
142
- expect(File.exist?(tgt_file)).to be_truthy
143
- FileUtils.rm tgt_file, force: true
144
- end
145
-
146
- it 'converts only first page of multipage TIFF to JP2' do
147
- src_file = File.join(file_dir, 'data', 'multipage.tif')
148
- ref_file = File.join(file_dir, 'data', 'multipage.tif.jp2')
149
- tgt_file = File.join('', 'tmp', 'test.jp2')
150
- FileUtils.mkdir_p File.dirname(tgt_file)
151
- result = converter.convert(src_file, tgt_file, :JP2)
152
- expect(result).to eq tgt_file
153
- expect(File.exist?(tgt_file)).to be_truthy
154
- compare = MiniMagick::Tool::Compare.new
155
- compare << ref_file << tgt_file
156
- compare.metric << 'MAE'
157
- compare.fuzz << '10%'
158
- compare << diff_file
159
- compare.call {|_, _, status| expect(status).to be 0}
160
- FileUtils.rm tgt_file, force: true
161
- FileUtils.rm diff_file, force: true
162
- end
163
-
164
- end
165
-
166
- end
@@ -1,84 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- require 'libis/format/converter/office_converter'
5
-
6
- describe 'Converters' do
7
-
8
- let(:repository) {Libis::Format::Converter::Repository}
9
- let(:file_dir) {File.dirname(__FILE__)}
10
-
11
- before(:all) {
12
- Libis::Tools::Config.logger.level = 'off'
13
- }
14
-
15
- context 'Office Converter' do
16
-
17
- let(:converter) {Libis::Format::Converter::OfficeConverter.new}
18
-
19
- it 'converts Word document to PDF' do
20
- src_file = File.join(file_dir, 'data', 'test.doc')
21
- tgt_file = File.join(file_dir, 'work', 'test_doc.pdf')
22
- FileUtils.mkdir_p File.dirname(tgt_file)
23
- result = converter.convert(src_file, tgt_file, :PDF)
24
- expect(result).to eq tgt_file
25
- FileUtils.rm tgt_file, force: true
26
- end
27
-
28
- it 'converts Word 2010 document to PDF' do
29
- src_file = File.join(file_dir, 'data', 'test.docx')
30
- tgt_file = File.join(file_dir, 'work', 'test_docx.pdf')
31
- FileUtils.mkdir_p File.dirname(tgt_file)
32
- result = converter.convert(src_file, tgt_file, :PDF)
33
- expect(result).to eq tgt_file
34
- FileUtils.rm tgt_file, force: true
35
- end
36
-
37
- it 'converts OpenOffice document to PDF' do
38
- src_file = File.join(file_dir, 'data', 'test.odt')
39
- tgt_file = File.join(file_dir, 'work', 'test_odt.pdf')
40
- FileUtils.mkdir_p File.dirname(tgt_file)
41
- result = converter.convert(src_file, tgt_file, :PDF)
42
- expect(result).to eq tgt_file
43
- FileUtils.rm tgt_file, force: true
44
- end
45
-
46
- it 'converts RTF document to PDF' do
47
- src_file = File.join(file_dir, 'data', 'test.rtf')
48
- tgt_file = File.join(file_dir, 'work', 'test_rtf.pdf')
49
- FileUtils.mkdir_p File.dirname(tgt_file)
50
- result = converter.convert(src_file, tgt_file, :PDF)
51
- expect(result).to eq tgt_file
52
- FileUtils.rm tgt_file, force: true
53
- end
54
-
55
- it 'converts TXT document to PDF' do
56
- src_file = File.join(file_dir, 'data', 'test.txt')
57
- tgt_file = File.join(file_dir, 'work', 'test_txt.pdf')
58
- FileUtils.mkdir_p File.dirname(tgt_file)
59
- result = converter.convert(src_file, tgt_file, :PDF)
60
- expect(result).to eq tgt_file
61
- FileUtils.rm tgt_file, force: true
62
- end
63
-
64
- it 'converts Excel to PDF' do
65
- src_file = File.join(file_dir, 'data', 'test.xls')
66
- tgt_file = File.join(file_dir, 'work', 'test_xls.pdf')
67
- FileUtils.mkdir_p File.dirname(tgt_file)
68
- result = converter.convert(src_file, tgt_file, :PDF)
69
- expect(result).to eq tgt_file
70
- FileUtils.rm tgt_file, force: true
71
- end
72
-
73
- it 'converts Excel 2011 to PDF' do
74
- src_file = File.join(file_dir, 'data', 'test.xlsx')
75
- tgt_file = File.join(file_dir, 'work', 'test_xlsx.pdf')
76
- FileUtils.mkdir_p File.dirname(tgt_file)
77
- result = converter.convert(src_file, tgt_file, :PDF)
78
- expect(result).to eq tgt_file
79
- FileUtils.rm tgt_file, force: true
80
- end
81
-
82
- end
83
-
84
- end
@@ -1,30 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- require 'libis/format/converter/pdf_converter'
5
-
6
- describe 'Converters' do
7
-
8
- let(:repository) {Libis::Format::Converter::Repository}
9
- let(:file_dir) {File.dirname(__FILE__)}
10
-
11
- before(:all) {
12
- Libis::Tools::Config.logger.level = 'off'
13
- }
14
-
15
- context 'Pdf Converter', if: File.exists?(Libis::Format::Config[:ghostscript_path]) do
16
-
17
- let(:converter) {Libis::Format::Converter::PdfConverter.new}
18
-
19
- it 'converts PDF to PDF/A' do
20
- src_file = File.join(file_dir, 'data', 'test.pdf')
21
- tgt_file = File.join('', 'tmp', 'test_pdfa.pdf')
22
- FileUtils.mkdir_p File.dirname(tgt_file)
23
- result = converter.convert(src_file, tgt_file, :PDFA)
24
- expect(result).to eq tgt_file
25
- FileUtils.rm tgt_file, force: true
26
- end
27
-
28
- end
29
-
30
- end
@@ -1,97 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'Converters' do
5
-
6
- let(:repository) {Libis::Format::Converter::Repository}
7
- let(:file_dir) {File.dirname(__FILE__)}
8
-
9
- before(:all) {
10
- Libis::Tools::Config.logger.level = 'off'
11
- }
12
-
13
- context 'Repository' do
14
-
15
- it 'loads all converters' do
16
- expect(repository.get_converters.size).to eq 9
17
- # noinspection RubyResolve
18
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::ImageConverter'
19
- # noinspection RubyResolve
20
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::OfficeConverter'
21
- # noinspection RubyResolve
22
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::SpreadsheetConverter'
23
- # noinspection RubyResolve
24
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::PdfConverter'
25
- # noinspection RubyResolve
26
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::Jp2Converter'
27
- # noinspection RubyResolve
28
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::AudioConverter'
29
- # noinspection RubyResolve
30
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::VideoConverter'
31
- # noinspection RubyResolve
32
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::XsltConverter'
33
- # noinspection RubyResolve
34
- expect(repository.get_converters.map(&:to_s)).to include 'Libis::Format::Converter::FopPdfConverter'
35
- end
36
-
37
- it 'creates simple converter chain' do
38
- chain = repository.get_converter_chain(:TIFF, :PDF)
39
- expect(chain).to_not be nil
40
- expect(chain.to_array.size).to eq 1
41
- expect(chain.to_array).to match [{converter: Libis::Format::Converter::ImageConverter, input: :TIFF, output: :PDF}]
42
- end
43
-
44
- it 'creates complex chain' do
45
- chain = repository.get_converter_chain(:TIFF, :PDFA)
46
- expect(chain).to_not be nil
47
- expect(chain.to_array.size).to eq 2
48
- expect(chain.to_array).to match [
49
- {converter: Libis::Format::Converter::ImageConverter, input: :TIFF, output: :PDF},
50
- {converter: Libis::Format::Converter::PdfConverter, input: :PDF, output: :PDFA},
51
- ]
52
- end
53
-
54
- it 'creates converter chain with options' do
55
- chain = repository.get_converter_chain(:TIFF, :PDF, {watermark: {}})
56
- expect(chain).to_not be nil
57
- expect(chain.to_array.size).to eq 1
58
- expect(chain.to_array).to match [
59
- {converter: Libis::Format::Converter::ImageConverter, input: :TIFF, output: :PDF, operations: [{method: :watermark, argument: {}}]}
60
- ]
61
- end
62
-
63
- it 'perfers operations to the end of the chain' do
64
- chain = repository.get_converter_chain(:TIFF, :PDFA, {watermark: {}})
65
- expect(chain).to_not be nil
66
- expect(chain.to_array.size).to eq 2
67
- expect(chain.to_array).to match [
68
- {converter: Libis::Format::Converter::ImageConverter, input: :TIFF, output: :PDF},
69
- {converter: Libis::Format::Converter::PdfConverter, input: :PDF, output: :PDFA, operations: [{method: :watermark, argument: {}}]}
70
- ]
71
- end
72
-
73
- context 'create chain for TIFF to JP2' do
74
-
75
- it 'without operators' do
76
- chain = repository.get_converter_chain(:TIFF, :JP2)
77
- expect(chain).to_not be nil
78
- expect(chain.to_array.size).to eq 1
79
- expect(chain.to_array).to match [
80
- {converter: Libis::Format::Converter::ImageConverter, input: :TIFF, output: :JP2}
81
- ]
82
- end
83
-
84
- it 'with force operator' do
85
- chain = repository.get_converter_chain(:TIFF, :JP2, {lossless: true})
86
- expect(chain).to_not be nil
87
- expect(chain.to_array.size).to eq 1
88
- expect(chain.to_array).to match [
89
- {converter: Libis::Format::Converter::Jp2Converter, input: :TIFF, output: :JP2, operations: [{method: :lossless, argument: true}]}
90
- ]
91
- end
92
-
93
- end
94
-
95
- end
96
-
97
- end