Changeset 17914 in josm for trunk/test/unit/org
- Timestamp:
- 2021-05-27T19:41:24+02:00 (4 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/FeatureTest.java
r17862 r17914 13 13 14 14 import java.text.NumberFormat; 15 import java.util.ArrayList; 15 16 import java.util.Arrays; 17 import java.util.List; 16 18 17 19 import org.junit.jupiter.api.Test; 20 import org.openstreetmap.josm.testutils.annotations.I18n; 18 21 19 22 /** … … 51 54 // 49 74 24 00 == 1_000_000f 52 55 // 3f 80 00 00 == 1f 53 byte[] newBytes = new byte[] {0x22, 0x0 9, 0x15, 0x00, 0x24, 0x74, 0x49};56 byte[] newBytes = new byte[] {0x22, 0x05, 0x15, 0x00, 0x24, 0x74, 0x49}; 54 57 byte[] copyBytes = Arrays.copyOf(getSimpleFeatureLayerBytes(), getSimpleFeatureLayerBytes().length + newBytes.length - 4); 55 58 // Change last few bytes … … 78 81 checkDefaultGeometry(feature); 79 82 assertEquals("1000000", feature.getTags().get("a")); 83 } 84 85 /** 86 * Non-regression test for #20933 (Russian) 87 * @see #testNumberGroupingDecimalEn() 88 */ 89 @I18n("ru") 90 @Test 91 void testNumberGroupingDecimalRu() { 92 testNumberGroupingDecimal(); 93 } 94 95 /** 96 * Non-regression test for #20933 (English) 97 * @see #testNumberGroupingDecimalRu() 98 */ 99 @I18n("en") 100 @Test 101 void testNumberGroupingDecimalEn() { 102 testNumberGroupingDecimal(); 103 } 104 105 /** 106 * Common parts for non-regression tests for #20933 107 * @see #testNumberGroupingDecimalEn() 108 * @see #testNumberGroupingDecimalRu() 109 */ 110 private void testNumberGroupingDecimal() { 111 byte[] newBytes = new byte[] {0x22, 0x09, 0x19, -45, 0x4D, 0x62, 0x10, 0x58, -71, 0x67, 0x40}; 112 byte[] copyBytes = Arrays.copyOf(getSimpleFeatureLayerBytes(), getSimpleFeatureLayerBytes().length + newBytes.length - 4); 113 // Change last few bytes 114 System.arraycopy(newBytes, 0, copyBytes, 25, newBytes.length); 115 // Update the length of the record 116 copyBytes[1] = (byte) (copyBytes[1] + newBytes.length - 4); 117 Layer layer = assertDoesNotThrow(() -> getLayer(copyBytes)); 118 layer.getKey(0); 119 List<Feature> features = new ArrayList<>(layer.getFeatures()); 120 assertEquals(1, features.size()); 121 assertEquals("189.792", features.get(0).getTags().get("a")); 80 122 } 81 123
Note:
See TracChangeset
for help on using the changeset viewer.