Index: applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSourceTest.java
===================================================================
--- applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSourceTest.java	(revision 36223)
+++ applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSourceTest.java	(revision 36433)
@@ -30,5 +30,5 @@
      * triple of:
      *  * baseUrl
-     *  * expected tile url for zoom=1, x=2, y=3
+     *  * expected tile url for zoom=4, x=5, y=6
      *  * expected tile url for zoom=3, x=2, y=1
      */
@@ -39,5 +39,5 @@
         new String[] {
                 "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z={zoom}&x={x}&y={-y}", 
-                "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=1&x=2&y=-2", 
+                "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=4&x=5&y=9", 
                 "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=3&x=2&y=6"
                 }
@@ -51,5 +51,5 @@
         checkGetTileUrl(
                 "http://localhost/{z}/{x}/{y}",
-                "http://localhost/1/2/3",
+                "http://localhost/4/5/6",
                 "http://localhost/3/1/2"
                 );
@@ -63,5 +63,5 @@
         checkGetTileUrl(
                 "http://localhost/{zoom+5}/{x}/{y}",
-                "http://localhost/6/2/3",
+                "http://localhost/9/5/6",
                 "http://localhost/8/1/2"
                 );
@@ -75,5 +75,5 @@
         checkGetTileUrl(
                 "http://localhost/{zoom-5}/{x}/{y}",
-                "http://localhost/-4/2/3",
+                "http://localhost/-1/5/6",
                 "http://localhost/-2/1/2"
                 );
@@ -87,5 +87,5 @@
         checkGetTileUrl(
                 "http://localhost/{5-zoom}/{x}/{y}",
-                "http://localhost/4/2/3",
+                "http://localhost/1/5/6",
                 "http://localhost/2/1/2"
                 );
@@ -99,5 +99,5 @@
         checkGetTileUrl(
                 "http://localhost/{10-zoom-5}/{x}/{y}",
-                "http://localhost/4/2/3",
+                "http://localhost/1/5/6",
                 "http://localhost/2/1/2"
                 );
@@ -112,5 +112,5 @@
         TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", "http://localhost/{zoom}/{x}/{y}?token={apikey}&foo=bar", "id1");
         TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS);
-        assertEquals("http://localhost/1/2/3?token=wololo&foo=bar", ts.getTileUrl(1, 2, 3));
+        assertEquals("http://localhost/4/5/6?token=wololo&foo=bar", ts.getTileUrl(4, 5, 6));
     }
 
@@ -161,5 +161,5 @@
         checkGetTileUrl(
                 "http://localhost/{z}/{x}/{!y}",
-                "http://localhost/1/2/-3",
+                "http://localhost/4/5/1",
                 "http://localhost/3/1/1"
                 );
@@ -171,6 +171,16 @@
         checkGetTileUrl(
                 "http://localhost/{z}/{x}/{-y}",
-                "http://localhost/1/2/-2",
+                "http://localhost/4/5/9",
                 "http://localhost/3/1/5"
+                );
+
+    }
+
+    @Test
+    void testGetTileUrl_quad() {
+        checkGetTileUrl(
+                "http://localhost/{quad}",
+                "http://localhost/0321",
+                "http://localhost/021"
                 );
 
@@ -180,5 +190,5 @@
         TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", url, "id1");
         TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS);
-        assertEquals(expected123, ts.getTileUrl(1, 2, 3));
+        assertEquals(expected123, ts.getTileUrl(4, 5, 6));
         assertEquals(expected312, ts.getTileUrl(3, 1, 2));
     }
@@ -192,5 +202,5 @@
             TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", test[0], "id1");
             TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS);
-            assertEquals(test[1], ts.getTileUrl(1, 2, 3));
+            assertEquals(test[1], ts.getTileUrl(4, 5, 6));
             assertEquals(test[2], ts.getTileUrl(3, 2, 1));
         }
@@ -202,5 +212,5 @@
             TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS);
             System.out.println(MessageFormat.format("new String[]{\"{0}\", \"{1}\", \"{2}\"},",
-                    url, ts.getTileUrl(1, 2, 3), ts.getTileUrl(3, 2, 1)));
+                    url, ts.getTileUrl(4, 5, 6), ts.getTileUrl(3, 2, 1)));
         }
     }
