You are here

public function RectangleTest::testRotateDimensions in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/RectangleTest.php \Drupal\Tests\Component\Utility\RectangleTest::testRotateDimensions()
  2. 10 core/tests/Drupal/Tests/Component/Utility/RectangleTest.php \Drupal\Tests\Component\Utility\RectangleTest::testRotateDimensions()

Tests getting rectangle dimensions after a rotation operation.

@covers ::rotate @covers ::getBoundingWidth @covers ::getBoundingHeight

@dataProvider providerPhp55RotateDimensions

Parameters

int $width: The width of the rectangle.

int $height: The height of the rectangle.

float $angle: The angle for rotation.

int $exp_width: The expected width of the rotated rectangle.

int $exp_height: The expected height of the rotated rectangle.

File

core/tests/Drupal/Tests/Component/Utility/RectangleTest.php, line 54

Class

RectangleTest
@coversDefaultClass \Drupal\Component\Utility\Rectangle @group Image

Namespace

Drupal\Tests\Component\Utility

Code

public function testRotateDimensions($width, $height, $angle, $exp_width, $exp_height) {
  $rect = new Rectangle($width, $height);
  $rect
    ->rotate($angle);
  $this
    ->assertEquals($exp_width, $rect
    ->getBoundingWidth());
  $this
    ->assertEquals($exp_height, $rect
    ->getBoundingHeight());
}