function RectangleTest::testRotateDimensions

Same name 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()
  3. 11.x 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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.