Skip to content

Commit

Permalink
[Console] Test degraded true colors
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy-sk authored and fabpot committed Oct 29, 2020
1 parent b8474c7 commit 000a909
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Tests/ColorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,20 @@ public function testTrueColors()
$color = new Color('#ffffff', '#000000');
$this->assertSame("\033[38;2;255;255;255;48;2;0;0;0m \033[39;49m", $color->apply(' '));
}

public function testDegradedTrueColors()
{
$colorterm = getenv('COLORTERM');
putenv('COLORTERM=');

try {
$color = new Color('#f00', '#ff0');
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));

$color = new Color('#c0392b', '#f1c40f');
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
} finally {
putenv('COLORTERM='.$colorterm);
}
}
}

0 comments on commit 000a909

Please sign in to comment.