X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fimage%2Ftests%2Fsrc%2FFunctional%2FImageEffectsTest.php;fp=web%2Fcore%2Fmodules%2Fimage%2Ftests%2Fsrc%2FFunctional%2FImageEffectsTest.php;h=f6b4ab36e92f2a95fba0dc5499e682a110a88726;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=3207442ab272543e12d2ba0c444411cfdbd359d9;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/image/tests/src/Functional/ImageEffectsTest.php b/web/core/modules/image/tests/src/Functional/ImageEffectsTest.php index 3207442ab..f6b4ab36e 100644 --- a/web/core/modules/image/tests/src/Functional/ImageEffectsTest.php +++ b/web/core/modules/image/tests/src/Functional/ImageEffectsTest.php @@ -111,8 +111,29 @@ class ImageEffectsTest extends ToolkitTestBase { // Check the parameters. $calls = $this->imageTestGetAllCalls(); - $this->assertEqual($calls['scale_and_crop'][0][0], 5, 'Width was computed and passed correctly'); - $this->assertEqual($calls['scale_and_crop'][0][1], 10, 'Height was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][0], 7.5, 'X was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][1], 0, 'Y was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][2], 5, 'Width was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][3], 10, 'Height was computed and passed correctly'); + } + + /** + * Test the image_scale_and_crop_effect() function with an anchor. + */ + public function testScaleAndCropEffectWithAnchor() { + $this->assertImageEffect('image_scale_and_crop', [ + 'anchor' => 'top-1', + 'width' => 5, + 'height' => 10, + ]); + $this->assertToolkitOperationsCalled(['scale_and_crop']); + + // Check the parameters. + $calls = $this->imageTestGetAllCalls(); + $this->assertEqual($calls['scale_and_crop'][0][0], 0, 'X was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][1], 1, 'Y was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][2], 5, 'Width was computed and passed correctly'); + $this->assertEqual($calls['scale_and_crop'][0][3], 10, 'Height was computed and passed correctly'); } /**