You are here

public function PositionedRectangleTest::testAddGrid in Image Effects 8.3

Same name and namespace in other branches
  1. 8 tests/src/Unit/PositionedRectangleTest.php \Drupal\Tests\image_effects\Unit\PositionedRectangleTest::testAddGrid()
  2. 8.2 tests/src/Unit/PositionedRectangleTest.php \Drupal\Tests\image_effects\Unit\PositionedRectangleTest::testAddGrid()

@covers ::addGrid @covers ::getSubGridDimensions @covers ::getPoints @dataProvider addGridProvider

File

tests/src/Unit/PositionedRectangleTest.php, line 395

Class

PositionedRectangleTest
Tests the Rectangle algebra class.

Namespace

Drupal\Tests\image_effects\Unit

Code

public function testAddGrid($rect_width, $rect_height, $x, $y, $width, $height, $rows, $columns, $expected_points, $expected_subgrid_dimensions) {
  $rect = new PositionedRectangle($rect_width, $rect_height);
  $rect
    ->addGrid('test_a', $x, $y, $width, $height, $rows, $columns);
  $this
    ->assertEquals($expected_points, $rect
    ->getPoints());
  foreach ($expected_subgrid_dimensions as $params => $dimensions) {
    $args = explode(', ', $params);
    $this
      ->assertSame($dimensions, $rect
      ->getSubGridDimensions('test_a', $args[0], $args[1], $args[2], $args[3]));
  }
}