:octocat: removed QRMatrix::M_TEST

This commit is contained in:
smiley
2023-10-05 17:57:35 +02:00
parent 171f0d97da
commit 911de7af69
3 changed files with 17 additions and 28 deletions
-4
View File
@@ -33,10 +33,6 @@ class QRMatrix{
public const M_LOGO = 0b001000000000;
/** @var int */
public const M_LOGO_DARK = 0b101000000000;
/** @var int */
public const M_TEST = 0b011111111111;
/** @var int */
public const M_TEST_DARK = 0b111111111111;
/*
* light values
-4
View File
@@ -83,7 +83,6 @@ interface QROutputInterface{
QRMatrix::M_QUIETZONE => false,
QRMatrix::M_LOGO => false,
QRMatrix::M_FINDER_DOT_LIGHT => false,
QRMatrix::M_TEST => false,
// dark
QRMatrix::M_DARKMODULE => true,
QRMatrix::M_DATA_DARK => true,
@@ -96,7 +95,6 @@ interface QROutputInterface{
QRMatrix::M_QUIETZONE_DARK => true,
QRMatrix::M_LOGO_DARK => true,
QRMatrix::M_FINDER_DOT => true,
QRMatrix::M_TEST_DARK => true,
];
/**
@@ -118,7 +116,6 @@ interface QROutputInterface{
QRMatrix::M_QUIETZONE => 'quietzone',
QRMatrix::M_LOGO => 'logo',
QRMatrix::M_FINDER_DOT_LIGHT => 'finder-dot-light',
QRMatrix::M_TEST => 'test',
// dark
QRMatrix::M_DARKMODULE => 'darkmodule',
QRMatrix::M_DATA_DARK => 'data-dark',
@@ -131,7 +128,6 @@ interface QROutputInterface{
QRMatrix::M_QUIETZONE_DARK => 'quietzone-dark',
QRMatrix::M_LOGO_DARK => 'logo-dark',
QRMatrix::M_FINDER_DOT => 'finder-dot',
QRMatrix::M_TEST_DARK => 'test-dark',
];
/**
+17 -20
View File
@@ -79,9 +79,6 @@ final class QRMatrixTest extends TestCase{
QRMatrix::M_LOGO => QRString::ansi8('░░', 105),
// empty
QRMatrix::M_NULL => QRString::ansi8('░░', 231),
// data
QRMatrix::M_TEST_DARK => QRString::ansi8('██', 127),
QRMatrix::M_TEST => QRString::ansi8('░░', 127),
];
$out = (new QRString($opt, $matrix))->dump();
@@ -147,20 +144,20 @@ final class QRMatrixTest extends TestCase{
* Tests the set(), get() and check() methods
*/
public function testGetSetCheck():void{
$this->matrix->set(10, 10, true, QRMatrix::M_TEST);
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(10, 10));
$this->matrix->set(10, 10, true, QRMatrix::M_LOGO);
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(10, 10));
$this::assertTrue($this->matrix->check(10, 10));
$this->matrix->set(20, 20, false, QRMatrix::M_TEST);
$this::assertSame(QRMatrix::M_TEST, $this->matrix->get(20, 20));
$this->matrix->set(20, 20, false, QRMatrix::M_LOGO);
$this::assertSame(QRMatrix::M_LOGO, $this->matrix->get(20, 20));
$this::assertFalse($this->matrix->check(20, 20));
// get proper results when using a *_DARK constant
$this->matrix->set(30, 30, true, QRMatrix::M_TEST_DARK);
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(30, 30));
$this->matrix->set(30, 30, true, QRMatrix::M_LOGO_DARK);
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(30, 30));
$this->matrix->set(40, 40, false, QRMatrix::M_TEST_DARK);
$this::assertSame(QRMatrix::M_TEST, $this->matrix->get(40, 40));
$this->matrix->set(40, 40, false, QRMatrix::M_LOGO_DARK);
$this::assertSame(QRMatrix::M_LOGO, $this->matrix->get(40, 40));
// out of range
$this::assertFalse($this->matrix->check(-1, -1));
@@ -331,8 +328,8 @@ final class QRMatrixTest extends TestCase{
$size = $matrix->getSize();
$quietZoneSize = 5;
$matrix->set(0, 0, true, QRMatrix::M_TEST);
$matrix->set(($size - 1), ($size - 1), true, QRMatrix::M_TEST);
$matrix->set(0, 0, true, QRMatrix::M_LOGO);
$matrix->set(($size - 1), ($size - 1), true, QRMatrix::M_LOGO);
$matrix->setQuietZone($quietZoneSize);
@@ -350,8 +347,8 @@ final class QRMatrixTest extends TestCase{
$s = ($size - 1 - $quietZoneSize);
$this::assertSame(QRMatrix::M_TEST_DARK, $matrix->get($quietZoneSize, $quietZoneSize));
$this::assertSame(QRMatrix::M_TEST_DARK, $matrix->get($s, $s));
$this::assertSame(QRMatrix::M_LOGO_DARK, $matrix->get($quietZoneSize, $quietZoneSize));
$this::assertSame(QRMatrix::M_LOGO_DARK, $matrix->get($s, $s));
}
/**
@@ -522,20 +519,20 @@ final class QRMatrixTest extends TestCase{
* Tests flipping the value of a module
*/
public function testFlip():void{
$this->matrix->set(20, 20, true, QRMatrix::M_TEST);
$this->matrix->set(20, 20, true, QRMatrix::M_LOGO);
// cover checkType()
$this::assertTrue($this->matrix->checkType(20, 20, QRMatrix::M_TEST));
$this::assertTrue($this->matrix->checkType(20, 20, QRMatrix::M_LOGO));
// verify the current state (dark)
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(20, 20));
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(20, 20));
// flip
$this->matrix->flip(20, 20);
// verify flip
$this::assertSame(QRMatrix::M_TEST, $this->matrix->get(20, 20));
$this::assertSame(QRMatrix::M_LOGO, $this->matrix->get(20, 20));
// flip again
$this->matrix->flip(20, 20);
// verify flip
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(20, 20));
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(20, 20));
}
/**