Skip to content

Commit 12c1244

Browse files
committed
MAGETWO-62464: Travis CI: GD2 imagettfbbox creates image with invalid size
1 parent 5712618 commit 12c1244

File tree

2 files changed

+3
-7
lines changed
  • dev/tests/integration/testsuite/Magento/Framework/Image/Adapter
  • lib/internal/Magento/Framework/Image/Adapter

2 files changed

+3
-7
lines changed

dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\Framework\Image\Adapter;
77

8-
use Magento\Framework\App\Filesystem\DirectoryList;
9-
108
/**
119
* @magentoAppIsolation enabled
1210
*/
@@ -547,9 +545,7 @@ public function cropDataProvider()
547545
*/
548546
public function testCreatePngFromString($pixel1, $expectedColor1, $pixel2, $expectedColor2, $adapterType)
549547
{
550-
if (!function_exists('imagettfbbox')
551-
|| (getenv('TRAVIS') && getenv('TRAVIS_PHP_VERSION') == '7.1')
552-
) {
548+
if (!function_exists('imagettfbbox')) {
553549
$this->markTestSkipped('Workaround for problem with imagettfbbox() function on Travis');
554550
}
555551
$adapter = $this->_getAdapter($adapterType);

lib/internal/Magento/Framework/Image/Adapter/Gd2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,8 @@ protected function _createImageFromText($text)
737737
protected function _createImageFromTtfText($text, $font)
738738
{
739739
$boundingBox = imagettfbbox($this->_fontSize, 0, $font, $text);
740-
$width = abs($boundingBox[4]) + abs($boundingBox[0]);
741-
$height = abs($boundingBox[5]) + abs($boundingBox[1]);
740+
$width = abs($boundingBox[4] - $boundingBox[0]);
741+
$height = abs($boundingBox[5] - $boundingBox[1]);
742742

743743
$this->_createEmptyImage($width, $height);
744744

0 commit comments

Comments
 (0)