composer package updates
[openemr.git] / vendor / phenx / php-svg-lib / tests / Svg / StyleTest.php
blobcce3d845c5f904d232b244e7a63b5eaa0b0297b7
1 <?php
2 /**
3 * Created by PhpStorm.
4 * User: Fabien
5 * Date: 13/04/14
6 * Time: 17:42
7 */
9 namespace Svg\Tests;
11 include_once __DIR__ . "/../../src/autoload.php";
13 use Svg\Style;
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()
36 $style = new Style();
38 $attributes = array(
39 "color" => "blue",
40 "fill" => "#fff",
41 "stroke" => "none",
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));