aboutsummaryrefslogtreecommitdiffstats
path: root/t/map/fms.t
diff options
context:
space:
mode:
Diffstat (limited to 't/map/fms.t')
-rw-r--r--t/map/fms.t55
1 files changed, 55 insertions, 0 deletions
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();