package Champlain::MapSourceDesc;
-BEGIN {
- # Create getters and setters for the properties
- my @properties = qw(
- id name license license_uri min_zoom_level max_zoom_level projection
- );
- foreach my $property (@properties) {
- my $get_name = join '::', __PACKAGE__, "get_$property";
- my $set_same = join '::', __PACKAGE__, "set_$property";
- my $getter = sub {return $_[0]->{$property};};
- my $setter = sub {return $_[0]->{$property} = $_[1];};
- no strict;
- *{$get_name} = $getter;
- *{$set_same} = $setter;
- }
-}
-
1;
use strict;
use warnings;
-use Clutter::TestHelper tests => 25;
+use Clutter::TestHelper tests => 18;
use Champlain ':maps';
ok(@maps >= 5, "Maps factory has the default maps");
# Find the OAM map and check that the it's properly described
- my @found = grep { $_->{id} eq Champlain::MapSourceFactory->OAM } @maps;
- is(scalar(@found), 1);
+ my @found = grep { $_->get_id eq Champlain::MapSourceFactory->OAM } @maps;
+ is(scalar(@found), 1, "Found a single map matching OAM");
if (! @found) {
fail("Can't test a Champlain::MapSourceDesc without a map description") for 1 .. 22;
return;
}
+ # Getters
my ($oam) = @found;
isa_ok($oam, 'Champlain::MapSourceDesc');
- is($oam->id, Champlain::MapSourceFactory->OAM);
- is($oam->name, 'OpenAerialMap');
- is($oam->license, "(CC) BY 3.0 OpenAerialMap contributors");
- is($oam->license_uri, 'http://creativecommons.org/licenses/by/3.0/');
- is($oam->min_zoom_level, 0);
- is($oam->max_zoom_level, 17);
- is($oam->projection, 'mercator');
-
- # Getters
- is($oam->get_id, $oam->{id}, "get_id()");
- is($oam->get_name, $oam->{name}, "get_name()");
- is($oam->get_license, $oam->{license}, "get_license()");
- is($oam->get_license_uri, $oam->{license_uri}, "get_license_uri()");
- is($oam->get_min_zoom_level, $oam->{min_zoom_level}, "get_min_zoom_level()");
- is($oam->get_max_zoom_level, $oam->{max_zoom_level}, "get_max_zoom_level()");
- is($oam->get_projection, $oam->{projection}, "get_projection()");
+ is($oam->get_id, Champlain::MapSourceFactory->OAM, "get_id()");
+ is($oam->get_name, 'OpenAerialMap', "get_name()");
+ is($oam->get_license, "(CC) BY 3.0 OpenAerialMap contributors", "get_license()");
+ is($oam->get_license_uri, 'http://creativecommons.org/licenses/by/3.0/', "get_license_uri()");
+ is($oam->get_min_zoom_level, 0, "get_min_zoom_level()");
+ is($oam->get_max_zoom_level, 17, "get_max_zoom_level()");
+ is($oam->get_projection, 'mercator', "get_projection()");
# Setters
OUTPUT:
RETVAL
-/**
- * Provide nice accessors to the data members of the struct.
- */
-SV*
-id (ChamplainMapSourceDesc *desc)
- ALIAS:
- Champlain::MapSourceDesc::name = 1
- Champlain::MapSourceDesc::license = 2
- Champlain::MapSourceDesc::license_uri = 3
- Champlain::MapSourceDesc::min_zoom_level = 4
- Champlain::MapSourceDesc::max_zoom_level = 5
- Champlain::MapSourceDesc::projection = 6
-
- CODE:
- switch (ix) {
- case 0: RETVAL = newSVGChar(desc->id); break;
- case 1: RETVAL = newSVGChar(desc->name); break;
- case 2: RETVAL = newSVGChar(desc->license); break;
- case 3: RETVAL = newSVGChar(desc->license_uri); break;
- case 4: RETVAL = newSViv(desc->min_zoom_level); break;
- case 5: RETVAL = newSViv(desc->max_zoom_level); break;
- case 6: RETVAL = newSVChamplainMapProjection(desc->projection); break;
- default:
- RETVAL = &PL_sv_undef;
- g_assert_not_reached ();
- }
-
- OUTPUT:
- RETVAL
-
const gchar*
OSM_MAPNIK (class)