Sha256: dc3f8cdc16f906b08e7b0b3da8c810294609a98d973838019323503c9ebea470

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe 'handling T stage images' do

  let(:image) { ImageHelpers.left_t_stage }
  let(:sqed) do
    Sqed.new(
      image: image,
      pattern: :left_t,
      boundary_color: :red,
      has_border: false )
  end

  let(:m) do
    { 0 => 'annotated_specimen',
      1 => 'identifier',
      2 => 'image_registration'
    }
  end

  context 'simple boundaries - without thumbnail' do
    let(:s) { Sqed.new(
      image: image, metadata_map: m, use_thumbnail: false,
      layout: :left_t, 
      boundary_finder: Sqed::BoundaryFinder::ColorLineFinder,
      boundary_color: :red,
      has_border: false ) }

    specify 'boundaries are reasonable' do
      s.result
      c = s.boundaries.coordinates
      c.each do |section, values|
        c[section].each_with_index do |v, i|
          msg = "section #{section}, index #{i} has a bad value '#{v}'"
          expect(v > -1).to be_truthy, msg
        end
      end
    end
  end

  context 'boundaries - with_thumbnail' do
    let(:s) { Sqed.new(
      image: image,
      use_thumbnail: true,
      pattern: :left_t,
      boundary_color: :red,
      has_border: false ) }

    specify 'boundaries are reasonable' do
      s.result
      c = s.boundaries.coordinates
      c.each do |section, values|
        c[section].each_with_index do |v, i|
          msg = "section #{section}, index #{i} has a bad value '#{v}'"
          expect(v > -1).to be_truthy, msg
        end
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sqed-0.8.3 spec/lib/stage_handling/left_t_stage_spec.rb
sqed-0.8.2 spec/lib/stage_handling/left_t_stage_spec.rb
sqed-0.8.1 spec/lib/stage_handling/left_t_stage_spec.rb
sqed-0.8.0 spec/lib/stage_handling/left_t_stage_spec.rb