<?php include 'lime.php'; // (Fairly) minimal example // Renders just the cities from the rundemo sample. $t = new lime_test(23, new lime_output_color()); // Set up the environment Mapnik\DatasourceCache::registerDatasources("..\\mapnik-0.7.1\\plugins"); $t->is(in_array('shape', Mapnik\DatasourceCache::getPluginNames()), true, 'Shape data source available'); $result = Mapnik\FreetypeEngine::registerFont("..\\mapnik-0.7.1\\fonts\\DejaVuSans.ttf"); $t->is($result, true, 'Registered DejaVuSans.ttf font'); // Set up the map $m = new Mapnik\Map(800, 600); $t->isnt($result, null, 'Created Map of 800x600 pixels'); $m->setBackgroundColor(new Mapnik\Color(255, 255, 255)); $t->is($m->getBackgroundColor()->toHexString(), '#ffffff', 'Set background to 0xffffff (white)'); // Set the map data $popplaces_style = new Mapnik\FeatureStyle(); $t->isnt($popplaces_style, null, 'Created new feature style'); $popplaces_rule = new Mapnik\Rule(); $t->isnt($popplaces_rule, null, 'Created new rule'); $popplaces_text_symbolizer = new Mapnik\TextSymbolizer('GEONAME', 'DejaVu Sans Book', 10, new Mapnik\Color(0, 0, 0)); $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');
<?php include 'lime.php'; $t = new lime_test(3, new lime_output_color()); $register_font_result = Mapnik\FreetypeEngine::registerFont("..\\mapnik-0.7.1\\fonts\\DejaVuSans.ttf"); $t->is($register_font_result, true, 'Register a font'); $all_face_names = Mapnik\FreetypeEngine::getFaceNames(); $t->is(is_array($all_face_names), true, 'getFaceNames returns array'); $t->is(sizeof($all_face_names), 1, 'getFaceNames has 1 entry'); // @todo //createFace