Sha256: 78a2f578a71023ac229655d603b0e7410aa71f80eb956bebd98d536d795840f2

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

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
        success = false
      end
    end
    fail unless success
  end
  
  it "should be able to grab a colon" do
    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

4 entries across 4 versions & 1 rubygems

Version Path
sensible-cinema-0.7.1 spec/ocr.spec.orb
sensible-cinema-0.7.0 spec/spec.ocr.rb
sensible-cinema-0.6.1 spec/spec.ocr.rb
sensible-cinema-0.6.0 spec/spec.ocr.rb