protected function ImageEffectsTestBase::assertTextOverlay in Image Effects 8.3
Same name and namespace in other branches
- 8 tests/src/Functional/ImageEffectsTestBase.php \Drupal\Tests\image_effects\Functional\ImageEffectsTestBase::assertTextOverlay()
- 8.2 tests/src/Functional/ImageEffectsTestBase.php \Drupal\Tests\image_effects\Functional\ImageEffectsTestBase::assertTextOverlay()
Asserts a Text overlay image.
1 call to ImageEffectsTestBase::assertTextOverlay()
- TextOverlayTest::testTextOverlayEffect in tests/
src/ Functional/ Effect/ TextOverlayTest.php - Text overlay effect test.
File
- tests/
src/ Functional/ ImageEffectsTestBase.php, line 362
Class
- ImageEffectsTestBase
- Base test class for image_effects tests.
Namespace
Drupal\Tests\image_effects\FunctionalCode
protected function assertTextOverlay($image, $width, $height) : void {
$w_error = abs($image
->getWidth() - $width);
$h_error = abs($image
->getHeight() - $height);
$tolerance = 0.1;
$this
->assertTrue($w_error < $width * $tolerance && $h_error < $height * $tolerance, "Width and height ({$image->getWidth()}x{$image->getHeight()}) approximate expected results ({$width}x{$height})");
}