public function FocalPointEffectsTest::testTransformFocalPoint in Focal Point 8
Test the focal point transformation.
@covers ::transformFocalPoint
@dataProvider transformFocalPointProvider
File
- tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php, line 100
Class
- FocalPointEffectsTest
- Tests the Focal Point image effects.
Namespace
Drupal\Tests\focal_point\Unit\EffectsCode
public function testTransformFocalPoint($image_dimensions, $original_image_dimensions, $original_focal_point, $expected_focal_point) {
$image = $this
->getTestImage($image_dimensions['width'], $image_dimensions['height']);
$original_image = $this
->getTestImage($original_image_dimensions['width'], $original_image_dimensions['height']);
// Use reflection to test a private/protected method.
$effect = $this
->getTestEffect($original_image);
$effect_reflection = new \ReflectionClass(TestFocalPointEffectBase::class);
$method = $effect_reflection
->getMethod('transformFocalPoint');
$method
->setAccessible(TRUE);
$this
->assertSame($expected_focal_point, $method
->invokeArgs($effect, [
$image,
$original_focal_point,
]));
}