88
99namespace Svg \Tests ;
1010
11- include_once __DIR__ . "/../../src/autoload.php " ;
11+ include_once __DIR__ . "/../../src/autoload.php " ;
1212
1313use Svg \Style ;
1414
15- class StyleTest extends \PHPUnit_Framework_TestCase {
16- public function test_parseColor () {
17- $ this ->assertEquals ("none " , Style::parseColor ("none " ));
18- $ this ->assertEquals (array (255 , 0 , 0 ), Style::parseColor ("RED " ));
19- $ this ->assertEquals (array (0 , 0 , 255 ), Style::parseColor ("blue " ));
20- $ this ->assertEquals (null , Style::parseColor ("foo " ));
21- }
15+ class StyleTest extends \PHPUnit_Framework_TestCase
16+ {
17+
18+ public function test_parseColor ()
19+ {
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) " ));
32+ }
2233
23- public function test_fromAttributes () {
24- $ style = new Style ();
34+ public function test_fromAttributes ()
35+ {
36+ $ style = new Style ();
2537
26- $ attributes = array (
27- "color " => "blue " ,
28- "fill " => "#fff " ,
29- "stroke " => "none " ,
30- );
38+ $ attributes = array (
39+ "color " => "blue " ,
40+ "fill " => "#fff " ,
41+ "stroke " => "none " ,
42+ );
3143
32- $ style ->fromAttributes ($ attributes );
44+ $ style ->fromAttributes ($ attributes );
3345
34- $ this ->assertEquals (array (0 , 0 , 255 ), $ style ->color );
35- $ this ->assertEquals (array (255 , 255 , 255 ), $ style ->fill );
36- $ this ->assertEquals ("none " , $ style ->stroke );
37- }
46+ $ this ->assertEquals (array (0 , 0 , 255 ), $ style ->color );
47+ $ this ->assertEquals (array (255 , 255 , 255 ), $ style ->fill );
48+ $ this ->assertEquals ("none " , $ style ->stroke );
49+ }
3850
39- public function test_convertSize (){
40- $ this ->assertEquals (1 , Style::convertSize (1 ));
51+ public function test_convertSize ()
52+ {
53+ $ this ->assertEquals (1 , Style::convertSize (1 ));
4154 $ this ->assertEquals (10 , Style::convertSize ("10px " )); // FIXME
4255 $ this ->assertEquals (10 , Style::convertSize ("10pt " ));
43- $ this ->assertEquals (8 , Style::convertSize ("80% " , 10 , 72 ));
56+ $ this ->assertEquals (8 , Style::convertSize ("80% " , 10 , 72 ));
4457 }
58+
4559}
4660
0 commit comments