Changeset 10735 in josm


Ignore:
Timestamp:
2016-08-05T19:44:17+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13264 - more lenient TMS url regex to allow - zoom separator

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r10577 r10735  
    685685        defaultMinZoom = 0;
    686686        for (ImageryType type : ImageryType.values()) {
    687             Matcher m = Pattern.compile(type.getTypeString()+"(?:\\[(?:(\\d+),)?(\\d+)\\])?:(.*)").matcher(url);
     687            Matcher m = Pattern.compile(type.getTypeString()+"(?:\\[(?:(\\d+)[,-])?(\\d+)\\])?:(.*)").matcher(url);
    688688            if (m.matches()) {
    689689                this.url = m.group(3);
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java

    r10378 r10735  
    4343
    4444    /**
     45     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13264">Bug #13264</a>.
     46     */
     47    @Test
     48    public void testConstruct13264() {
     49        final ImageryInfo info = new ImageryInfo("test imagery", "tms[16-23]:http://localhost");
     50        assertEquals(ImageryInfo.ImageryType.TMS, info.getImageryType());
     51        assertEquals(16, info.getMinZoom());
     52        assertEquals(23, info.getMaxZoom());
     53        assertEquals("http://localhost", info.getUrl());
     54    }
     55
     56    /**
    4557     * Tests the {@linkplain Preferences#serializeStruct(Object, Class) serialization} of {@link ImageryInfo.ImageryPreferenceEntry}
    4658     */
Note: See TracChangeset for help on using the changeset viewer.