Changeset 10513 in josm for trunk/test


Ignore:
Timestamp:
2016-07-03T22:16:57+02:00 (4 years ago)
Author:
Don-vip
Message:

fix #13071 - Make DateUtilsTest.testTsFromString and ExifReaderTest.test* pass (patch by michael2402) - gsoc-core

Location:
trunk/test/unit/org/openstreetmap/josm/tools
Files:
3 edited

Legend:

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

    r10475 r10513  
    1515import java.util.TimeZone;
    1616
    17 import org.junit.After;
    1817import org.junit.Before;
    1918import org.junit.Rule;
     
    2322import org.openstreetmap.josm.testutils.JOSMTestRules;
    2423import org.openstreetmap.josm.tools.date.DateUtils;
    25 import org.openstreetmap.josm.tools.date.DateUtilsTest;
    2624
    2725import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3735    @Rule
    3836    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    39     public JOSMTestRules test = new JOSMTestRules();
     37    public JOSMTestRules test = new JOSMTestRules().timeout(60000);
    4038
    4139    private File orientationSampleFile, directionSampleFile;
     
    4846        directionSampleFile = new File("data_nodist/exif-example_direction.jpg");
    4947        orientationSampleFile = new File("data_nodist/exif-example_orientation=6.jpg");
    50         DateUtilsTest.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
    51     }
    52 
    53     /**
    54      * Clean {@link DateUtils} state
    55      */
    56     @After
    57     public void done() {
    58         DateUtilsTest.setTimeZone(DateUtils.UTC);
    5948    }
    6049
     
    6655    public void testReadTime() throws ParseException {
    6756        Date date = ExifReader.readTime(directionSampleFile);
     57        assertEquals(new GregorianCalendar(2010, Calendar.MAY, 15, 17, 12, 05).getTime(), date);
     58
     59        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
     60        date = ExifReader.readTime(directionSampleFile);
     61        TimeZone.setDefault(DateUtils.UTC);
    6862        assertEquals(new GregorianCalendar(2010, Calendar.MAY, 15, 15, 12, 05).getTime(), date);
    6963    }
     
    7771        Date date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
    7872        String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(date);
     73        assertEquals("2015-07-11T19:34:19.100", dateStr);
     74
     75        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
     76        date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
     77        TimeZone.setDefault(DateUtils.UTC);
     78        dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(date);
    7979        assertEquals("2015-07-11T17:34:19.100", dateStr);
    8080    }
     
    117117        File file = new File(TestUtils.getRegressionDataFile(11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg"));
    118118        String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(ExifReader.readTime(file));
    119         assertEquals("2015-11-08T14:33:27.500", dateStr);
     119        assertEquals("2015-11-08T15:33:27.500", dateStr);
    120120    }
    121121}
  • trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java

    r10378 r10513  
    1313import org.junit.Test;
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.testutils.JOSMTestRules;
    1516
    1617/**
     
    1819 */
    1920public class UtilsTest {
     21    /**
     22     * Use default, basic test rules.
     23     */
     24    public JOSMTestRules rules = new JOSMTestRules();
    2025
    2126    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r10495 r10513  
    3434     */
    3535    public static void setTimeZone(TimeZone zone) {
    36         DateUtils.setTimeZone(zone);
    3736        TimeZone.setDefault(zone);
    3837    }
Note: See TracChangeset for help on using the changeset viewer.