<?php include 'lime.php'; $t = new lime_test(4, new lime_output_color()); $symbolizer = new Mapnik\TextSymbolizer('GEONAME', 'DejaVu Sans Book', 10, new Mapnik\Color(0, 255, 0)); $t->isnt($symbolizer, null, 'Constructor with 4 arguments'); $symbolizer = new Mapnik\TextSymbolizer('GEONAME', 10, new Mapnik\Color(0, 255, 0)); $t->isnt($symbolizer, null, 'Constructor with 3 arguments'); $symbolizer->setHaloFill(new Mapnik\Color(0, 0, 255)); $control_color = new Mapnik\Color(0, 0, 255); $t->is($symbolizer->getHaloFill()->toHexString(), $control_color->toHexString(), 'halo fill getter/setter'); $symbolizer->setHaloRadius(5); $t->is($symbolizer->getHaloRadius(), 5, 'halo radius getter/setter'); // @todo all the rest
$t->fail('Wrong argument types in constructor (4) but no exception thrown'); } catch (Exception $e) { $t->pass('Wrong argument types in constructor (4) successfully threw exception'); } /* * Getters and setters for color components. */ $c = new Mapnik\Color(); $c->setRed(200); $t->is($c->getRed(), 200, 'Red setter and getter'); $c->setGreen(200); $t->is($c->getGreen(), 200, 'Green setter and getter'); $c->setBlue(200); $t->is($c->getBlue(), 200, 'Blue setter and getter'); $c->setAlpha(200); $t->is($c->getAlpha(), 200, 'Alpha setter and getter'); $c = new Mapnik\Color(1, 2, 3, 4); $t->is($c->getRed(), 1, 'Constructing with RGBA components: red'); $t->is($c->getGreen(), 2, 'Constructing with RGBA components: green'); $t->is($c->getBlue(), 3, 'Constructing with RGBA components: blue'); $t->is($c->getAlpha(), 4, 'Constructing with RGBA components: alpha'); $c = new Mapnik\Color(1, 1, 1); $t->is($c->getAlpha(), 255, 'Constructing with default alpha: alpha is 255'); /* * Some conversion functions to various formats. */ $c = new Mapnik\Color(10, 10, 10, 0); $t->is((string) $c, 'rgba(10,10,10,0)', '__toString'); $t->is($c->rgba(), 657930, 'rgba'); $t->is($c->toHexString(), '#0a0a0a', 'toHexString'); // Constructor from CSS named color.