|
@@ -107,12 +107,12 @@ 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::assertSame(65280, $this->matrix->get(10, 10));
|
|
|
|
|
|
|
+ $this->matrix->set(10, 10, true, QRMatrix::M_DATA);
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_DATA_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::assertSame(255, $this->matrix->get(20, 20));
|
|
|
|
|
|
|
+ $this->matrix->set(20, 20, false, QRMatrix::M_DATA);
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_DATA, $this->matrix->get(20, 20));
|
|
|
$this::assertFalse($this->matrix->check(20, 20));
|
|
$this::assertFalse($this->matrix->check(20, 20));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -140,7 +140,7 @@ final class QRMatrixTest extends TestCase{
|
|
|
public function testSetDarkModule(int $version):void{
|
|
public function testSetDarkModule(int $version):void{
|
|
|
$matrix = $this->getMatrix($version)->setDarkModule();
|
|
$matrix = $this->getMatrix($version)->setDarkModule();
|
|
|
|
|
|
|
|
- $this::assertSame(QRMatrix::M_DARKMODULE << 8, $matrix->get(8, $matrix->size() - 8));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get(8, $matrix->size() - 8));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -151,9 +151,9 @@ final class QRMatrixTest extends TestCase{
|
|
|
public function testSetFinderPattern(int $version):void{
|
|
public function testSetFinderPattern(int $version):void{
|
|
|
$matrix = $this->getMatrix($version)->setFinderPattern();
|
|
$matrix = $this->getMatrix($version)->setFinderPattern();
|
|
|
|
|
|
|
|
- $this::assertSame(QRMatrix::M_FINDER << 8, $matrix->get(0, 0));
|
|
|
|
|
- $this::assertSame(QRMatrix::M_FINDER << 8, $matrix->get(0, $matrix->size() - 1));
|
|
|
|
|
- $this::assertSame(QRMatrix::M_FINDER << 8, $matrix->get($matrix->size() - 1, 0));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(0, 0));
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(0, $matrix->size() - 1));
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get($matrix->size() - 1, 0));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -195,12 +195,12 @@ final class QRMatrixTest extends TestCase{
|
|
|
foreach($alignmentPattern as $py){
|
|
foreach($alignmentPattern as $py){
|
|
|
foreach($alignmentPattern as $px){
|
|
foreach($alignmentPattern as $px){
|
|
|
|
|
|
|
|
- if($matrix->get($px, $py) === QRMatrix::M_FINDER << 8){
|
|
|
|
|
- $this::assertSame(QRMatrix::M_FINDER << 8, $matrix->get($px, $py), 'skipped finder pattern');
|
|
|
|
|
|
|
+ if($matrix->get($px, $py) === QRMatrix::M_FINDER_DARK){
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get($px, $py), 'skipped finder pattern');
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $this::assertSame(QRMatrix::M_ALIGNMENT << 8, $matrix->get($px, $py));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_ALIGNMENT_DARK, $matrix->get($px, $py));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -225,13 +225,13 @@ final class QRMatrixTest extends TestCase{
|
|
|
if($i % 2 === 0){
|
|
if($i % 2 === 0){
|
|
|
$p1 = $matrix->get(6, $i);
|
|
$p1 = $matrix->get(6, $i);
|
|
|
|
|
|
|
|
- if($p1 === QRMatrix::M_ALIGNMENT << 8){
|
|
|
|
|
- $this::assertSame(QRMatrix::M_ALIGNMENT << 8, $p1, 'skipped alignment pattern');
|
|
|
|
|
|
|
+ if($p1 === QRMatrix::M_ALIGNMENT_DARK){
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_ALIGNMENT_DARK, $p1, 'skipped alignment pattern');
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $this::assertSame(QRMatrix::M_TIMING << 8, $p1);
|
|
|
|
|
- $this::assertSame(QRMatrix::M_TIMING << 8, $matrix->get($i, 6));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_TIMING_DARK, $p1);
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_TIMING_DARK, $matrix->get($i, 6));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -283,8 +283,8 @@ final class QRMatrixTest extends TestCase{
|
|
|
$size = $matrix->size();
|
|
$size = $matrix->size();
|
|
|
$q = 5;
|
|
$q = 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_DATA);
|
|
|
|
|
+ $matrix->set($size - 1, $size - 1, true, QRMatrix::M_DATA);
|
|
|
|
|
|
|
|
$matrix->setQuietZone($q);
|
|
$matrix->setQuietZone($q);
|
|
|
|
|
|
|
@@ -295,8 +295,8 @@ final class QRMatrixTest extends TestCase{
|
|
|
$this::assertSame(QRMatrix::M_QUIETZONE, $matrix->get(0, 0));
|
|
$this::assertSame(QRMatrix::M_QUIETZONE, $matrix->get(0, 0));
|
|
|
$this::assertSame(QRMatrix::M_QUIETZONE, $matrix->get($size - 1, $size - 1));
|
|
$this::assertSame(QRMatrix::M_QUIETZONE, $matrix->get($size - 1, $size - 1));
|
|
|
|
|
|
|
|
- $this::assertSame(QRMatrix::M_TEST << 8, $matrix->get($q, $q));
|
|
|
|
|
- $this::assertSame(QRMatrix::M_TEST << 8, $matrix->get($size - 1 - $q, $size - 1 - $q));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_DATA_DARK, $matrix->get($q, $q));
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_DATA_DARK, $matrix->get($size - 1 - $q, $size - 1 - $q));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -340,10 +340,10 @@ final class QRMatrixTest extends TestCase{
|
|
|
// logo space should not overwrite quiet zone & function patterns
|
|
// logo space should not overwrite quiet zone & function patterns
|
|
|
$m->setLogoSpace(21, 21, -10, -10);
|
|
$m->setLogoSpace(21, 21, -10, -10);
|
|
|
$this::assertSame(QRMatrix::M_QUIETZONE, $m->get(9, 9));
|
|
$this::assertSame(QRMatrix::M_QUIETZONE, $m->get(9, 9));
|
|
|
- $this::assertSame(QRMatrix::M_FINDER << 8, $m->get(10, 10));
|
|
|
|
|
- $this::assertSame(QRMatrix::M_FINDER << 8, $m->get(16, 16));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FINDER_DARK, $m->get(10, 10));
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FINDER_DARK, $m->get(16, 16));
|
|
|
$this::assertSame(QRMatrix::M_SEPARATOR, $m->get(17, 17));
|
|
$this::assertSame(QRMatrix::M_SEPARATOR, $m->get(17, 17));
|
|
|
- $this::assertSame(QRMatrix::M_FORMAT << 8, $m->get(18, 18));
|
|
|
|
|
|
|
+ $this::assertSame(QRMatrix::M_FORMAT_DARK, $m->get(18, 18));
|
|
|
$this::assertSame(QRMatrix::M_LOGO, $m->get(19, 19));
|
|
$this::assertSame(QRMatrix::M_LOGO, $m->get(19, 19));
|
|
|
$this::assertSame(QRMatrix::M_LOGO, $m->get(20, 20));
|
|
$this::assertSame(QRMatrix::M_LOGO, $m->get(20, 20));
|
|
|
$this::assertNotSame(QRMatrix::M_LOGO, $m->get(21, 21));
|
|
$this::assertNotSame(QRMatrix::M_LOGO, $m->get(21, 21));
|