mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 20:17:17 +00:00
:octocat: removed QRMatrix::M_TEST
This commit is contained in:
@@ -33,10 +33,6 @@ class QRMatrix{
|
|||||||
public const M_LOGO = 0b001000000000;
|
public const M_LOGO = 0b001000000000;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public const M_LOGO_DARK = 0b101000000000;
|
public const M_LOGO_DARK = 0b101000000000;
|
||||||
/** @var int */
|
|
||||||
public const M_TEST = 0b011111111111;
|
|
||||||
/** @var int */
|
|
||||||
public const M_TEST_DARK = 0b111111111111;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* light values
|
* light values
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ interface QROutputInterface{
|
|||||||
QRMatrix::M_QUIETZONE => false,
|
QRMatrix::M_QUIETZONE => false,
|
||||||
QRMatrix::M_LOGO => false,
|
QRMatrix::M_LOGO => false,
|
||||||
QRMatrix::M_FINDER_DOT_LIGHT => false,
|
QRMatrix::M_FINDER_DOT_LIGHT => false,
|
||||||
QRMatrix::M_TEST => false,
|
|
||||||
// dark
|
// dark
|
||||||
QRMatrix::M_DARKMODULE => true,
|
QRMatrix::M_DARKMODULE => true,
|
||||||
QRMatrix::M_DATA_DARK => true,
|
QRMatrix::M_DATA_DARK => true,
|
||||||
@@ -96,7 +95,6 @@ interface QROutputInterface{
|
|||||||
QRMatrix::M_QUIETZONE_DARK => true,
|
QRMatrix::M_QUIETZONE_DARK => true,
|
||||||
QRMatrix::M_LOGO_DARK => true,
|
QRMatrix::M_LOGO_DARK => true,
|
||||||
QRMatrix::M_FINDER_DOT => true,
|
QRMatrix::M_FINDER_DOT => true,
|
||||||
QRMatrix::M_TEST_DARK => true,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,7 +116,6 @@ interface QROutputInterface{
|
|||||||
QRMatrix::M_QUIETZONE => 'quietzone',
|
QRMatrix::M_QUIETZONE => 'quietzone',
|
||||||
QRMatrix::M_LOGO => 'logo',
|
QRMatrix::M_LOGO => 'logo',
|
||||||
QRMatrix::M_FINDER_DOT_LIGHT => 'finder-dot-light',
|
QRMatrix::M_FINDER_DOT_LIGHT => 'finder-dot-light',
|
||||||
QRMatrix::M_TEST => 'test',
|
|
||||||
// dark
|
// dark
|
||||||
QRMatrix::M_DARKMODULE => 'darkmodule',
|
QRMatrix::M_DARKMODULE => 'darkmodule',
|
||||||
QRMatrix::M_DATA_DARK => 'data-dark',
|
QRMatrix::M_DATA_DARK => 'data-dark',
|
||||||
@@ -131,7 +128,6 @@ interface QROutputInterface{
|
|||||||
QRMatrix::M_QUIETZONE_DARK => 'quietzone-dark',
|
QRMatrix::M_QUIETZONE_DARK => 'quietzone-dark',
|
||||||
QRMatrix::M_LOGO_DARK => 'logo-dark',
|
QRMatrix::M_LOGO_DARK => 'logo-dark',
|
||||||
QRMatrix::M_FINDER_DOT => 'finder-dot',
|
QRMatrix::M_FINDER_DOT => 'finder-dot',
|
||||||
QRMatrix::M_TEST_DARK => 'test-dark',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+17
-20
@@ -79,9 +79,6 @@ final class QRMatrixTest extends TestCase{
|
|||||||
QRMatrix::M_LOGO => QRString::ansi8('░░', 105),
|
QRMatrix::M_LOGO => QRString::ansi8('░░', 105),
|
||||||
// empty
|
// empty
|
||||||
QRMatrix::M_NULL => QRString::ansi8('░░', 231),
|
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();
|
$out = (new QRString($opt, $matrix))->dump();
|
||||||
@@ -147,20 +144,20 @@ final class QRMatrixTest extends TestCase{
|
|||||||
* Tests the set(), get() and check() methods
|
* Tests the set(), get() and check() methods
|
||||||
*/
|
*/
|
||||||
public function testGetSetCheck():void{
|
public function testGetSetCheck():void{
|
||||||
$this->matrix->set(10, 10, true, QRMatrix::M_TEST);
|
$this->matrix->set(10, 10, true, QRMatrix::M_LOGO);
|
||||||
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(10, 10));
|
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(10, 10));
|
||||||
$this::assertTrue($this->matrix->check(10, 10));
|
$this::assertTrue($this->matrix->check(10, 10));
|
||||||
|
|
||||||
$this->matrix->set(20, 20, false, QRMatrix::M_TEST);
|
$this->matrix->set(20, 20, false, QRMatrix::M_LOGO);
|
||||||
$this::assertSame(QRMatrix::M_TEST, $this->matrix->get(20, 20));
|
$this::assertSame(QRMatrix::M_LOGO, $this->matrix->get(20, 20));
|
||||||
$this::assertFalse($this->matrix->check(20, 20));
|
$this::assertFalse($this->matrix->check(20, 20));
|
||||||
|
|
||||||
// get proper results when using a *_DARK constant
|
// get proper results when using a *_DARK constant
|
||||||
$this->matrix->set(30, 30, true, QRMatrix::M_TEST_DARK);
|
$this->matrix->set(30, 30, true, QRMatrix::M_LOGO_DARK);
|
||||||
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(30, 30));
|
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(30, 30));
|
||||||
|
|
||||||
$this->matrix->set(40, 40, false, QRMatrix::M_TEST_DARK);
|
$this->matrix->set(40, 40, false, QRMatrix::M_LOGO_DARK);
|
||||||
$this::assertSame(QRMatrix::M_TEST, $this->matrix->get(40, 40));
|
$this::assertSame(QRMatrix::M_LOGO, $this->matrix->get(40, 40));
|
||||||
|
|
||||||
// out of range
|
// out of range
|
||||||
$this::assertFalse($this->matrix->check(-1, -1));
|
$this::assertFalse($this->matrix->check(-1, -1));
|
||||||
@@ -331,8 +328,8 @@ final class QRMatrixTest extends TestCase{
|
|||||||
$size = $matrix->getSize();
|
$size = $matrix->getSize();
|
||||||
$quietZoneSize = 5;
|
$quietZoneSize = 5;
|
||||||
|
|
||||||
$matrix->set(0, 0, true, QRMatrix::M_TEST);
|
$matrix->set(0, 0, true, QRMatrix::M_LOGO);
|
||||||
$matrix->set(($size - 1), ($size - 1), true, QRMatrix::M_TEST);
|
$matrix->set(($size - 1), ($size - 1), true, QRMatrix::M_LOGO);
|
||||||
|
|
||||||
$matrix->setQuietZone($quietZoneSize);
|
$matrix->setQuietZone($quietZoneSize);
|
||||||
|
|
||||||
@@ -350,8 +347,8 @@ final class QRMatrixTest extends TestCase{
|
|||||||
|
|
||||||
$s = ($size - 1 - $quietZoneSize);
|
$s = ($size - 1 - $quietZoneSize);
|
||||||
|
|
||||||
$this::assertSame(QRMatrix::M_TEST_DARK, $matrix->get($quietZoneSize, $quietZoneSize));
|
$this::assertSame(QRMatrix::M_LOGO_DARK, $matrix->get($quietZoneSize, $quietZoneSize));
|
||||||
$this::assertSame(QRMatrix::M_TEST_DARK, $matrix->get($s, $s));
|
$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
|
* Tests flipping the value of a module
|
||||||
*/
|
*/
|
||||||
public function testFlip():void{
|
public function testFlip():void{
|
||||||
$this->matrix->set(20, 20, true, QRMatrix::M_TEST);
|
$this->matrix->set(20, 20, true, QRMatrix::M_LOGO);
|
||||||
|
|
||||||
// cover checkType()
|
// 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)
|
// 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
|
// flip
|
||||||
$this->matrix->flip(20, 20);
|
$this->matrix->flip(20, 20);
|
||||||
// verify flip
|
// verify flip
|
||||||
$this::assertSame(QRMatrix::M_TEST, $this->matrix->get(20, 20));
|
$this::assertSame(QRMatrix::M_LOGO, $this->matrix->get(20, 20));
|
||||||
// flip again
|
// flip again
|
||||||
$this->matrix->flip(20, 20);
|
$this->matrix->flip(20, 20);
|
||||||
// verify flip
|
// verify flip
|
||||||
$this::assertSame(QRMatrix::M_TEST_DARK, $this->matrix->get(20, 20));
|
$this::assertSame(QRMatrix::M_LOGO_DARK, $this->matrix->get(20, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user