From 398193aeeb206619e9a387dfd4bb928fd00707ea Mon Sep 17 00:00:00 2001 From: Konrad Date: Mon, 30 Sep 2024 16:13:13 +0200 Subject: [PATCH] test(operation/straighten): add test coverage for negative angle and vertical image - negative angle seemed prudent - vertical image validates the code for choosing longer edge for scaling and therefore preventing insufficient zooming --- spec/morandi_spec.rb | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/spec/morandi_spec.rb b/spec/morandi_spec.rb index 335b28d..f6ac85c 100644 --- a/spec/morandi_spec.rb +++ b/spec/morandi_spec.rb @@ -261,12 +261,35 @@ describe 'when given a straighten option' do let(:options) { { 'straighten' => 5 } } - it 'should reduce the straighten images' do + it 'straightens images' do process_image expect(File).to exist(file_out) expect(processed_image_type).to eq('jpeg') end + + context 'with a negative straighten value' do + let(:options) { { 'straighten' => -20 } } + + it 'straightens images' do + process_image + + expect(File).to exist(file_out) + expect(processed_image_type).to eq('jpeg') + end + end + + context 'with vertical image' do + let(:original_image_width) { 100 } + let(:original_image_height) { 400 } + + it 'straightens images' do + process_image + + expect(File).to exist(file_out) + expect(processed_image_type).to eq('jpeg') + end + end end describe 'when given a gamma option' do @@ -331,7 +354,7 @@ 100))).to be_greyish end - context 'with a black image and invalid spots' do + context 'with a gray image and invalid spots' do let(:file_arg) { solid_colour_image(800, 800, 0x666666ff) } let(:options) { { 'redeye' => [[540, 650], [-100, 100]] } }