Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev committed Jan 4, 2024
1 parent af88cf2 commit 047914f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions spec/PUGX/Poser/Calculator/SvgTextSizeCalculatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class SvgTextSizeCalculatorSpec extends ObjectBehavior
{
public function it_should_compute_text_width(): void
{
$this->calculateWidth('MIT', 8)->shouldBeLike(25);
$this->calculateWidth('MIT', 10)->shouldBeLike(29);
$this->calculateWidth('MIT', 14)->shouldBeLike(36);
$this->calculateWidth('MIT', 8)->shouldBeLike(24.1);
$this->calculateWidth('MIT', 10)->shouldBeLike(27.7);
$this->calculateWidth('MIT', 14)->shouldBeLike(34.8);
}
}
6 changes: 3 additions & 3 deletions src/Calculator/SvgTextSizeCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/
class SvgTextSizeCalculator implements TextSizeCalculatorInterface
{
private const SHIELD_PADDING_X = 11;

/**
* Calculate the width of the text box.
*/
Expand All @@ -36,6 +34,8 @@ public function calculateWidth(string $text, int $size = self::TEXT_SIZE): float
$letterSpacing,
);

return \round($width + self::SHIELD_PADDING_X, 0);
$shieldPaddingX = self::SHIELD_PADDING_EXTERNAL + self::SHIELD_PADDING_INTERNAL;

return \round($width + $shieldPaddingX, 1);
}
}

0 comments on commit 047914f

Please sign in to comment.