function RectangleTest::testRotateDimensions

Same name and namespace in other branches
  1. 11.x 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. 9 core/tests/Drupal/Tests/Component/Utility/RectangleTest.php \Drupal\Tests\Component\Utility\RectangleTest::testRotateDimensions()
  4. 8.9.x core/tests/Drupal/Tests/Component/Utility/RectangleTest.php \Drupal\Tests\Component\Utility\RectangleTest::testRotateDimensions()

Tests getting rectangle dimensions after a rotation operation.

@legacy-covers ::rotate @legacy-covers ::getBoundingWidth @legacy-covers ::getBoundingHeight

Attributes

#[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 58

Class

RectangleTest
Tests Drupal\Component\Utility\Rectangle.

Namespace

Drupal\Tests\Component\Utility

Code

public function testRotateDimensions($width, $height, $angle, $exp_width, $exp_height) : void {
  $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.