aboutsummaryrefslogtreecommitdiffstats
path: root/t/map
diff options
context:
space:
mode:
Diffstat (limited to 't/map')
-rw-r--r--t/map/bing.t12
-rw-r--r--t/map/fms.t55
-rw-r--r--t/map/google.t2
-rw-r--r--t/map/tests.t1
4 files changed, 68 insertions, 2 deletions
diff --git a/t/map/bing.t b/t/map/bing.t
new file mode 100644
index 000000000..ae8391871
--- /dev/null
+++ b/t/map/bing.t
@@ -0,0 +1,12 @@
+use Test::More;
+use FixMyStreet::Map::Bing;
+
+my $tiles = FixMyStreet::Map::Bing->map_tiles(x_tile => 8105, y_tile => 5375, zoom_act => 14);
+$tiles = [ map { m{ch/([^?]*)}; $1; } @$tiles ];
+is_deeply $tiles, [ '03131132323220', '03131132323221', '03131132323222', '03131132323223' ];
+
+$tiles = FixMyStreet::Map::Bing->map_tiles(x_tile => 8105, y_tile => 5375, zoom_act => 14, aerial => 1);
+$tiles = [ map { m{ch/([^?]*)\?.*A,G,L}; $1; } @$tiles ];
+is_deeply $tiles, [ '03131132323220', '03131132323221', '03131132323222', '03131132323223' ];
+
+done_testing();
diff --git a/t/map/fms.t b/t/map/fms.t
new file mode 100644
index 000000000..3a562db26
--- /dev/null
+++ b/t/map/fms.t
@@ -0,0 +1,55 @@
+use Test::More;
+use FixMyStreet::Map::FMS;
+
+# Z NI Aerial
+my $expected = {
+ 10 => {
+ 0 => {
+ 0 => 'ch/1010100100.*?=G,L',
+ 1 => 'ch/1010100100.*?A,G,L',
+ },
+ 1 => {
+ 0 => 'ch/1010100100.*?=G,L',
+ 1 => 'ch/1010100100.*?A,G,L',
+ },
+ },
+ 13 => {
+ 0 => {
+ 0 => 'r3131010100100.*?mmOS',
+ 1 => 'ch/3131010100100.*?A,G,L',
+ },
+ 1 => {
+ 0 => 'ch/3131010100100.*?=G,L',
+ 1 => 'ch/3131010100100.*?A,G,L',
+ },
+ },
+ 16 => {
+ 0 => {
+ 0 => 'oml/16/32420/21504',
+ 1 => 'ch/0313131010100100.*?A,G,L',
+ },
+ 1 => {
+ 0 => 'ch/0313131010100100.*?=G,L',
+ 1 => 'ch/0313131010100100.*?A,G,L',
+ },
+ },
+};
+
+subtest "Correct tiles with various parameters" => sub {
+ for my $aerial (0, 1) {
+ for my $ni (0, 1) {
+ for my $zoom (qw(10 13 16)) {
+ my $tiles = FixMyStreet::Map::FMS->map_tiles(
+ x_tile => 32421, y_tile => 21505, zoom_act => $zoom,
+ aerial => $aerial,
+ latitude => $ni ? 55 : 51,
+ longitude => $ni ? -6 : -2,
+ );
+ my $wanted = $expected->{$zoom}{$ni}{$aerial};
+ like $tiles->[0], qr/$wanted/, "with zoom $zoom, NI $ni, aerial $aerial";
+ }
+ }
+ }
+};
+
+done_testing();
diff --git a/t/map/google.t b/t/map/google.t
index e2877f53c..e97279072 100644
--- a/t/map/google.t
+++ b/t/map/google.t
@@ -13,7 +13,7 @@ is_deeply $c->stash->{map}, {
type => 'google',
zoom => 15,
zoomOffset => 0,
- numZoomLevels => 19,
+ numZoomLevels => 20,
zoom_act => 15,
};
diff --git a/t/map/tests.t b/t/map/tests.t
index 7d7efab22..e6de55b8f 100644
--- a/t/map/tests.t
+++ b/t/map/tests.t
@@ -18,7 +18,6 @@ my $requires = {
'MasterMap' => 'map-mastermap.js',
'Northamptonshire' => 'map-wms-northamptonshire.js',
'CycleMap' => 'OpenStreetMap.js',
- 'MapQuest' => 'OpenStreetMap.js',
'StreetView' => 'map-streetview.js',
'TonerLite' => 'map-toner-lite.js',
'Zurich' => 'map-wmts-zurich.js',