forked from variograma/weez-zpl
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the possibility to disable hexadecimal within texts
- Loading branch information
1 parent
7b544c9
commit 89b3914
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Weez\Zpl\Tests\Model\Element; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Weez\Zpl\Constant\ZebraAlignment; | ||
use Weez\Zpl\Model\Element\ZebraFieldBlock; | ||
use Weez\Zpl\Model\Element\ZebraText; | ||
|
||
class ZebraTextTest extends TestCase | ||
{ | ||
|
||
public function testGetZplCode(): void | ||
{ | ||
$text = new ZebraText(20, 20, "Text"); | ||
self::assertEquals("^FT20,20^FH\^FDText^FS\n", $text->getZplCode()); | ||
} | ||
|
||
public function testGetZplCodeWithBlockTest(): void | ||
{ | ||
$block = new ZebraFieldBlock(500, 2, 1, new ZebraAlignment(ZebraAlignment::RIGHT)); | ||
$text = new ZebraText(20, 20, "Text", null, null, null, $block); | ||
self::assertEquals("^FT20,20^FB500,2,1,R^FH\^FDText^FS\n", $text->getZplCode()); | ||
} | ||
|
||
public function testGetZplCodeAllowDecimalTest(): void | ||
{ | ||
$text = new ZebraText(20, 20, "Text\&Multilined"); | ||
$text->setAllowHexadecimal(false); | ||
|
||
self::assertFalse($text->isAllowHexadecimal()); | ||
self::assertEquals("^FT20,20^FDText\&Multilined^FS\n", $text->getZplCode()); | ||
} | ||
} |