From 1c5ee0167d3fe1e6760a702d44203976326241c8 Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Thu, 4 Mar 2021 12:38:15 +0100 Subject: [PATCH] add imageResize tests for blurfactor and interpolation LDEV-2102 https://github.com/lucee/extension-image/pull/2 https://luceeserver.atlassian.net/browse/LDEV-2102 --- test/functions/ImageResize.cfc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/test/functions/ImageResize.cfc b/test/functions/ImageResize.cfc index 03b80a5a02..62e8526645 100644 --- a/test/functions/ImageResize.cfc +++ b/test/functions/ImageResize.cfc @@ -28,7 +28,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { variables.image=imagenew(variables.binary); } - public void function test() localmode="true"{ + public void function testImageResize() localmode="true"{ var info=image.info(); assertEquals(92,info.width); assertEquals(59,info.height); @@ -44,7 +44,26 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { var info=image.info(); assertEquals(92,info.width); assertEquals(59,info.height); - + } + public void function testImageResizeInterpolation() localmode="true"{ + local.resample = "highestQuality,highQuality,mediumQuality,highestPerformance,highPerformance,mediumPerformance," + "nearest,bilinear,bicubic,bessel,blackman,hamming,hanning,hermite,lanczos,mitchell,quadratic"; + + loop list="#local.resample#" item="local.interpolation" { + expect(ImageResize( image=image, width=20, height=20, interpolation=local.interpolation)).toBeNull(); + } + } + public void function testImageResizeBlurFactor() localmode="true"{ + expect(function(){ + ImageResize( image=image, width=20, height=20, blurFactor=-1) + }).toThrow(); + expect(function(){ + ImageResize( image=image, width=20, height=20, blurFactor=11) + }).toThrow(); + + expect(ImageResize( image=image, width=20, height=20, blurFactor=5)).toBeNull(); + expect(ImageResize( image=image, width=20, height=20, blurFactor=0)).toBeNull(); + expect(ImageResize( image=image, width=20, height=20, blurFactor=10)).toBeNull(); } }