$t->isnt($popplaces_text_symbolizer, null, 'Created text symbolizer'); // @todo //$t->is($popplaces_text_symbolizer->getName(), 'GEONAME', 'Text symbolizer name is GEONAME'); //$t->is($popplaces_text_symbolizer->getFontFace(), '', 'Text symbolizer font face is DejaVu Sans Book'); //$t->is($popplaces_text_symbolizer->getTextSize(), 10, 'Text symbolizer text size is 10'); //$t->is($popplaces_text_symbolizer->getColor(), '', 'Text symbolizer text color is black'); $popplaces_text_symbolizer->setHaloFill(new Mapnik\Color(255, 255, 200)); $t->isa_ok($popplaces_text_symbolizer->getHaloFill(), 'Mapnik\\Color', 'halo_fill set to a Color'); $t->is($popplaces_text_symbolizer->getHaloFill()->toHexString(), '#ffffc8', 'halo_fill returns the right color'); $popplaces_text_symbolizer->setHaloRadius(1); $t->is($popplaces_text_symbolizer->getHaloRadius(), 1, 'halo_radius set to 1'); $popplaces_rule->append($popplaces_text_symbolizer); $t->pass('Appended symbolizer to rule'); $result = $popplaces_style->addRule($popplaces_rule); $t->is($result, true, 'Rule added to feature style'); $result = $m->addStyle('popplaces', $popplaces_style); $t->is($result, true, 'Feature style \'popplaces\' added to map'); $p = new Mapnik\Parameters(); $t->isnt($p, null, 'Created parameters to pass to layer'); $p->set('type', 'shape'); $p->set('file', '../mapnik-0.7.1/demo/data/popplaces'); $p->set('encoding', 'latin1'); $lyr = new Mapnik\Layer('Populated places'); $t->isnt($lyr, null, 'Created layer \'Populated places\''); $shapefile_datasource = Mapnik\DatasourceCache::create($p); $t->isnt($shapefile_datasource, null, 'Shape file data source created'); $lyr->setDatasource($shapefile_datasource); $t->pass('Data source set'); $lyr->addStyle('popplaces'); $t->pass('popplaces style added'); $m->addLayer($lyr);
<?php include 'lime.php'; $t = new lime_test(7, new lime_output_color()); /* Test the various constructors. */ $m = new Mapnik\Map(); $t->is($m->getWidth(), 400, 'Default constructor: width is 400'); $t->is($m->getHeight(), 400, 'Default constructor: height is 400'); $t->is($m->getSrs(), '+proj=latlong +datum=WGS84', 'Default constructor: projection is "+proj=latlong +datum=WGS84"'); $fs = new Mapnik\FeatureStyle(); $t->is($m->addStyle('feature style name', $fs), true, 'Add feature style to map'); $t->is($m->getBackgroundColor(), null, 'No background color set yet, getBackgroundColor returns null'); $bg_color = new Mapnik\Color(255, 255, 255); $m->setBackgroundColor($bg_color); $t->isa_ok($m->getBackgroundColor(), 'Mapnik\\Color', 'getBackgroundColor returns a Color object'); $t->is($m->getBackgroundColor()->toHexString(), $bg_color->toHexString(), 'getBackgroundColor returns the right color'); $l = new Mapnik\Layer('test layer'); $m->addLayer($l); // @todo test getLayer $m->zoomToBox(new Mapnik\Envelope(0.0, 0.0, 1.0, 1.0)); // @todo test zoomToBox /* $t->getStyleNames getStyle removeStyle removeAllStyles */ //$m = new Mapnik\Map(800, 600); //$t->is(); //m->setBackground(Mapnik\ColorFactory::FromString("white")); //m->zoomToBox(new Mapnik\Envelope(1405120.04127408, -247003.813399447, 1706357.31328276, -25098.593149577));