:octocat:

This commit is contained in:
smiley
2023-06-15 16:49:35 +02:00
parent 0ac2d498fa
commit 71509a5a94
3 changed files with 52 additions and 7 deletions
+37
View File
@@ -367,6 +367,43 @@ final class QRMatrixTest extends TestCase{
$this->matrix->setQuietZone(42);
}
/**
* Tests rotating the matrix by 90 degrees CW
*
* @dataProvider matrixProvider
*/
public function testRotate90(QRMatrix $matrix):void{
$matrix->initFunctionalPatterns();
// matrix size
$size = $matrix->getSize();
// quiet zone size
$qz = (($size - $matrix->getVersion()->getDimension()) / 2);
// initial dark module position
$this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get((8 + $qz), ($size - 8 - $qz)));
// first rotation
$matrix->rotate90();
$this->dm($matrix);
$this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get((7 + $qz), (8 + $qz)));
// second rotation
$matrix->rotate90();
$this->dm($matrix);
$this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get(($size - 9 - $qz), (7 + $qz)));
// third rotation
$matrix->rotate90();
$this->dm($matrix);
$this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get(($size - 8 - $qz), ($size - 9 - $qz)));
// fourth rotation
$matrix->rotate90();
$this->dm($matrix);
$this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get((8 + $qz), ($size - 8 - $qz)));
}
/**
* Tests if the logo space is drawn square if one of the dimensions is omitted
*/