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());
} /**
* Provides data for image dimension rotation tests.
*
* This dataset sample was generated by running on PHP 5.5 the function below
* - first, for all integer rotation angles (-360 to 360) on a rectangle
* 40x20;
* - second, for 500 random float rotation angle in the range -360 to 360 on
* a rectangle 40x20;
* - third, on 1000 rectangles of random WxH rotated to a random float angle
* in the range -360 to 360
* - fourth, on 2000 rectangles of random WxH rotated to a random integer
* angle multiple of 30 degrees in the range -360 to 360 (which is the most
* tricky case).
* Using the GD toolkit operations gives us true data coming from the GD
* library that can be used to match against the Rectangle class under test.
* @code
* protected function rotateResults($width, $height, $angle, &$new_width, &$new_height) {
* $image = \Drupal::service('image.factory')->get(NULL, 'gd');
* $image->createNew($width, $height);
* $old_res = $image->getToolkit()->getResource();
* $image->rotate($angle);
* $new_width = $image->getWidth();
* $new_height = $image->getHeight();
* if (is_resource($old_res)) {
* imagedestroy($old_res);
* }
* }
* @endcode
*
* @return array[]
* A simple array of simple arrays, each having the following elements:
* - original image width
* - original image height
* - rotation angle in degrees
* - expected image width after rotation
* - expected image height after rotation
*
* @see testRotateDimensions()
*/