From d80b8ffb876c6e7b5ba2e8aa1ea8b2506ca85486 Mon Sep 17 00:00:00 2001 From: Emmanuel Rodriguez Date: Mon, 4 May 2009 16:21:07 +0200 Subject: [PATCH] Add the file t/ChamplainMapSourceFactory.t --- bindings/perl/Champlain/MANIFEST | 1 + .../Champlain/t/ChamplainMapSourceFactory.t | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 bindings/perl/Champlain/t/ChamplainMapSourceFactory.t diff --git a/bindings/perl/Champlain/MANIFEST b/bindings/perl/Champlain/MANIFEST index 171511a..3668fa0 100644 --- a/bindings/perl/Champlain/MANIFEST +++ b/bindings/perl/Champlain/MANIFEST @@ -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 index 0000000..f727c58 --- /dev/null +++ b/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t @@ -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); +} -- 2.39.5