Changeset 11514 in josm for trunk/test


Ignore:
Timestamp:
2017-01-30T23:21:38+01:00 (3 years ago)
Author:
Don-vip
Message:

fix #14209 - EXIF: prefer DATETIME over DATETIME_DIGITIZED

Location:
trunk/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java

    r11484 r11514  
    2424
    2525import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     26
    2627/**
    2728 * EXIF metadata extraction test
     
    7071    public void testReadTimeSubSecond1() throws ParseException {
    7172        Date date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
    72         String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(date);
    73         assertEquals("2015-07-11T19:34:19.100", dateStr);
     73        doTest("2015-07-11T19:34:19.100", date);
    7474
    7575        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
    7676        date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
    7777        TimeZone.setDefault(DateUtils.UTC);
    78         dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(date);
    79         assertEquals("2015-07-11T17:34:19.100", dateStr);
     78        doTest("2015-07-11T17:34:19.100", date);
     79    }
     80
     81    private static void doTest(String expectedDate, Date parsedDate) {
     82        assertEquals(expectedDate, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(parsedDate));
     83    }
     84
     85    private static void doTestFile(String expectedDate, int ticket, String filename) {
     86        doTest(expectedDate, ExifReader.readTime(new File(TestUtils.getRegressionDataFile(ticket, filename))));
    8087    }
    8188
     
    115122    @Test
    116123    public void testTicket11685() throws IOException {
    117         File file = new File(TestUtils.getRegressionDataFile(11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg"));
    118         String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(ExifReader.readTime(file));
    119         assertEquals("2015-11-08T15:33:27.500", dateStr);
     124        doTestFile("2015-11-08T15:33:27.500", 11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg");
    120125    }
    121126
     
    126131    @Test
    127132    public void testTicket14209() throws IOException {
    128         File file = new File(TestUtils.getRegressionDataFile(14209, "0MbEfj1S--.1.jpg"));
    129         String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(ExifReader.readTime(file));
    130         assertEquals("2017-01-16T18:27:00.000", dateStr);
     133        doTestFile("2017-01-16T18:27:00.000", 14209, "0MbEfj1S--.1.jpg");
     134        doTestFile("2016-08-13T19:51:13.000", 14209, "7VWFOryj--.1.jpg");
    131135    }
    132136}
Note: See TracChangeset for help on using the changeset viewer.