Sha256: 26799a95136a36a24333f43184ef7c1a5062185a113ec5995c4c421713a4b5bd

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

module Mork
  describe Magicko do
    let(:sh) { sample_img :slanted }
    let(:ma) { Magicko.new sh.filename }
    let(:co) { Coord.new 50}
    let(:pp) { { tl: {x: 10, y: 10}, tr: {x: 1000, y: 10}, bl: {x: 10, y: 1700}, br: {x: 1000, y: 1700}} }

    it 'exists' do
      expect(Magicko.new 1).to be_a Magicko
    end

    describe '#width' do
      it 'returns the image width' do
        expect(ma.width).to eq sh.width
      end
    end

    describe '#height' do
      it 'returns the image height' do
        expect(ma.height).to eq sh.height
      end
    end

    describe '#rm_patch' do
      it 'returns an array of bytes for the registration mark area' do
        expect(ma.rm_patch co).to be_an Array
      end

      it 'returns an Array of appropriate size' do
        expect(ma.rm_patch(co).length).to eq 2500
      end
    end

    describe '#registered_bytes' do
      it 'returns an array of bytes for the registered image' do
        expect(ma.registered_bytes pp).to be_an Array
      end

      it 'returns an array of bytes of the same size as the original image' do
        expect(ma.registered_bytes(pp).length).to eq sh.height*sh.width
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mork-0.8.1 spec/mork/magicko_spec.rb
mork-0.8.0 spec/mork/magicko_spec.rb
mork-0.7.0 spec/mork/magicko_spec.rb