Ignore:
Timestamp:
2016-01-31T11:38:09+01:00 (9 years ago)
Author:
nokutu
Message:

Replace the image reading methods in MapillaryUtils by the new ImageUtil class

Changes to the previous behaviour:

  • directories are now recursively traversed instead of reading only the top level
  • JPG- and PNG-files are now recognized by their magic bytes instead of the file extension
  • the number of publicly visible methods for image reading has been reduced to one, which can process both files and directories as well as JPGs and PNGs
Location:
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java

    r32033 r32034  
    11package org.openstreetmap.josm.plugins.mapillary;
    22
    3 import static org.junit.Assert.*;
    4 
    5 import org.junit.Test;
     3import static org.junit.Assert.assertEquals;
     4import static org.junit.Assert.assertTrue;
    65
    76import java.io.File;
     
    109import javax.imageio.IIOException;
    1110
     11import org.junit.Test;
    1212import org.openstreetmap.josm.data.coor.LatLon;
    13 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
     13import org.openstreetmap.josm.plugins.mapillary.utils.ImageUtil;
    1414
    1515/**
     
    2525   */
    2626  @Test
    27   public void importNoTagsTest() {
     27  public void importNoTagsTest() throws IOException {
    2828    File image = new File("images/icon16.png");
    29     MapillaryImportedImage img = MapillaryUtils.readNoTags(image,
    30         new LatLon(0, 0));
     29    MapillaryImportedImage img = ImageUtil.readImagesFrom(image, new LatLon(0, 0)).get(0);
    3130    assertEquals(0, img.getCa(), 0.01);
    3231    assertTrue(new LatLon(0, 0).equalsEpsilon(img.getLatLon()));
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/oauth/UploadTest.java

    r31512 r32034  
    2020import org.openstreetmap.josm.plugins.mapillary.AbstractTest;
    2121import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage;
    22 import org.openstreetmap.josm.plugins.mapillary.oauth.UploadUtils;
     22import org.openstreetmap.josm.plugins.mapillary.utils.ImageUtil;
    2323import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
    2424
     
    3535   */
    3636  @Test
    37   public void updateFileTest() {
     37  public void updateFileTest() throws IOException {
    3838    File image = new File("images/icon16.png");
    39     MapillaryImportedImage img = MapillaryUtils.readNoTags(image,
    40         new LatLon(0, 0));
     39    MapillaryImportedImage img = ImageUtil.readImagesFrom(image, new LatLon(0, 0)).get(0);
    4140    File updatedFile = null;
    4241    try {
Note: See TracChangeset for help on using the changeset viewer.