php-kilo/tests/ANSITest.php

34 lines
725 B
PHP
Raw Normal View History

2019-12-05 14:54:25 -05:00
<?php declare(strict_types=1);
2021-04-14 13:24:13 -04:00
namespace Aviat\Kilo\Tests;
2019-12-05 14:54:25 -05:00
use Aviat\Kilo\Terminal\ANSI;
2023-10-10 14:20:19 -04:00
use Aviat\Kilo\Terminal\Enum\Color;
2019-12-05 14:54:25 -05:00
use PHPUnit\Framework\TestCase;
class ANSITest extends TestCase {
public function testColor():void
{
$this->assertEquals("\e[44m", ANSI::color(Color::BG_BLUE));
}
public function testRgbColor(): void
{
$this->assertEquals("\e[38;2;128;128;128m", ANSI::rgbColor(128, 128, 128));
}
public function testMoveCursor(): void
{
2021-03-05 21:20:38 -05:00
$this->assertEquals("\e[25;40H", ANSI::moveCursor(24, 39));
2019-12-05 14:54:25 -05:00
}
public function testScrollUp(): void
{
$this->assertEquals("\e[5S", ANSI::scrollUp(5));
}
public function testScrollDown(): void
{
$this->assertEquals("\e[5T", ANSI::scrollDown(5));
}
}