You are here

protected function TextimageTestCase::assertTextimage in Textimage 7.3

Asserts a Textimage.

2 calls to TextimageTestCase::assertTextimage()
TextimageApiTest::testTextimageApi in tests/textimage.test
Test functionality of the API.
TextimageTest::testTextimage in tests/textimage.test
Test functionality of the module.

File

tests/textimage.test, line 137
Textimage - web test case script.

Class

TextimageTestCase
This class provides methods for testing Textimage.

Code

protected function assertTextimage($path, $width, $height) {
  $image = image_load($path);
  $w_error = abs($image->info['width'] - $width);
  $h_error = abs($image->info['height'] - $height);
  $tolerance = 0.1;
  $this
    ->assertTrue($w_error < $width * $tolerance && $h_error < $height * $tolerance, t('Textimage width and height (@act_wx@act_h) approximate expected results (@exp_wx@exp_h)', array(
    '@act_w' => $image->info['width'],
    '@act_h' => $image->info['height'],
    '@exp_w' => $width,
    '@exp_h' => $height,
  )));
}