Feature: Labelprint für Kistenetiketten hinzugefügt
This commit is contained in:
209
vendor/tecnickcom/tc-lib-pdf-graph/test/BaseTest.php
vendored
Normal file
209
vendor/tecnickcom/tc-lib-pdf-graph/test/BaseTest.php
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BaseTest.php
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*
|
||||
* This file is part of tc-lib-pdf-graph software library.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
/**
|
||||
* Base Test
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*/
|
||||
class BaseTest extends TestUtil
|
||||
{
|
||||
protected function getTestObject(): \Com\Tecnick\Pdf\Graph\Draw
|
||||
{
|
||||
return new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
0.75,
|
||||
80,
|
||||
100,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetOutExtGState(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getOutExtGState(10);
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$res
|
||||
);
|
||||
|
||||
$draw->getOverprint();
|
||||
$draw->getAlpha();
|
||||
|
||||
$res = $draw->getOutExtGState(10);
|
||||
$this->assertEquals(
|
||||
'11 0 obj' . "\n"
|
||||
. '<< /Type /ExtGState /OP true /op true /OPM 0.000000 >>' . "\n"
|
||||
. 'endobj' . "\n"
|
||||
. '12 0 obj' . "\n"
|
||||
. '<< /Type /ExtGState /CA 1.000000 /ca 1.000000 /BM /Normal /AIS false >>' . "\n"
|
||||
. 'endobj' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$this->assertEquals(12, $draw->getObjectNumber());
|
||||
|
||||
$this->assertEquals(2, $draw->getLastExtGStateID());
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings("PHPMD.LongVariable")
|
||||
*/
|
||||
public function testGetOutExtGStateResourcesEmpty(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$outExtGStateResources = $draw->getOutExtGStateResources();
|
||||
$this->assertEquals('', $outExtGStateResources);
|
||||
}
|
||||
|
||||
public function testGetOutGradientResourcesEmpty(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$outGradientResources = $draw->getOutGradientResources();
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$outGradientResources
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetOutGradientShaders(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getOutGradientShaders(10);
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$res
|
||||
);
|
||||
|
||||
$draw->getCoonsPatchMeshWithCoords(3, 5, 7, 11);
|
||||
$draw->getOutGradientShaders(11);
|
||||
$this->assertEquals(13, $draw->getObjectNumber());
|
||||
|
||||
$res = $draw->getOutGradientResources();
|
||||
$this->assertEquals(
|
||||
' /Pattern << /p1 13 0 R >>' . "\n"
|
||||
. ' /Shading << /Sh1 12 0 R >>' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$resx = $draw->getOutGradientResourcesByKeys([1]);
|
||||
$this->assertEquals(
|
||||
' /Pattern << /p1 13 0 R >>' . "\n"
|
||||
. ' /Shading << /Sh1 12 0 R >>' . "\n",
|
||||
$resx
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetOutShaders(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$stops = [
|
||||
[
|
||||
'color' => 'red',
|
||||
'exponent' => 1,
|
||||
'opacity' => 0.5,
|
||||
],
|
||||
[
|
||||
'color' => 'blue',
|
||||
'exponent' => 1,
|
||||
'offset' => 0.2,
|
||||
'opacity' => 0.6,
|
||||
],
|
||||
[
|
||||
'color' => '#98fb98',
|
||||
'exponent' => 1,
|
||||
'opacity' => 0.7,
|
||||
],
|
||||
[
|
||||
'color' => 'rgb(64,128,191)',
|
||||
'exponent' => 1,
|
||||
'offset' => 0.8,
|
||||
'opacity' => 0.8,
|
||||
],
|
||||
[
|
||||
'color' => 'skyblue',
|
||||
'exponent' => 1,
|
||||
'opacity' => 0.9,
|
||||
],
|
||||
];
|
||||
$this->assertEquals(
|
||||
'/TGS1 gs' . "\n"
|
||||
. '/Sh1 sh' . "\n",
|
||||
$draw->getGradient(2, [0, 0, 1, 0], $stops, '', false)
|
||||
);
|
||||
|
||||
$draw->getOverprint();
|
||||
$draw->getAlpha();
|
||||
$draw->getOutExtGState($draw->getObjectNumber());
|
||||
|
||||
$draw->getOutGradientShaders($draw->getObjectNumber());
|
||||
$this->assertEquals(19, $draw->getObjectNumber());
|
||||
|
||||
$res = $draw->getOutExtGStateResources();
|
||||
$this->assertEquals(
|
||||
' /ExtGState << /GS1 1 0 R /GS2 2 0 R /TGS1 20 0 R >>' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$resx = $draw->getOutExtGStateResourcesByKeys([1,2]);
|
||||
$this->assertEquals(
|
||||
' /ExtGState << /GS1 1 0 R /GS2 2 0 R >>' . "\n",
|
||||
$resx
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetOutShadersRadial(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$out = $draw->getGradient(
|
||||
3,
|
||||
[0.6, 0.5, 0.4, 0.3, 1],
|
||||
[
|
||||
[
|
||||
'color' => 'red',
|
||||
'exponent' => 1,
|
||||
'offset' => 0,
|
||||
],
|
||||
[
|
||||
'color' => 'green',
|
||||
'exponent' => 1,
|
||||
'offset' => 1,
|
||||
],
|
||||
],
|
||||
'white',
|
||||
true
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'/Sh1 sh' . "\n",
|
||||
$out
|
||||
);
|
||||
|
||||
$this->assertEquals(0, $draw->getObjectNumber());
|
||||
$draw->getOutGradientShaders($draw->getObjectNumber());
|
||||
$this->assertEquals(4, $draw->getObjectNumber());
|
||||
}
|
||||
}
|
||||
1077
vendor/tecnickcom/tc-lib-pdf-graph/test/DrawTest.php
vendored
Normal file
1077
vendor/tecnickcom/tc-lib-pdf-graph/test/DrawTest.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
654
vendor/tecnickcom/tc-lib-pdf-graph/test/GradientTest.php
vendored
Normal file
654
vendor/tecnickcom/tc-lib-pdf-graph/test/GradientTest.php
vendored
Normal file
@@ -0,0 +1,654 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* GradientTest.php
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*
|
||||
* This file is part of tc-lib-pdf-graph software library.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
/**
|
||||
* Gradient Test
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*/
|
||||
class GradientTest extends TestUtil
|
||||
{
|
||||
protected function getTestObject(): \Com\Tecnick\Pdf\Graph\Draw
|
||||
{
|
||||
return new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
0.75,
|
||||
80,
|
||||
100,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetClippingRect(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'2.250000 71.250000 5.250000 -8.250000 re' . "\n" . 'W n' . "\n",
|
||||
$draw->getClippingRect(3, 5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetGradientTransform(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'5.250000 0.000000 0.000000 8.250000 2.250000 63.000000 cm' . "\n",
|
||||
$draw->getGradientTransform(3, 5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetLinearGradient(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '2.250000 71.250000 5.250000 -8.250000 re' . "\n" . 'W n' . "\n"
|
||||
. '5.250000 0.000000 0.000000 8.250000 2.250000 63.000000 cm' . "\n"
|
||||
. '/Sh1 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$draw->getLinearGradient(3, 5, 7, 11, 'red', 'green', [1, 2, 3, 4])
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRadialGradient(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '2.250000 71.250000 5.250000 -8.250000 re' . "\n" . 'W n' . "\n"
|
||||
. '5.250000 0.000000 0.000000 8.250000 2.250000 63.000000 cm' . "\n"
|
||||
. '/Sh1 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$draw->getRadialGradient(3, 5, 7, 11, 'red', 'green', [0.6, 0.5, 0.4, 0.3, 1])
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetGradientPDFA(): void
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
0.75,
|
||||
80,
|
||||
100,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
true
|
||||
);
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$draw->getGradient(2, [], [], '', false)
|
||||
);
|
||||
|
||||
$this->assertNull($draw->getLastGradientID());
|
||||
}
|
||||
|
||||
public function testGetGradient(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$stops = [
|
||||
[
|
||||
'color' => 'red',
|
||||
'exponent' => 1.0,
|
||||
'offset' => 0.0,
|
||||
'opacity' => 0.5,
|
||||
],
|
||||
[
|
||||
'color' => 'blue',
|
||||
'exponent' => 1.0,
|
||||
'offset' => 0.2,
|
||||
'opacity' => 0.6,
|
||||
],
|
||||
[
|
||||
'color' => '#98fb98',
|
||||
'exponent' => 1.0,
|
||||
'offset' => 0.47,
|
||||
'opacity' => 0.7,
|
||||
],
|
||||
[
|
||||
'color' => 'rgb(64,128,191)',
|
||||
'exponent' => 1.0,
|
||||
'offset' => 0.8,
|
||||
'opacity' => 0.8,
|
||||
],
|
||||
[
|
||||
'color' => 'skyblue',
|
||||
'exponent' => 1.0,
|
||||
'offset' => 1.0,
|
||||
'opacity' => 0.9,
|
||||
],
|
||||
];
|
||||
$this->assertEquals(
|
||||
'/TGS1 gs' . "\n"
|
||||
. '/Sh1 sh' . "\n",
|
||||
$draw->getGradient(2, [0, 0, 1, 0], $stops, '', false)
|
||||
);
|
||||
|
||||
$exp = [
|
||||
1 => [
|
||||
'type' => 2,
|
||||
'coords' => [
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 0,
|
||||
],
|
||||
'antialias' => false,
|
||||
'colors' => [
|
||||
0 => [
|
||||
'color' => 'red',
|
||||
'exponent' => 1,
|
||||
'offset' => 0,
|
||||
'opacity' => 0.5,
|
||||
],
|
||||
1 => [
|
||||
'color' => 'blue',
|
||||
'exponent' => 1,
|
||||
'offset' => 0.20,
|
||||
'opacity' => 0.60,
|
||||
],
|
||||
2 => [
|
||||
'color' => '#98fb98',
|
||||
'exponent' => 1,
|
||||
'offset' => 0.47,
|
||||
'opacity' => 0.70,
|
||||
],
|
||||
3 => [
|
||||
'color' => 'rgb(64,128,191)',
|
||||
'exponent' => 1,
|
||||
'offset' => 0.80,
|
||||
'opacity' => 0.80,
|
||||
],
|
||||
4 => [
|
||||
'color' => 'skyblue',
|
||||
'exponent' => 1,
|
||||
'offset' => 1,
|
||||
'opacity' => 0.90,
|
||||
],
|
||||
],
|
||||
'transparency' => true,
|
||||
'background' => null,
|
||||
'colspace' => 'DeviceCMYK',
|
||||
'id' => 0,
|
||||
'pattern' => 0,
|
||||
'stream' => '',
|
||||
],
|
||||
];
|
||||
$this->bcAssertEqualsWithDelta($exp, $draw->getGradientsArray());
|
||||
|
||||
$this->assertEquals(1, $draw->getLastGradientID());
|
||||
}
|
||||
|
||||
public function testGetCoonsPatchMeshPDFA(): void
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
0.75,
|
||||
80,
|
||||
100,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
true
|
||||
);
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$draw->getCoonsPatchMesh(3, 5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetCoonsPatchMesh(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '2.250000 71.250000 5.250000 -8.250000 re' . "\n" . 'W n' . "\n"
|
||||
. '5.250000 0.000000 0.000000 8.250000 2.250000 63.000000 cm' . "\n"
|
||||
. '/Sh1 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$draw->getCoonsPatchMesh(3, 5, 7, 11)
|
||||
);
|
||||
|
||||
$patch_array = [
|
||||
0 => [
|
||||
'f' => 0,
|
||||
'points' => [
|
||||
0 => 0.0,
|
||||
1 => 0.0,
|
||||
2 => 0.33,
|
||||
3 => 0.0,
|
||||
4 => 0.67,
|
||||
5 => 0.0,
|
||||
6 => 1.0,
|
||||
7 => 0.0,
|
||||
8 => 1.0,
|
||||
9 => 0.33,
|
||||
10 => 0.80,
|
||||
11 => 0.67,
|
||||
12 => 1.0,
|
||||
13 => 1.0,
|
||||
14 => 0.67,
|
||||
15 => 0.800,
|
||||
16 => 0.33,
|
||||
17 => 1.8,
|
||||
18 => 0.0,
|
||||
19 => 1.0,
|
||||
20 => 0.0,
|
||||
21 => 0.67,
|
||||
22 => 0.0,
|
||||
23 => 0.33,
|
||||
],
|
||||
'colors' => [
|
||||
0 => [
|
||||
'red' => 255,
|
||||
'green' => 255,
|
||||
'blue' => 0,
|
||||
],
|
||||
1 => [
|
||||
'red' => 0,
|
||||
'green' => 0,
|
||||
'blue' => 255,
|
||||
],
|
||||
2 => [
|
||||
'red' => 0,
|
||||
'green' => 255,
|
||||
'blue' => 0,
|
||||
],
|
||||
3 => [
|
||||
'red' => 255,
|
||||
'green' => 0,
|
||||
'blue' => 0,
|
||||
],
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'f' => 2,
|
||||
'points' => [
|
||||
0 => 0.0,
|
||||
1 => 1.33,
|
||||
2 => 0.0,
|
||||
3 => 1.67,
|
||||
4 => 0.0,
|
||||
5 => 2.0,
|
||||
6 => 0.33,
|
||||
7 => 2.0,
|
||||
8 => 0.67,
|
||||
9 => 2.0,
|
||||
10 => 1.0,
|
||||
11 => 2.0,
|
||||
12 => 1.0,
|
||||
13 => 1.67,
|
||||
14 => 1.5,
|
||||
15 => 1.33,
|
||||
],
|
||||
'colors' => [
|
||||
0 => [
|
||||
'red' => 0,
|
||||
'green' => 0,
|
||||
'blue' => 0,
|
||||
],
|
||||
1 => [
|
||||
'red' => 255,
|
||||
'green' => 0,
|
||||
'blue' => 255,
|
||||
],
|
||||
],
|
||||
],
|
||||
2 => [
|
||||
'f' => 3,
|
||||
'points' => [
|
||||
0 => 1.33,
|
||||
1 => 0.80,
|
||||
2 => 1.67,
|
||||
3 => 1.5,
|
||||
4 => 2.0,
|
||||
5 => 1.0,
|
||||
6 => 2.0,
|
||||
7 => 1.33,
|
||||
8 => 2.0,
|
||||
9 => 1.67,
|
||||
10 => 2.0,
|
||||
11 => 2.0,
|
||||
12 => 1.66,
|
||||
13 => 2.0,
|
||||
14 => 1.33,
|
||||
15 => 2.0,
|
||||
],
|
||||
'colors' => [
|
||||
0 => [
|
||||
'red' => 0,
|
||||
'green' => 255,
|
||||
'blue' => 255,
|
||||
],
|
||||
1 => [
|
||||
'red' => 0,
|
||||
'green' => 0,
|
||||
'blue' => 0,
|
||||
],
|
||||
],
|
||||
],
|
||||
3 => [
|
||||
'f' => 1,
|
||||
'points' => [
|
||||
0 => 2.0,
|
||||
1 => 0.67,
|
||||
2 => 2.0,
|
||||
3 => 0.33,
|
||||
4 => 2.0,
|
||||
5 => 0.0,
|
||||
6 => 1.67,
|
||||
7 => 0.0,
|
||||
8 => 1.33,
|
||||
9 => 0.0,
|
||||
10 => 1.0,
|
||||
11 => 0.0,
|
||||
12 => 1.0,
|
||||
13 => 0.33,
|
||||
14 => 0.80,
|
||||
15 => 0.67,
|
||||
],
|
||||
'colors' => [
|
||||
0 => [
|
||||
'red' => 0,
|
||||
'green' => 0,
|
||||
'blue' => 0,
|
||||
],
|
||||
1 => [
|
||||
'red' => 0,
|
||||
'green' => 0,
|
||||
'blue' => 255,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '7.500000 41.250000 142.500000 -150.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '142.500000 0.000000 0.000000 150.000000 7.500000 -108.750000 cm' . "\n"
|
||||
. '/Sh2 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$draw->getCoonsPatchMesh(10, 45, 190, 200, $patch_array, 0, 2)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetColorRegistrationBar(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getColorRegistrationBar(50, 70, 40, 40);
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '37.500000 22.500000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 18.750000 cm' . "\n"
|
||||
. '/Sh1 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 18.750000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 15.000000 cm' . "\n"
|
||||
. '/Sh2 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 15.000000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 11.250000 cm' . "\n"
|
||||
. '/Sh3 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 11.250000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 7.500000 cm' . "\n"
|
||||
. '/Sh4 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 7.500000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 3.750000 cm' . "\n"
|
||||
. '/Sh5 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 3.750000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 0.000000 cm' . "\n"
|
||||
. '/Sh6 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 0.000000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 -3.750000 cm' . "\n"
|
||||
. '/Sh7 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '37.500000 -3.750000 30.000000 -3.750000 re' . "\n" . 'W n' . "\n"
|
||||
. '30.000000 0.000000 0.000000 3.750000 37.500000 -7.500000 cm' . "\n"
|
||||
. '/Sh8 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$res = $draw->getColorRegistrationBar(50, 70, 40, 40, true);
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '37.500000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 37.500000 -7.500000 cm' . "\n"
|
||||
. '/Sh9 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '41.250000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 41.250000 -7.500000 cm' . "\n"
|
||||
. '/Sh10 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '45.000000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 45.000000 -7.500000 cm' . "\n"
|
||||
. '/Sh11 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '48.750000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 48.750000 -7.500000 cm' . "\n"
|
||||
. '/Sh12 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '52.500000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 52.500000 -7.500000 cm' . "\n"
|
||||
. '/Sh13 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '56.250000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 56.250000 -7.500000 cm' . "\n"
|
||||
. '/Sh14 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '60.000000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 60.000000 -7.500000 cm' . "\n"
|
||||
. '/Sh15 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '63.750000 22.500000 3.750000 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '3.750000 0.000000 0.000000 30.000000 63.750000 -7.500000 cm' . "\n"
|
||||
. '/Sh16 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$res = $draw->getColorRegistrationBar(
|
||||
50,
|
||||
70,
|
||||
40,
|
||||
40,
|
||||
true,
|
||||
[
|
||||
[''],
|
||||
['g(50%)'],
|
||||
['rgb(50%,50%,50%)'],
|
||||
['cmyk(50%,50%,50,50%)'],
|
||||
['rgb(100%,0%,0%)'],
|
||||
['red', 'white'],
|
||||
['black', 'black'],
|
||||
['g(11%)', 'g(11%)'],
|
||||
['rgb(30%,50%,70%)', 'rgb(170%,150%,130%)'],
|
||||
['cmyk(10%,20%,30,40%)', 'cmyk(100%,90%,80,70%)'],
|
||||
[],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '0.500000 g' . "\n"
|
||||
. '40.227273 22.500000 2.727273 -30.000000 re' . "\n"
|
||||
. 'f' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '0.500000 0.500000 0.500000 rg' . "\n"
|
||||
. '42.954545 22.500000 2.727273 -30.000000 re' . "\n"
|
||||
. 'f' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '0.500000 0.500000 0.500000 0.500000 k' . "\n"
|
||||
. '45.681818 22.500000 2.727273 -30.000000 re' . "\n"
|
||||
. 'f' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '1.000000 0.000000 0.000000 rg' . "\n"
|
||||
. '48.409091 22.500000 2.727273 -30.000000 re' . "\n"
|
||||
. 'f' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '51.136364 22.500000 2.727273 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '2.727273 0.000000 0.000000 30.000000 51.136364 -7.500000 cm' . "\n"
|
||||
. '/Sh17 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '0.000000 0.000000 0.000000 1.000000 k' . "\n"
|
||||
. '53.863636 22.500000 2.727273 -30.000000 re' . "\n"
|
||||
. 'f' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '0.110000 g' . "\n"
|
||||
. '56.590909 22.500000 2.727273 -30.000000 re' . "\n"
|
||||
. 'f' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '59.318182 22.500000 2.727273 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '2.727273 0.000000 0.000000 30.000000 59.318182 -7.500000 cm' . "\n"
|
||||
. '/Sh18 sh' . "\n"
|
||||
. 'Q' . "\n"
|
||||
. 'q' . "\n"
|
||||
. '62.045455 22.500000 2.727273 -30.000000 re' . "\n" . 'W n' . "\n"
|
||||
. '2.727273 0.000000 0.000000 30.000000 62.045455 -7.500000 cm' . "\n"
|
||||
. '/Sh19 sh' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$res = $draw->getColorRegistrationBar(
|
||||
50,
|
||||
70,
|
||||
40,
|
||||
40,
|
||||
false,
|
||||
[]
|
||||
);
|
||||
$this->assertEquals('', $res);
|
||||
}
|
||||
|
||||
public function testGetCropMark(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getCropMark(3, 5, 7, 11, '');
|
||||
$this->assertEquals('', $res);
|
||||
|
||||
$res = $draw->getCropMark(3, 5, 7, 11, 'TBLR');
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '2.250000 79.500000 m' . "\n"
|
||||
. '2.250000 73.312500 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. '2.250000 69.187500 m' . "\n"
|
||||
. '2.250000 63.000000 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. '-3.000000 71.250000 m' . "\n"
|
||||
. '0.937500 71.250000 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. '3.562500 71.250000 m' . "\n"
|
||||
. '7.500000 71.250000 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$style = [
|
||||
'lineWidth' => 0.3,
|
||||
'lineColor' => 'black',
|
||||
'lineCap' => 'butt',
|
||||
'lineJoin' => 'miter',
|
||||
];
|
||||
|
||||
$res = $draw->getCropMark(3, 5, 7, 11, 'TBLR', $style);
|
||||
$this->assertEquals(
|
||||
'q' . "\n"
|
||||
. '0.225000 w' . "\n"
|
||||
. '0 J' . "\n"
|
||||
. '0 j' . "\n"
|
||||
. '/CS1 CS 1.000000 SCN' . "\n"
|
||||
. '2.250000 79.500000 m' . "\n"
|
||||
. '2.250000 73.312500 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. '2.250000 69.187500 m' . "\n"
|
||||
. '2.250000 63.000000 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. '-3.000000 71.250000 m' . "\n"
|
||||
. '0.937500 71.250000 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. '3.562500 71.250000 m' . "\n"
|
||||
. '7.500000 71.250000 l' . "\n"
|
||||
. 'S' . "\n"
|
||||
. 'Q' . "\n",
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetOverprint(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getOverprint();
|
||||
$this->assertEquals(
|
||||
'/GS1 gs' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$res = $draw->getOverprint(false, true, 1);
|
||||
$this->assertEquals(
|
||||
'/GS2 gs' . "\n",
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetAlpha(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getAlpha();
|
||||
$this->assertEquals(
|
||||
'/GS1 gs' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$res = $draw->getAlpha(0.5, '/Missing', 0.4, true);
|
||||
$this->assertEquals(
|
||||
'/GS2 gs' . "\n",
|
||||
$res
|
||||
);
|
||||
}
|
||||
}
|
||||
175
vendor/tecnickcom/tc-lib-pdf-graph/test/RawTest.php
vendored
Normal file
175
vendor/tecnickcom/tc-lib-pdf-graph/test/RawTest.php
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RawTest.php
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*
|
||||
* This file is part of tc-lib-pdf-graph software library.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
/**
|
||||
* Raw Test
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*/
|
||||
class RawTest extends TestUtil
|
||||
{
|
||||
protected function getTestObject(): \Com\Tecnick\Pdf\Graph\Draw
|
||||
{
|
||||
return new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
0.75,
|
||||
80,
|
||||
100,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRawPoint(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('2.250000 71.250000 m' . "\n", $draw->getRawPoint(3, 5));
|
||||
}
|
||||
|
||||
public function testGetRawLine(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('2.250000 71.250000 l' . "\n", $draw->getRawLine(3, 5));
|
||||
}
|
||||
|
||||
public function testGetRawRect(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('2.250000 71.250000 5.250000 -8.250000 re' . "\n", $draw->getRawRect(3, 5, 7, 11));
|
||||
}
|
||||
|
||||
public function testGetRawCurve(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'2.250000 71.250000 5.250000 66.750000 9.750000 62.250000 c' . "\n",
|
||||
$draw->getRawCurve(3, 5, 7, 11, 13, 17)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRawCurveV(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('2.250000 71.250000 5.250000 66.750000 v' . "\n", $draw->getRawCurveV(3, 5, 7, 11));
|
||||
}
|
||||
|
||||
public function testGetRawCurveY(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('2.250000 71.250000 5.250000 66.750000 y' . "\n", $draw->getRawCurveY(3, 5, 7, 11));
|
||||
}
|
||||
|
||||
public function testGetRawEllipticalArc(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getRawEllipticalArc(0, 0, 0, 0);
|
||||
$this->assertEquals('', $res);
|
||||
|
||||
$res = $draw->getRawEllipticalArc(3, 5, 7, 11);
|
||||
$this->assertEquals(
|
||||
'7.500000 71.250000 m' . "\n"
|
||||
. '7.500000 73.189135 7.064930 75.067534 6.271733 76.552998 c' . "\n"
|
||||
. '5.478536 78.038462 4.376901 79.037937 3.161653 79.374664 c' . "\n"
|
||||
. '1.946405 79.711391 0.693671 79.364277 -0.375000 78.394710 c' . "\n"
|
||||
. '-1.443671 77.425142 -2.261335 75.893857 -2.683386 74.071666 c' . "\n"
|
||||
. '-3.105437 72.249475 -3.105437 70.250525 -2.683386 68.428334 c' . "\n"
|
||||
. '-2.261335 66.606143 -1.443671 65.074858 -0.375000 64.105290 c' . "\n"
|
||||
. '0.693671 63.135723 1.946405 62.788609 3.161653 63.125336 c' . "\n"
|
||||
. '4.376901 63.462063 5.478536 64.461538 6.271733 65.947002 c' . "\n"
|
||||
. '7.064930 67.432466 7.500000 69.310865 7.500000 71.250000 c' . "\n",
|
||||
$res
|
||||
);
|
||||
|
||||
$bbox = [];
|
||||
$res = $draw->getRawEllipticalArc(
|
||||
3,
|
||||
5,
|
||||
7,
|
||||
11,
|
||||
0,
|
||||
-180,
|
||||
-90,
|
||||
true,
|
||||
1.8,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
$bbox
|
||||
);
|
||||
$this->assertEquals(
|
||||
'2.250000 71.250000 m' . "\n"
|
||||
. '-3.000000 71.250000 l' . "\n"
|
||||
. '-3.000000 73.118591 -2.596009 74.932867 -1.854615 76.393791 c' . "\n"
|
||||
. '-1.113221 77.854714 -0.077525 78.877355 1.081765 79.293155 c' . "\n"
|
||||
. '2.241055 79.708956 3.456544 79.493745 4.527890 78.682993 c' . "\n"
|
||||
. '5.599235 77.872242 6.464154 76.513084 6.980087 74.829541 c' . "\n"
|
||||
. '7.496019 73.145998 7.632972 71.235944 7.368372 69.414202 c' . "\n"
|
||||
. '7.103771 67.592460 6.453000 65.964938 5.523321 64.799890 c' . "\n"
|
||||
. '4.593643 63.634843 3.439104 63.000000 2.250000 63.000000 c' . "\n"
|
||||
. '2.250000 71.250000 l' . "\n",
|
||||
$res
|
||||
);
|
||||
$res = $draw->getRawEllipticalArc(3, 5, 7, 11, 0, 90, 45);
|
||||
$this->assertEquals(
|
||||
'2.250000 79.500000 m' . "\n"
|
||||
. '1.084822 79.500000 -0.047846 78.890447 -0.968406 77.767993 c' . "\n"
|
||||
. '-1.888967 76.645539 -2.546049 75.072821 -2.835467 73.299209 c' . "\n"
|
||||
. '-3.124884 71.525598 -3.030486 69.650067 -2.567240 67.970002 c' . "\n"
|
||||
. '-2.103993 66.289938 -1.297750 64.899093 -0.276348 64.018002 c' . "\n"
|
||||
. '0.745054 63.136911 1.924617 62.814741 3.075308 63.102576 c' . "\n"
|
||||
. '4.225999 63.390411 5.283605 64.272189 6.080433 65.608093 c' . "\n"
|
||||
. '6.877260 66.943998 7.368843 68.659482 7.477234 70.482537 c' . "\n"
|
||||
. '7.585626 72.305591 7.304778 74.134484 6.679223 75.679223 c' . "\n",
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetVectorsAngle(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getVectorsAngle(0, 0, 0, 0);
|
||||
$this->bcAssertEqualsWithDelta(0, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(0, 1, 0, 1);
|
||||
$this->bcAssertEqualsWithDelta(0, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(1, 1, 2, 2);
|
||||
$this->bcAssertEqualsWithDelta(0, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(1, 0, 0, 1);
|
||||
$this->bcAssertEqualsWithDelta(1.57, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(0, 1, 1, 0);
|
||||
$this->bcAssertEqualsWithDelta(-1.57, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(1, 0, 1, 1);
|
||||
$this->bcAssertEqualsWithDelta(0.79, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(-1, -1, 1, 1);
|
||||
$this->bcAssertEqualsWithDelta(M_PI, $res);
|
||||
|
||||
$res = $draw->getVectorsAngle(1, 0, -1, 0);
|
||||
$this->bcAssertEqualsWithDelta(M_PI, $res);
|
||||
}
|
||||
}
|
||||
418
vendor/tecnickcom/tc-lib-pdf-graph/test/StyleTest.php
vendored
Normal file
418
vendor/tecnickcom/tc-lib-pdf-graph/test/StyleTest.php
vendored
Normal file
@@ -0,0 +1,418 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* StyleTest.php
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*
|
||||
* This file is part of tc-lib-pdf-graph software library.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
/**
|
||||
* Style Test
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*/
|
||||
class StyleTest extends TestUtil
|
||||
{
|
||||
protected function getTestObject(): \Com\Tecnick\Pdf\Graph\Draw
|
||||
{
|
||||
return new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetStyleCmd(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
|
||||
$styleCmd = $draw->getStyleCmd();
|
||||
$exp1 = '';
|
||||
$this->assertEquals($exp1, $styleCmd);
|
||||
|
||||
$style2 = [
|
||||
'lineWidth' => 3,
|
||||
'lineCap' => 'round',
|
||||
'lineJoin' => 'bevel',
|
||||
'miterLimit' => 11,
|
||||
'dashArray' => [5, 7],
|
||||
'dashPhase' => 0,
|
||||
'lineColor' => 'greenyellow',
|
||||
'fillColor' => '["RGB",0.250000,0.500000,0.750000]',
|
||||
];
|
||||
$res2 = $draw->getStyleCmd($style2);
|
||||
$exp2 = '3.000000 w' . "\n"
|
||||
. '1 J' . "\n"
|
||||
. '2 j' . "\n"
|
||||
. '11.000000 M' . "\n"
|
||||
. '[5.000000 7.000000] 0.000000 d' . "\n"
|
||||
. '0.678431 1.000000 0.184314 RG' . "\n"
|
||||
. '0.250000 0.500000 0.750000 rg' . "\n";
|
||||
$this->assertEquals($exp2, $res2);
|
||||
}
|
||||
|
||||
public function testStyle(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$style = [];
|
||||
$res1 = $draw->add($style, true);
|
||||
$exp1 = '1.000000 w' . "\n"
|
||||
. '0 J' . "\n"
|
||||
. '0 j' . "\n"
|
||||
. '10.000000 M' . "\n"
|
||||
. '[] 0.000000 d' . "\n"
|
||||
. '/CS1 CS 1.000000 SCN' . "\n"
|
||||
. '/CS1 cs 1.000000 scn' . "\n";
|
||||
$this->assertEquals($exp1, $res1);
|
||||
|
||||
$style = [
|
||||
'lineWidth' => 3,
|
||||
'lineCap' => 'round',
|
||||
'lineJoin' => 'bevel',
|
||||
'miterLimit' => 11,
|
||||
'dashArray' => [5, 7],
|
||||
'dashPhase' => 1,
|
||||
'lineColor' => 'greenyellow',
|
||||
'fillColor' => '["RGB",0.250000,0.500000,0.750000]',
|
||||
];
|
||||
$res2 = $draw->add($style, false);
|
||||
$exp2 = '3.000000 w' . "\n"
|
||||
. '1 J' . "\n"
|
||||
. '2 j' . "\n"
|
||||
. '11.000000 M' . "\n"
|
||||
. '[5.000000 7.000000] 1.000000 d' . "\n"
|
||||
. '0.678431 1.000000 0.184314 RG' . "\n"
|
||||
. '0.250000 0.500000 0.750000 rg' . "\n";
|
||||
$this->assertEquals($exp2, $res2);
|
||||
$this->assertEquals($style, $draw->getCurrentStyleArray());
|
||||
|
||||
$style = [
|
||||
'lineCap' => 'round',
|
||||
'lineJoin' => 'bevel',
|
||||
'lineColor' => 'transparent',
|
||||
'fillColor' => 'cmyk(67,33,0,25)',
|
||||
];
|
||||
$res3 = $draw->add($style, true);
|
||||
$exp3 = '3.000000 w' . "\n"
|
||||
. '1 J' . "\n"
|
||||
. '2 j' . "\n"
|
||||
. '11.000000 M' . "\n"
|
||||
. '[5.000000 7.000000] 1.000000 d' . "\n"
|
||||
. '0.670000 0.330000 0.000000 0.250000 k' . "\n";
|
||||
$this->assertEquals($exp3, $res3);
|
||||
|
||||
$style = [
|
||||
'lineCap' => 'round',
|
||||
'lineJoin' => 'bevel',
|
||||
'lineColor' => 'transparent',
|
||||
'fillColor' => 'cmyk(67,33,0,25)',
|
||||
'dashArray' => [],
|
||||
];
|
||||
$res4 = $draw->add($style, true);
|
||||
$exp4 = '3.000000 w' . "\n"
|
||||
. '1 J' . "\n"
|
||||
. '2 j' . "\n"
|
||||
. '11.000000 M' . "\n"
|
||||
. '[] 1.000000 d' . "\n"
|
||||
. '0.670000 0.330000 0.000000 0.250000 k' . "\n";
|
||||
$this->assertEquals($exp4, $res4);
|
||||
|
||||
$style = [
|
||||
'lineWidth' => 7.123,
|
||||
];
|
||||
$res5 = $draw->add($style, false);
|
||||
$exp5 = '7.123000 w' . "\n";
|
||||
$this->assertEquals($exp5, $res5);
|
||||
|
||||
$res = $draw->pop();
|
||||
$this->assertEquals($exp5, $res);
|
||||
|
||||
$res = $draw->pop();
|
||||
$this->assertEquals($exp4, $res);
|
||||
|
||||
$res = $draw->pop();
|
||||
$this->assertEquals($exp3, $res);
|
||||
|
||||
$res = $draw->pop();
|
||||
$this->assertEquals($exp2, $res);
|
||||
|
||||
$res = $draw->pop();
|
||||
$this->assertEquals($exp1, $res);
|
||||
}
|
||||
|
||||
public function testStyleEx(): void
|
||||
{
|
||||
$this->bcExpectException('\\' . \Com\Tecnick\Pdf\Graph\Exception::class);
|
||||
$draw = $this->getTestObject();
|
||||
$draw->pop();
|
||||
}
|
||||
|
||||
public function testSaveRestoreStyle(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 1,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 2,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 3,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->saveStyleStatus();
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 4,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 5,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 6,
|
||||
],
|
||||
false
|
||||
);
|
||||
$this->assertEquals(
|
||||
[
|
||||
'lineWidth' => 6,
|
||||
],
|
||||
$draw->getCurrentStyleArray()
|
||||
);
|
||||
$draw->restoreStyleStatus();
|
||||
$this->assertEquals(
|
||||
[
|
||||
'lineWidth' => 3,
|
||||
],
|
||||
$draw->getCurrentStyleArray()
|
||||
);
|
||||
}
|
||||
|
||||
public function testStyleItem(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getCurrentStyleItem('lineCap');
|
||||
$this->assertEquals('butt', $res);
|
||||
}
|
||||
|
||||
public function testStyleItemEx(): void
|
||||
{
|
||||
$this->bcExpectException('\\' . \Com\Tecnick\Pdf\Graph\Exception::class);
|
||||
$draw = $this->getTestObject();
|
||||
$draw->getCurrentStyleItem('wrongField');
|
||||
}
|
||||
|
||||
public function testGetLastStyleProperty(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 1,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 2,
|
||||
],
|
||||
false
|
||||
);
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 3,
|
||||
],
|
||||
false
|
||||
);
|
||||
$this->assertEquals(3, $draw->getLastStyleProperty('lineWidth', 0));
|
||||
$draw->add(
|
||||
[
|
||||
'lineWidth' => 4,
|
||||
],
|
||||
false
|
||||
);
|
||||
$this->assertEquals(4, $draw->getLastStyleProperty('lineWidth', 0));
|
||||
$this->assertEquals(7, $draw->getLastStyleProperty('unknown', 7));
|
||||
}
|
||||
|
||||
public function testGetPathPaintOp(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$res = $draw->getPathPaintOp('', '');
|
||||
$this->assertEquals('', $res);
|
||||
|
||||
$res = $draw->getPathPaintOp('');
|
||||
$this->assertEquals('S' . "\n", $res);
|
||||
|
||||
$res = $draw->getPathPaintOp('', 'df');
|
||||
$this->assertEquals('b' . "\n", $res);
|
||||
|
||||
$res = $draw->getPathPaintOp('CEO');
|
||||
$this->assertEquals('W* n' . "\n", $res);
|
||||
|
||||
$res = $draw->getPathPaintOp('F*D');
|
||||
$this->assertEquals('B*' . "\n", $res);
|
||||
}
|
||||
|
||||
public function testIsFillingMode(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertTrue($draw->isFillingMode('f'));
|
||||
$this->assertTrue($draw->isFillingMode('f*'));
|
||||
$this->assertTrue($draw->isFillingMode('B'));
|
||||
$this->assertTrue($draw->isFillingMode('B*'));
|
||||
$this->assertTrue($draw->isFillingMode('b'));
|
||||
$this->assertTrue($draw->isFillingMode('b*'));
|
||||
$this->assertFalse($draw->isFillingMode('S'));
|
||||
$this->assertFalse($draw->isFillingMode('s'));
|
||||
$this->assertFalse($draw->isFillingMode('n'));
|
||||
$this->assertFalse($draw->isFillingMode(''));
|
||||
}
|
||||
|
||||
public function testIsStrokingMode(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertTrue($draw->isStrokingMode('S'));
|
||||
$this->assertTrue($draw->isStrokingMode('s'));
|
||||
$this->assertTrue($draw->isStrokingMode('B'));
|
||||
$this->assertTrue($draw->isStrokingMode('B*'));
|
||||
$this->assertTrue($draw->isStrokingMode('b'));
|
||||
$this->assertTrue($draw->isStrokingMode('b*'));
|
||||
$this->assertFalse($draw->isStrokingMode('f'));
|
||||
$this->assertFalse($draw->isStrokingMode('f*'));
|
||||
$this->assertFalse($draw->isStrokingMode('n'));
|
||||
$this->assertFalse($draw->isStrokingMode(''));
|
||||
}
|
||||
|
||||
public function testIsClosingMode(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertTrue($draw->isClosingMode('s'));
|
||||
$this->assertTrue($draw->isClosingMode('b'));
|
||||
$this->assertTrue($draw->isClosingMode('b*'));
|
||||
$this->assertFalse($draw->isClosingMode('f'));
|
||||
$this->assertFalse($draw->isClosingMode('f*'));
|
||||
$this->assertFalse($draw->isClosingMode('S'));
|
||||
$this->assertFalse($draw->isClosingMode('B'));
|
||||
$this->assertFalse($draw->isClosingMode('B*'));
|
||||
$this->assertFalse($draw->isClosingMode('n'));
|
||||
$this->assertFalse($draw->isClosingMode(''));
|
||||
}
|
||||
|
||||
public function testGetModeWithoutClose(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('', $draw->getModeWithoutClose(''));
|
||||
$this->assertEquals('S', $draw->getModeWithoutClose('s'));
|
||||
$this->assertEquals('B', $draw->getModeWithoutClose('b'));
|
||||
$this->assertEquals('B*', $draw->getModeWithoutClose('b*'));
|
||||
$this->assertEquals('n', $draw->getModeWithoutClose('n'));
|
||||
}
|
||||
|
||||
public function testGetModeWithoutFill(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('', $draw->getModeWithoutFill(''));
|
||||
$this->assertEquals('', $draw->getModeWithoutFill('f'));
|
||||
$this->assertEquals('', $draw->getModeWithoutFill('f*'));
|
||||
$this->assertEquals('S', $draw->getModeWithoutFill('B'));
|
||||
$this->assertEquals('S', $draw->getModeWithoutFill('B*'));
|
||||
$this->assertEquals('s', $draw->getModeWithoutFill('b'));
|
||||
$this->assertEquals('s', $draw->getModeWithoutFill('b*'));
|
||||
$this->assertEquals('n', $draw->getModeWithoutFill('n'));
|
||||
}
|
||||
|
||||
public function testGetModeWithoutStroke(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals('', $draw->getModeWithoutStroke(''));
|
||||
$this->assertEquals('', $draw->getModeWithoutStroke('S'));
|
||||
$this->assertEquals('h', $draw->getModeWithoutStroke('s'));
|
||||
$this->assertEquals('f', $draw->getModeWithoutStroke('B'));
|
||||
$this->assertEquals('f*', $draw->getModeWithoutStroke('B*'));
|
||||
$this->assertEquals('h f', $draw->getModeWithoutStroke('b'));
|
||||
$this->assertEquals('h f*', $draw->getModeWithoutStroke('b*'));
|
||||
$this->assertEquals('n', $draw->getModeWithoutStroke('n'));
|
||||
}
|
||||
|
||||
public function testGetExtGState(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'/GS1 gs' . "\n",
|
||||
$draw->getExtGState(
|
||||
[
|
||||
'A' => 'B',
|
||||
]
|
||||
)
|
||||
);
|
||||
$this->assertEquals(
|
||||
'/GS1 gs' . "\n",
|
||||
$draw->getExtGState(
|
||||
[
|
||||
'A' => 'B',
|
||||
]
|
||||
)
|
||||
);
|
||||
$this->assertEquals(
|
||||
'/GS2 gs' . "\n",
|
||||
$draw->getExtGState(
|
||||
[
|
||||
'C' => 'D',
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetExtGStatePdfa(): void
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
true
|
||||
);
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$draw->getExtGState(
|
||||
[
|
||||
'A' => 'B',
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
50
vendor/tecnickcom/tc-lib-pdf-graph/test/TestUtil.php
vendored
Normal file
50
vendor/tecnickcom/tc-lib-pdf-graph/test/TestUtil.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TestUtil.php
|
||||
*
|
||||
* @since 2020-12-19
|
||||
* @category Library
|
||||
* @package file
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2015-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-file
|
||||
*
|
||||
* This file is part of tc-lib-file software library.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test Util
|
||||
*
|
||||
* @since 2020-12-19
|
||||
* @category Library
|
||||
* @package file
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2015-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-file
|
||||
*/
|
||||
class TestUtil extends TestCase
|
||||
{
|
||||
public function bcAssertEqualsWithDelta(
|
||||
mixed $expected,
|
||||
mixed $actual,
|
||||
float $delta = 0.01,
|
||||
string $message = ''
|
||||
): void {
|
||||
parent::assertEqualsWithDelta($expected, $actual, $delta, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<\Throwable> $exception
|
||||
*/
|
||||
public function bcExpectException($exception): void
|
||||
{
|
||||
parent::expectException($exception);
|
||||
}
|
||||
}
|
||||
292
vendor/tecnickcom/tc-lib-pdf-graph/test/TransformTest.php
vendored
Normal file
292
vendor/tecnickcom/tc-lib-pdf-graph/test/TransformTest.php
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TransformTest.php
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*
|
||||
* This file is part of tc-lib-pdf-graph software library.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
/**
|
||||
* Transform Test
|
||||
*
|
||||
* @since 2011-05-23
|
||||
* @category Library
|
||||
* @package PdfGraph
|
||||
* @author Nicola Asuni <info@tecnick.com>
|
||||
* @copyright 2011-2024 Nicola Asuni - Tecnick.com LTD
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
|
||||
* @link https://github.com/tecnickcom/tc-lib-pdf-graph
|
||||
*/
|
||||
class TransformTest extends TestUtil
|
||||
{
|
||||
protected function getTestObject(): \Com\Tecnick\Pdf\Graph\Draw
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
$this->assertEquals(-1, $draw->getTransformIndex());
|
||||
$this->assertEquals('q' . "\n", $draw->getStartTransform());
|
||||
return $draw;
|
||||
}
|
||||
|
||||
public function testGetStartStopTransform(): void
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
$this->assertEquals(-1, $draw->getTransformIndex());
|
||||
$this->assertEquals('q' . "\n", $draw->getStartTransform());
|
||||
$this->assertEquals(0, $draw->getTransformIndex());
|
||||
|
||||
$tmx = [0.1, 1.2, 2.3, 3.4, 4.5, 5.6];
|
||||
$this->assertEquals(
|
||||
'0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 cm' . "\n",
|
||||
$draw->getTransformation($tmx)
|
||||
);
|
||||
|
||||
$this->bcAssertEqualsWithDelta(
|
||||
[
|
||||
0 => [
|
||||
0 => [0.1, 1.2, 2.3, 3.4, 4.5, 5.6],
|
||||
],
|
||||
],
|
||||
$draw->getTransformStack(),
|
||||
0.0001,
|
||||
''
|
||||
);
|
||||
|
||||
$this->assertEquals('Q' . "\n", $draw->getStopTransform());
|
||||
$this->assertEquals(-1, $draw->getTransformIndex());
|
||||
$this->assertEquals('', $draw->getStopTransform());
|
||||
$this->assertEquals(-1, $draw->getTransformIndex());
|
||||
}
|
||||
|
||||
public function testGetTransform(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$tmx = [0.1, 1.2, 2.3, 3.4, 4.5, 5.6];
|
||||
$this->assertEquals(
|
||||
'0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 cm' . "\n",
|
||||
$draw->getTransformation($tmx)
|
||||
);
|
||||
}
|
||||
|
||||
public function testSetPageHeight(): void
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
$draw->setPageHeight(100);
|
||||
$this->assertEquals('q' . "\n", $draw->getStartTransform());
|
||||
$this->assertEquals(
|
||||
'3.000000 0.000000 0.000000 5.000000 -14.000000 -356.000000 cm' . "\n",
|
||||
$draw->getScaling(3, 5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testSetKUnit(): void
|
||||
{
|
||||
$draw = new \Com\Tecnick\Pdf\Graph\Draw(
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
new \Com\Tecnick\Color\Pdf(),
|
||||
new \Com\Tecnick\Pdf\Encrypt\Encrypt(),
|
||||
false
|
||||
);
|
||||
$draw->setKUnit(0.75);
|
||||
$this->assertEquals('q' . "\n", $draw->getStartTransform());
|
||||
$this->assertEquals(
|
||||
'3.000000 0.000000 0.000000 5.000000 -10.500000 33.000000 cm' . "\n",
|
||||
$draw->getScaling(3, 5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetScaling(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'3.000000 0.000000 0.000000 5.000000 -14.000000 44.000000 cm' . "\n",
|
||||
$draw->getScaling(3, 5, 7, 11)
|
||||
);
|
||||
$this->assertEquals(
|
||||
'3.000000 0.000000 0.000000 3.000000 -14.000000 22.000000 cm' . "\n",
|
||||
$draw->getScaling(3, 3, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetScalingEx(): void
|
||||
{
|
||||
$this->bcExpectException('\\' . \Com\Tecnick\Pdf\Graph\Exception::class);
|
||||
$draw = $this->getTestObject();
|
||||
$draw->getScaling(0, 0, 7, 11);
|
||||
}
|
||||
|
||||
public function testGetHorizScaling(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'3.000000 0.000000 0.000000 1.000000 -14.000000 0.000000 cm' . "\n",
|
||||
$draw->getHorizScaling(3, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetVertScaling(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.000000 0.000000 5.000000 0.000000 44.000000 cm' . "\n",
|
||||
$draw->getVertScaling(5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetPropScaling(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'3.000000 0.000000 0.000000 3.000000 -14.000000 22.000000 cm' . "\n",
|
||||
$draw->getPropScaling(3, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRotation(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'0.707107 0.707107 -0.707107 0.707107 -5.727922 -8.171573 cm' . "\n",
|
||||
$draw->getRotation(45, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetHorizMirroring(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'-1.000000 0.000000 0.000000 1.000000 14.000000 0.000000 cm' . "\n",
|
||||
$draw->getHorizMirroring(7)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetVertMirroring(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.000000 0.000000 -1.000000 0.000000 -22.000000 cm' . "\n",
|
||||
$draw->getVertMirroring(11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetPointMirroring(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'-1.000000 0.000000 0.000000 -1.000000 14.000000 -22.000000 cm' . "\n",
|
||||
$draw->getPointMirroring(7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetReflection(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'-1.000000 0.000000 0.000000 1.000000 14.000000 0.000000 cm' . "\n"
|
||||
. '0.000000 1.000000 -1.000000 0.000000 -4.000000 -18.000000 cm' . "\n",
|
||||
$draw->getReflection(45, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetTranslation(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.000000 0.000000 1.000000 3.000000 -5.000000 cm' . "\n",
|
||||
$draw->getTranslation(3, 5)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetHorizTranslation(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.000000 0.000000 1.000000 3.000000 0.000000 cm' . "\n",
|
||||
$draw->getHorizTranslation(3)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetVertTranslation(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.000000 0.000000 1.000000 0.000000 -5.000000 cm' . "\n",
|
||||
$draw->getVertTranslation(5)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetSkewing(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.087489 0.052408 1.000000 0.576486 -0.612421 cm' . "\n",
|
||||
$draw->getSkewing(3, 5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetSkewingEx(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->bcExpectException('\\' . \Com\Tecnick\Pdf\Graph\Exception::class);
|
||||
$draw->getSkewing(90, -90, 7, 11);
|
||||
}
|
||||
|
||||
public function testGetHorizSkewing(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.000000 0.052408 1.000000 0.576486 0.000000 cm' . "\n",
|
||||
$draw->getHorizSkewing(3, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetVertSkewing(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$this->assertEquals(
|
||||
'1.000000 0.087489 0.000000 1.000000 0.000000 -0.612421 cm' . "\n",
|
||||
$draw->getVertSkewing(5, 7, 11)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetCtmProduct(): void
|
||||
{
|
||||
$draw = $this->getTestObject();
|
||||
$tma = [3.1, 5.2, 7.3, 11.4, 13.5, 17.6];
|
||||
$tmb = [19.1, 23.2, 29.3, 31.4, 37.5, 41.6];
|
||||
$ctm = $draw->getCtmProduct($tma, $tmb);
|
||||
$this->bcAssertEqualsWithDelta([228.570, 363.800, 320.050, 510.320, 433.430, 686.840], $ctm, 0.001);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user