Changeset 9741 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2016-02-04T23:32:36+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java
r9727 r9741 73 73 i0.setExifTime(DateUtils.fromString("2016:01:03 11:59:54")); // 4 sec before start of GPX 74 74 i0.createTmp(); 75 assertEquals(Pair.create(0.0, -4L), CorrelateGpxWithImages.autoGuess(Collections.singletonList(i0), gpx)); 75 assertEquals(Pair.create(CorrelateGpxWithImages.Timezone.ZERO, CorrelateGpxWithImages.Offset.seconds(-4)), 76 CorrelateGpxWithImages.autoGuess(Collections.singletonList(i0), gpx)); 76 77 } 77 78 78 79 @Test 79 80 public void testFormatTimezone() throws Exception { 80 assertEquals("+1:00", CorrelateGpxWithImages.formatTimezone(1));81 assertEquals("+6:30", CorrelateGpxWithImages.formatTimezone(6.5));82 assertEquals("-6:30", CorrelateGpxWithImages.formatTimezone(-6.5));83 assertEquals("+3:08", CorrelateGpxWithImages.formatTimezone(Math.PI));84 assertEquals("+2:43", CorrelateGpxWithImages.formatTimezone(Math.E));81 assertEquals("+1:00", new CorrelateGpxWithImages.Timezone(1).formatTimezone()); 82 assertEquals("+6:30", new CorrelateGpxWithImages.Timezone(6.5).formatTimezone()); 83 assertEquals("-6:30", new CorrelateGpxWithImages.Timezone(-6.5).formatTimezone()); 84 assertEquals("+3:08", new CorrelateGpxWithImages.Timezone(Math.PI).formatTimezone()); 85 assertEquals("+2:43", new CorrelateGpxWithImages.Timezone(Math.E).formatTimezone()); 85 86 } 86 87 87 88 @Test 88 89 public void testParseTimezone() throws ParseException { 89 assertEquals(1, CorrelateGpxWithImages.parseTimezone("+01:00"), 1e-3); 90 assertEquals(1, CorrelateGpxWithImages.parseTimezone("+1:00"), 1e-3); 91 assertEquals(1.5, CorrelateGpxWithImages.parseTimezone("+01:30"), 1e-3); 92 assertEquals(11.5, CorrelateGpxWithImages.parseTimezone("+11:30"), 1e-3); 90 assertEquals(1, CorrelateGpxWithImages.Timezone.parseTimezone("+01:00").getHours(), 1e-3); 91 assertEquals(1, CorrelateGpxWithImages.Timezone.parseTimezone("+1:00").getHours(), 1e-3); 92 assertEquals(1.5, CorrelateGpxWithImages.Timezone.parseTimezone("+01:30").getHours(), 1e-3); 93 assertEquals(11.5, CorrelateGpxWithImages.Timezone.parseTimezone("+11:30").getHours(), 1e-3); 94 } 95 96 @Test 97 public void testFormatOffest() throws ParseException { 98 assertEquals("0", CorrelateGpxWithImages.Offset.seconds(0).formatOffset()); 99 assertEquals("123", CorrelateGpxWithImages.Offset.seconds(123).formatOffset()); 100 assertEquals("-4242", CorrelateGpxWithImages.Offset.seconds(-4242).formatOffset()); 93 101 } 94 102 95 103 @Test 96 104 public void testParseOffest() throws ParseException { 97 assertEquals(0, CorrelateGpxWithImages. parseOffset("0"));98 assertEquals(4242L, CorrelateGpxWithImages. parseOffset("4242"));99 assertEquals(-4242L, CorrelateGpxWithImages. parseOffset("-4242"));100 assertEquals(0L, CorrelateGpxWithImages. parseOffset("-0"));105 assertEquals(0, CorrelateGpxWithImages.Offset.parseOffset("0").getSeconds()); 106 assertEquals(4242L, CorrelateGpxWithImages.Offset.parseOffset("4242").getSeconds()); 107 assertEquals(-4242L, CorrelateGpxWithImages.Offset.parseOffset("-4242").getSeconds()); 108 assertEquals(0L, CorrelateGpxWithImages.Offset.parseOffset("-0").getSeconds()); 101 109 } 102 110 }
Note:
See TracChangeset
for help on using the changeset viewer.