mirror of
https://github.com/Intervention/image.git
synced 2025-08-18 11:41:17 +02:00
Soften the test check for FontProcessorTest
As slightly different results can occur in different environments with results of imageftbbox and roundings, a range is checked instead of a fixed value.
This commit is contained in:
@@ -63,8 +63,8 @@ final class FontProcessorTest extends BaseTestCase
|
|||||||
$processor = new FontProcessor();
|
$processor = new FontProcessor();
|
||||||
$size = $processor->boxSize('ABC', $this->testFont());
|
$size = $processor->boxSize('ABC', $this->testFont());
|
||||||
$this->assertInstanceOf(SizeInterface::class, $size);
|
$this->assertInstanceOf(SizeInterface::class, $size);
|
||||||
$this->assertEquals(74, $size->width());
|
$this->assertContains($size->width(), [74, 75, 76]);
|
||||||
$this->assertEquals(20, $size->height());
|
$this->assertContains($size->height(), [19, 20, 21]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNativeFontSize(): void
|
public function testNativeFontSize(): void
|
||||||
@@ -120,21 +120,21 @@ final class FontProcessorTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$processor = new FontProcessor();
|
$processor = new FontProcessor();
|
||||||
$result = $processor->typographicalSize($this->testFont());
|
$result = $processor->typographicalSize($this->testFont());
|
||||||
$this->assertEquals(45, $result);
|
$this->assertContains($result, [44, 45]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCapHeightTtf(): void
|
public function testCapHeightTtf(): void
|
||||||
{
|
{
|
||||||
$processor = new FontProcessor();
|
$processor = new FontProcessor();
|
||||||
$result = $processor->capHeight($this->testFont());
|
$result = $processor->capHeight($this->testFont());
|
||||||
$this->assertEquals(45, $result);
|
$this->assertContains($result, [44, 45]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLeadingTtf(): void
|
public function testLeadingTtf(): void
|
||||||
{
|
{
|
||||||
$processor = new FontProcessor();
|
$processor = new FontProcessor();
|
||||||
$result = $processor->leading($this->testFont());
|
$result = $processor->leading($this->testFont());
|
||||||
$this->assertEquals(45, $result);
|
$this->assertContains($result, [44, 45]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function testFont(): Font
|
private function testFont(): Font
|
||||||
|
Reference in New Issue
Block a user