Skip to content

Commit

Permalink
add imageResize tests for blurfactor and interpolation LDEV-2102
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Mar 4, 2021
1 parent 397ca4b commit 1c5ee01
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/functions/ImageResize.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}

}
Expand Down

0 comments on commit 1c5ee01

Please sign in to comment.