spec/rtesseract_spec.rb in rtesseract-1.3.2 vs spec/rtesseract_spec.rb in rtesseract-1.3.3
- old
+ new
@@ -36,11 +36,11 @@
it ' should not error with depth > 32' do
#expect(RTesseract.new(@path.join('images', 'README.pdf').to_s, debug: true).to_s_without_spaces).to eql('')
end
- it ' support diferent processors' do
+ it ' support different processors' do
# Rmagick
expect(RTesseract.new(@image_tif).to_s_without_spaces).to eql('43XF')
expect(RTesseract.new(@image_tif, processor: 'rmagick').to_s_without_spaces).to eql('43XF')
expect(RTesseract.new(@path.join('images', 'test.png').to_s, processor: 'rmagick').to_s_without_spaces).to eql('HW9W')
@@ -54,10 +54,11 @@
# NoneMagick
expect(RTesseract.new(@image_tif, processor: 'none').to_s_without_spaces).to eql('43XF')
end
+
it ' change the image' do
image = RTesseract.new(@image_tif)
expect(image.to_s_without_spaces).to eql('43XF')
image.source = @path.join('images', 'test1.tif').to_s
expect(image.to_s_without_spaces).to eql('V2V4')
@@ -182,6 +183,35 @@
rtesseract = RTesseract.new('.')
rtesseract.remove_file(Tempfile.new('config'))
expect { rtesseract.remove_file(Pathname.new(Dir.tmpdir).join('test_not_exists')) }.to raise_error(RTesseract::TempFilesNotRemovedError)
end
+
+ it ' support default config processors' do
+ # Rmagick
+ RTesseract.configure {|config| config.processor = 'rmagick' }
+ expect(RTesseract.new(@image_tif).processor.a_name?('rmagick')).to eql(true)
+
+ # MiniMagick
+ RTesseract.configure {|config| config.processor = 'mini_magick' }
+ expect(RTesseract.new(@image_tif).processor.a_name?('mini_magick')).to eql(true)
+
+ # QuickMagick
+ RTesseract.configure {|config| config.processor = 'quick_magick' }
+ expect(RTesseract.new(@image_tif).processor.a_name?('quick_magick')).to eql(true)
+
+ # NoneMagick
+ RTesseract.configure {|config| config.processor = 'none' }
+ expect(RTesseract.new(@image_tif).processor.a_name?('none')).to eql(true)
+
+ # overwrite default
+ RTesseract.configure {|config| config.processor = 'mini_magick' }
+ expect(RTesseract.new(@image_tif, processor: 'quick_magick').processor.a_name?('quick_magick')).to eql(true)
+
+ RTesseract.configure {|config| config.lang = 'portuguese' }
+ expect(RTesseract.new(@image_tif).lang).to eql(' -l por ')
+
+ RTesseract.configure {|config| config.psm = 7 }
+ expect(RTesseract.new(@image_tif).psm).to eql(' -psm 7 ')
+ end
+
end