Sha256: 290dde4a5b16fd75e72b72c40807cb22a57eb500f50a37c3f3cd1fc2bc02c52b
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Assembly::Image::Jp2Creator do subject(:result) { creator.create } let(:ai) { Assembly::Image.new(input_path) } let(:input_path) { TEST_TIF_INPUT_FILE } let(:creator) { described_class.new(ai, output: TEST_JP2_OUTPUT_FILE) } before { cleanup } context 'when given an LZW compressed RGB tif' do before do generate_test_image(TEST_TIF_INPUT_FILE, compress: 'lzw') end it 'creates the jp2 with a temp file' do expect(File).to exist TEST_TIF_INPUT_FILE expect(File).not_to exist TEST_JP2_OUTPUT_FILE expect(result).to be_a_kind_of Assembly::Image expect(result.path).to eq TEST_JP2_OUTPUT_FILE expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2 # Indicates a temp tiff was not created. expect(creator.tmp_path).not_to be_nil expect(result.exif.colorspace).to eq 'sRGB' jp2 = Assembly::Image.new(TEST_JP2_OUTPUT_FILE) expect(jp2.height).to eq 36 expect(jp2.width).to eq 43 end end context 'when the input file is a JPEG' do before do generate_test_image(TEST_JPEG_INPUT_FILE) end let(:input_path) { TEST_JPEG_INPUT_FILE } it 'creates jp2 when given a JPEG' do expect(File).to exist TEST_JPEG_INPUT_FILE expect(File).not_to exist TEST_JP2_OUTPUT_FILE expect(result).to be_a_kind_of Assembly::Image expect(result.path).to eq TEST_JP2_OUTPUT_FILE expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2 # Indicates a temp tiff was created. expect(creator.tmp_path).not_to be_nil expect(File).not_to exist creator.tmp_path end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
assembly-image-2.0.0 | spec/assembly/image/jp2_creator_spec.rb |