Ignore:
Timestamp:
2016-06-24T08:36:12+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13045 - Inconsistent timezone handling in tests/nmea (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

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

    r10222 r10475  
    1515import java.util.TimeZone;
    1616
     17import org.junit.After;
    1718import org.junit.Before;
     19import org.junit.Rule;
    1820import org.junit.Test;
    1921import org.openstreetmap.josm.TestUtils;
    2022import org.openstreetmap.josm.data.coor.LatLon;
     23import org.openstreetmap.josm.testutils.JOSMTestRules;
     24import org.openstreetmap.josm.tools.date.DateUtils;
    2125import org.openstreetmap.josm.tools.date.DateUtilsTest;
     26
     27import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2228
    2329/**
     
    2632 */
    2733public class ExifReaderTest {
     34    /**
     35     * Set the timezone and timeout.
     36     */
     37    @Rule
     38    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     39    public JOSMTestRules test = new JOSMTestRules();
    2840
    2941    private File orientationSampleFile, directionSampleFile;
     
    4052
    4153    /**
     54     * Clean {@link DateUtils} state
     55     */
     56    @After
     57    public void done() {
     58        DateUtilsTest.setTimeZone(DateUtils.UTC);
     59    }
     60
     61    /**
    4262     * Test time extraction
    4363     * @throws ParseException if {@link ExifReader#readTime} fails to parse date/time of sample file
     
    4666    public void testReadTime() throws ParseException {
    4767        Date date = ExifReader.readTime(directionSampleFile);
    48         assertEquals(new GregorianCalendar(2010, Calendar.MAY, 15, 17, 12, 05).getTime(), date);
     68        assertEquals(new GregorianCalendar(2010, Calendar.MAY, 15, 15, 12, 05).getTime(), date);
    4969    }
    5070
     
    5777        Date date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
    5878        String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(date);
    59         assertEquals("2015-07-11T19:34:19.100", dateStr);
     79        assertEquals("2015-07-11T17:34:19.100", dateStr);
    6080    }
    6181
     
    97117        File file = new File(TestUtils.getRegressionDataFile(11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg"));
    98118        String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(ExifReader.readTime(file));
    99         assertEquals("2015-11-08T15:33:27.500", dateStr);
     119        assertEquals("2015-11-08T14:33:27.500", dateStr);
    100120    }
    101121}
Note: See TracChangeset for help on using the changeset viewer.