11 include_once __DIR__
. "/../../src/autoload.php";
15 class StyleTest
extends \PHPUnit\Framework\TestCase
18 public function test_parseColor()
20 $this->assertEquals("none", Style
::parseColor("none"));
21 $this->assertEquals(array(255, 0, 0), Style
::parseColor("RED"));
22 $this->assertEquals(array(0, 0, 255), Style
::parseColor("blue"));
23 $this->assertEquals(null, Style
::parseColor("foo"));
24 $this->assertEquals(array(0, 0, 0), Style
::parseColor("black"));
25 $this->assertEquals(array(255, 255, 255), Style
::parseColor("white"));
26 $this->assertEquals(array(0, 0, 0), Style
::parseColor("#000000"));
27 $this->assertEquals(array(255, 255, 255), Style
::parseColor("#ffffff"));
28 $this->assertEquals(array(0, 0, 0), Style
::parseColor("rgb(0,0,0)"));
29 $this->assertEquals(array(255, 255, 255), Style
::parseColor("rgb(255,255,255)"));
30 $this->assertEquals(array(0, 0, 0), Style
::parseColor("rgb(0, 0, 0)"));
31 $this->assertEquals(array(255, 255, 255), Style
::parseColor("rgb(255, 255, 255)"));
34 public function test_fromAttributes()
44 $style->fromAttributes($attributes);
46 $this->assertEquals(array(0, 0, 255), $style->color
);
47 $this->assertEquals(array(255, 255, 255), $style->fill
);
48 $this->assertEquals("none", $style->stroke
);
51 public function test_convertSize()
53 $this->assertEquals(1, Style
::convertSize(1));
54 $this->assertEquals(10, Style
::convertSize("10px")); // FIXME
55 $this->assertEquals(10, Style
::convertSize("10pt"));
56 $this->assertEquals(8, Style
::convertSize("80%", 10, 72));