]> err.no Git - libchamplain/commitdiff
Add the file t/ChamplainMapSourceFactory.t
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Mon, 4 May 2009 14:21:07 +0000 (16:21 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Wed, 6 May 2009 03:16:03 +0000 (23:16 -0400)
bindings/perl/Champlain/MANIFEST
bindings/perl/Champlain/t/ChamplainMapSourceFactory.t [new file with mode: 0644]

index 171511a515f480c33d4e4aa8da0eeccd35dcaf22..3668fa01c53ee45be51d8460e89ac170fd80fb87 100644 (file)
@@ -22,6 +22,7 @@ t/Champlain.t
 t/ChamplainBaseMarker.t
 t/ChamplainLayer.t
 t/ChamplainMapSource.t
+t/ChamplainMapSourceFactory.t
 t/ChamplainMarker.t
 t/ChamplainNetworkMapSource.t
 t/ChamplainTile.t
diff --git a/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t b/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t
new file mode 100644 (file)
index 0000000..f727c58
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Clutter::TestHelper tests => 110;
+
+use Champlain ':coords';
+
+my $OSM_LICENSE = "(CC) BY 2.0 OpenStreetMap contributors";
+
+exit tests();
+
+sub tests {
+       test_map_source_names();
+       test_map_factory();
+       return 0;
+}
+
+
+sub test_map_source_names {
+       # Map identification
+       is(Champlain::MapSourceFactory->OSM_MAPNIK, 'OpenStreetMap Mapnik');
+       is(Champlain::MapSourceFactory->OSM_OSMARENDER, 'OpenStreetMap Osmarender');
+       is(Champlain::MapSourceFactory->OSM_CYCLEMAP, 'OpenStreetMap CycleMap');
+       is(Champlain::MapSourceFactory->OAM, 'OpenAerialMap');
+       is(Champlain::MapSourceFactory->MFF_RELIEF, 'MapsForFree Relief');
+}
+
+
+
+sub test_map_factory {
+       my $factory = Champlain::MapSourceFactory->get_default();
+       isa_ok($factory, 'Champlain::MapSourceFactory');
+       
+       generic_create($factory, Champlain::MapSourceFactory->OSM_MAPNIK);
+       generic_create($factory, Champlain::MapSourceFactory->OSM_OSMARENDER);
+       generic_create($factory, Champlain::MapSourceFactory->OSM_CYCLEMAP);
+       generic_create($factory, Champlain::MapSourceFactory->OAM);
+       generic_create($factory, Champlain::MapSourceFactory->MFF_RELIEF);
+}
+
+
+sub generic_create {
+       my ($factory, $id) = @_;
+       my $map = $factory->create($id);
+       isa_ok($map, 'Champlain::MapSource');
+       is($map->get_name, $id);
+}