Sha256: 0726251947d1c41352bab00cca917cf8249c881d8142f891d5f7ea02c2efc350

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

require File.dirname(__FILE__) + '/common'
require_relative "../lib/ocr"

describe OCR do
  
  it "should be able to output help output" do
    OCR.version.should_not be_blank
  end
  
  it "should be able to grab some digits" do
    success = true
    for file in Dir['images/*[0-9].bmp']
      options = {}
      options[:should_invert] = true if file =~ /hulu/
      file =~ /(.)\.bmp/
      expected_digit = $1.to_i
      if OCR.identify_digit(File.binread(file), options) != expected_digit
        p "fail:" + file
        require 'ruby-debug'
        debugger
        OCR.identify_digit(File.binread(file), options)
        success = false
      end
    end
    fail unless success
  end
  
  it "should be able to grab a colon" do
    pending "caring about colons"
    OCR.identify_digit(File.binread("images/colon.bmp"), :might_be_colon => true).should == ":"
  end
  
  it "should return nil if it can't identify a digit" do
    OCR.identify_digit(File.binread("images/black.bmp")).should be_nil
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sensible-cinema-0.7.7 spec/ocr.spec.rb
sensible-cinema-0.7.5 spec/ocr.spec.orb
sensible-cinema-0.7.4 spec/ocr.spec.orb
sensible-cinema-0.7.3 spec/ocr.spec.orb
sensible-cinema-0.7.2 spec/ocr.spec.orb