You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by da...@apache.org on 2012/05/26 23:19:22 UTC
svn commit: r1342971 [19/20] - in /commons/proper/imaging/trunk/src:
main/java/org/apache/commons/imaging/formats/bmp/
main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/
main/java/org/apache/commons/imaging/formats/bmp/writers/ main/java/or...
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java Sat May 26 21:19:03 2012
@@ -45,20 +45,17 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.util.Debug;
import org.apache.commons.imaging.util.IoUtils;
-public class ExifRewriteTest extends ExifBaseTest implements AllTagConstants
-{
- // public ExifRewriteTest(String name)
- // {
- // super(name);
- // }
+public class ExifRewriteTest extends ExifBaseTest implements AllTagConstants {
+ // public ExifRewriteTest(String name)
+ // {
+ // super(name);
+ // }
- public void testRemove() throws Exception
- {
+ public void testRemove() throws Exception {
List images = getImagesWithExifData();
- for (int i = 0; i < images.size(); i++)
- {
- if(i%10==0)
- Debug.purgeMemory();
+ for (int i = 0; i < images.size(); i++) {
+ if (i % 10 == 0)
+ Debug.purgeMemory();
File imageFile = (File) images.get(i);
Debug.debug("imageFile", imageFile);
@@ -74,7 +71,7 @@ public class ExifRewriteTest extends Exi
{
JpegImageMetadata metadata = (JpegImageMetadata) Imaging
.getMetadata(imageFile);
- // assertNotNull(metadata.getExif());
+ // assertNotNull(metadata.getExif());
}
{
@@ -93,13 +90,11 @@ public class ExifRewriteTest extends Exi
}
}
- public void testInsert() throws Exception
- {
+ public void testInsert() throws Exception {
List images = getImagesWithExifData();
- for (int i = 0; i < images.size(); i++)
- {
- if(i%10==0)
- Debug.purgeMemory();
+ for (int i = 0; i < images.size(); i++) {
+ if (i % 10 == 0)
+ Debug.purgeMemory();
File imageFile = (File) images.get(i);
Debug.debug("imageFile", imageFile);
@@ -137,7 +132,7 @@ public class ExifRewriteTest extends Exi
{
TiffOutputSet outputSet = oldExifMetadata.getOutputSet();
- // outputSet.dump();
+ // outputSet.dump();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -152,14 +147,14 @@ public class ExifRewriteTest extends Exi
Debug.debug("Output Segments:");
new JpegUtils().dumpJFIF(new ByteSourceArray(bytes));
- // assertTrue(!hasExifData(tempFile));
+ // assertTrue(!hasExifData(tempFile));
JpegImageMetadata newMetadata = (JpegImageMetadata) Imaging
.getMetadata(tempFile);
assertNotNull(newMetadata);
TiffImageMetadata newExifMetadata = newMetadata.getExif();
assertNotNull(newExifMetadata);
- // newMetadata.dump();
+ // newMetadata.dump();
compare(imageFile, oldExifMetadata, newExifMetadata);
}
@@ -167,26 +162,22 @@ public class ExifRewriteTest extends Exi
}
}
- private interface Rewriter
- {
+ private interface Rewriter {
public void rewrite(ByteSource byteSource, OutputStream os,
TiffOutputSet outputSet) throws ImageReadException,
IOException, ImageWriteException;
}
private void rewrite(Rewriter rewriter, String name) throws IOException,
- ImageReadException, ImageWriteException
- {
+ ImageReadException, ImageWriteException {
List images = getImagesWithExifData();
- for (int i = 0; i < images.size(); i++)
- {
- if(i%10==0)
- Debug.purgeMemory();
+ for (int i = 0; i < images.size(); i++) {
+ if (i % 10 == 0)
+ Debug.purgeMemory();
File imageFile = (File) images.get(i);
- try
- {
+ try {
Debug.debug("imageFile", imageFile);
@@ -210,11 +201,11 @@ public class ExifRewriteTest extends Exi
assertNotNull(oldExifMetadata);
oldMetadata.dump();
- // TiffImageMetadata tiffImageMetadata = metadata.getExif();
- // Photoshop photoshop = metadata.getPhotoshop();
+ // TiffImageMetadata tiffImageMetadata = metadata.getExif();
+ // Photoshop photoshop = metadata.getPhotoshop();
TiffOutputSet outputSet = oldExifMetadata.getOutputSet();
- // outputSet.dump();
+ // outputSet.dump();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
rewriter.rewrite(byteSource, baos, outputSet);
@@ -226,36 +217,32 @@ public class ExifRewriteTest extends Exi
Debug.debug("Output Segments:");
new JpegUtils().dumpJFIF(new ByteSourceArray(bytes));
- // assertTrue(!hasExifData(tempFile));
+ // assertTrue(!hasExifData(tempFile));
JpegImageMetadata newMetadata = (JpegImageMetadata) Imaging
.getMetadata(tempFile);
assertNotNull(newMetadata);
TiffImageMetadata newExifMetadata = newMetadata.getExif();
assertNotNull(newExifMetadata);
- // newMetadata.dump();
+ // newMetadata.dump();
compare(imageFile, oldExifMetadata, newExifMetadata);
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
Debug.debug("imageFile", imageFile.getAbsoluteFile());
Debug.debug(e);
throw e;
- }
- catch (ImageReadException e)
- {
+ } catch (ImageReadException e) {
Debug.debug("imageFile", imageFile.getAbsoluteFile());
Debug.debug(e);
throw e;
- }
- catch (ImageWriteException e)
- {
+ } catch (ImageWriteException e) {
Debug.debug("imageFile", imageFile.getAbsoluteFile());
Debug.debug(e);
- // FIXME: this image has 28kB of Maker Notes, causing the APP1 segment
+ // FIXME: this image has 28kB of Maker Notes, causing the APP1
+ // segment
// to go beyond 64kB, so ignore the exception this throws.
- if (!imageFile.getName().equalsIgnoreCase("Nikon D50 - 2007.12.19.n.DSC_3656.JPG")) {
+ if (!imageFile.getName().equalsIgnoreCase(
+ "Nikon D50 - 2007.12.19.n.DSC_3656.JPG")) {
throw e;
}
}
@@ -263,14 +250,11 @@ public class ExifRewriteTest extends Exi
}
}
- public void testRewriteLossy() throws Exception
- {
- Rewriter rewriter = new Rewriter()
- {
+ public void testRewriteLossy() throws Exception {
+ Rewriter rewriter = new Rewriter() {
public void rewrite(ByteSource byteSource, OutputStream os,
TiffOutputSet outputSet) throws ImageReadException,
- IOException, ImageWriteException
- {
+ IOException, ImageWriteException {
new ExifRewriter().updateExifMetadataLossy(byteSource, os,
outputSet);
}
@@ -279,14 +263,11 @@ public class ExifRewriteTest extends Exi
rewrite(rewriter, "lossy");
}
- public void testRewriteLossless() throws Exception
- {
- Rewriter rewriter = new Rewriter()
- {
+ public void testRewriteLossless() throws Exception {
+ Rewriter rewriter = new Rewriter() {
public void rewrite(ByteSource byteSource, OutputStream os,
TiffOutputSet outputSet) throws ImageReadException,
- IOException, ImageWriteException
- {
+ IOException, ImageWriteException {
new ExifRewriter().updateExifMetadataLossless(byteSource, os,
outputSet);
}
@@ -295,11 +276,9 @@ public class ExifRewriteTest extends Exi
rewrite(rewriter, "lossless");
}
- private Hashtable makeDirectoryMap(List directories)
- {
+ private Hashtable makeDirectoryMap(List directories) {
Hashtable directoryMap = new Hashtable();
- for (int i = 0; i < directories.size(); i++)
- {
+ for (int i = 0; i < directories.size(); i++) {
TiffImageMetadata.Directory directory = (TiffImageMetadata.Directory) directories
.get(i);
directoryMap.put(new Integer(directory.type), directory);
@@ -307,11 +286,9 @@ public class ExifRewriteTest extends Exi
return directoryMap;
}
- private Hashtable makeFieldMap(List items)
- {
+ private Hashtable makeFieldMap(List items) {
Hashtable fieldMap = new Hashtable();
- for (int i = 0; i < items.size(); i++)
- {
+ for (int i = 0; i < items.size(); i++) {
TiffImageMetadata.Item item = (TiffImageMetadata.Item) items.get(i);
TiffField field = item.getTiffField();
Object key = new Integer(field.tag);
@@ -322,8 +299,7 @@ public class ExifRewriteTest extends Exi
}
private void compare(File imageFile, TiffImageMetadata oldExifMetadata,
- TiffImageMetadata newExifMetadata) throws ImageReadException
- {
+ TiffImageMetadata newExifMetadata) throws ImageReadException {
assertNotNull(oldExifMetadata);
assertNotNull(newExifMetadata);
@@ -342,11 +318,10 @@ public class ExifRewriteTest extends Exi
Collections.sort(newDirectoryTypes);
assertEquals(oldDirectoryTypes, newDirectoryTypes);
- for (int i = 0; i < oldDirectoryTypes.size(); i++)
- {
+ for (int i = 0; i < oldDirectoryTypes.size(); i++) {
Integer dirType = (Integer) oldDirectoryTypes.get(i);
- // Debug.debug("dirType", dirType);
+ // Debug.debug("dirType", dirType);
TiffImageMetadata.Directory oldDirectory = (TiffImageMetadata.Directory) oldDirectoryMap
.get(dirType);
@@ -358,18 +333,18 @@ public class ExifRewriteTest extends Exi
List oldItems = oldDirectory.getItems();
List newItems = newDirectory.getItems();
- // Debug.debug("oldItems.size()", oldItems.size());
- // Debug.debug("newItems.size()", newItems.size());
- // dump("oldItems", oldItems);
- // dump("newItems", newItems);
-
- // if (oldItems.size() != newItems.size())
- // ;
- // {
- // dump("oldItems", oldItems);
- // dump("newItems", newItems);
- // }
- // assertTrue(oldItems.size() == newItems.size());
+ // Debug.debug("oldItems.size()", oldItems.size());
+ // Debug.debug("newItems.size()", newItems.size());
+ // dump("oldItems", oldItems);
+ // dump("newItems", newItems);
+
+ // if (oldItems.size() != newItems.size())
+ // ;
+ // {
+ // dump("oldItems", oldItems);
+ // dump("newItems", newItems);
+ // }
+ // assertTrue(oldItems.size() == newItems.size());
Hashtable oldFieldMap = makeFieldMap(oldItems);
Hashtable newFieldMap = makeFieldMap(newItems);
@@ -380,20 +355,21 @@ public class ExifRewriteTest extends Exi
Set missingInOld = new HashSet(newFieldMap.keySet());
missingInOld.removeAll(oldFieldMap.keySet());
- // dump("missingInNew", missingInNew);
- // dump("missingInOld", missingInOld);
- // dump("newFieldMap.keySet()", newFieldMap.keySet());
- // dump("oldFieldMap.keySet()", oldFieldMap.keySet());
+ // dump("missingInNew", missingInNew);
+ // dump("missingInOld", missingInOld);
+ // dump("newFieldMap.keySet()", newFieldMap.keySet());
+ // dump("oldFieldMap.keySet()", oldFieldMap.keySet());
assertTrue(missingInNew.size() == 0);
assertTrue(missingInOld.size() == 0);
- // Debug.debug("oldItems.size()", oldItems.size());
- // Debug.debug("oldFieldMap.keySet().size()", oldFieldMap.keySet().size());
-
- // assertEquals(oldItems.size(), oldFieldMap.keySet().size());
- // assertEquals(oldFieldMap.keySet(), newFieldMap.keySet());
- // assertEquals(oldFieldMap.keySet(), newFieldMap.keySet());
+ // Debug.debug("oldItems.size()", oldItems.size());
+ // Debug.debug("oldFieldMap.keySet().size()",
+ // oldFieldMap.keySet().size());
+
+ // assertEquals(oldItems.size(), oldFieldMap.keySet().size());
+ // assertEquals(oldFieldMap.keySet(), newFieldMap.keySet());
+ // assertEquals(oldFieldMap.keySet(), newFieldMap.keySet());
List oldFieldTags = new ArrayList(oldFieldMap.keySet());
Collections.sort(oldFieldTags);
@@ -401,36 +377,32 @@ public class ExifRewriteTest extends Exi
Collections.sort(newFieldTags);
assertEquals(oldFieldTags, newFieldTags);
- for (int j = 0; j < oldFieldTags.size(); j++)
- {
+ for (int j = 0; j < oldFieldTags.size(); j++) {
Integer fieldTag = (Integer) oldFieldTags.get(j);
TiffField oldField = (TiffField) oldFieldMap.get(fieldTag);
TiffField newField = (TiffField) newFieldMap.get(fieldTag);
- // Debug.debug("fieldTag", fieldTag);
- // Debug.debug("oldField", oldField);
- // Debug.debug("newField", newField);
+ // Debug.debug("fieldTag", fieldTag);
+ // Debug.debug("oldField", oldField);
+ // Debug.debug("newField", newField);
- // fieldTag.
+ // fieldTag.
assertNotNull(oldField);
assertNotNull(newField);
assertEquals(oldField.tag, newField.tag);
assertEquals(dirType.intValue(), newField.directoryType);
assertEquals(oldField.directoryType, newField.directoryType);
-
- if (oldField.fieldType == TiffFieldTypeConstants.FIELD_TYPE_ASCII)
- {
+
+ if (oldField.fieldType == TiffFieldTypeConstants.FIELD_TYPE_ASCII) {
// Sanselan currently doesn't correctly rewrite
// strings if any byte had the highest bit set,
// so if the source had that, all bets are off.
byte[] rawBytes = oldField.fieldType.getRawBytes(oldField);
boolean hasInvalidByte = false;
- for (int k = 0; k < rawBytes.length; k++)
- {
- if ((rawBytes[k] & 0x80) != 0)
- {
+ for (int k = 0; k < rawBytes.length; k++) {
+ if ((rawBytes[k] & 0x80) != 0) {
hasInvalidByte = true;
break;
}
@@ -442,59 +414,60 @@ public class ExifRewriteTest extends Exi
assertEquals(oldField.length, newField.length);
assertEquals(oldField.isLocalValue(), newField.isLocalValue());
- if (oldField.tag == 0x202)
- {
- // ignore "jpg from raw length" value. may have off-by-one bug in certain cameras.
+ if (oldField.tag == 0x202) {
+ // ignore "jpg from raw length" value. may have off-by-one
+ // bug in certain cameras.
// i.e. Sony DCR-PC110
continue;
}
- if (!oldField.tagInfo.isOffset())
- {
- if (oldField.tagInfo.isText())
- { /* do nothing */ }
- else if (oldField.isLocalValue())
- {
- // Debug.debug("oldField.tag", oldField.tag);
- // Debug.debug("newField.tag", newField.tag);
- // Debug.debug("oldField.tagInfo", oldField.tagInfo);
- // Debug.debug("newField.tagInfo", newField.tagInfo);
- // Debug.debug("oldField.fieldType", oldField.fieldType);
- // Debug.debug("newField.fieldType", newField.fieldType);
- // Debug.debug("oldField.getBytesLength", oldField
- // .getBytesLength());
- // Debug.debug("newField.getBytesLength", newField
- // .getBytesLength());
+ if (!oldField.tagInfo.isOffset()) {
+ if (oldField.tagInfo.isText()) { /* do nothing */
+ } else if (oldField.isLocalValue()) {
+ // Debug.debug("oldField.tag", oldField.tag);
+ // Debug.debug("newField.tag", newField.tag);
+ // Debug.debug("oldField.tagInfo", oldField.tagInfo);
+ // Debug.debug("newField.tagInfo", newField.tagInfo);
+ // Debug.debug("oldField.fieldType",
+ // oldField.fieldType);
+ // Debug.debug("newField.fieldType",
+ // newField.fieldType);
+ // Debug.debug("oldField.getBytesLength", oldField
+ // .getBytesLength());
+ // Debug.debug("newField.getBytesLength", newField
+ // .getBytesLength());
//
- // Debug.debug("oldField.valueOffsetBytes",
- // oldField.valueOffsetBytes);
- // Debug.debug("newField.valueOffsetBytes",
- // newField.valueOffsetBytes);
-
- String label = imageFile.getName() +
- ", dirType[" + i + "]=" + dirType +
- ", fieldTag[" + j + "]=" + fieldTag;
+ // Debug.debug("oldField.valueOffsetBytes",
+ // oldField.valueOffsetBytes);
+ // Debug.debug("newField.valueOffsetBytes",
+ // newField.valueOffsetBytes);
+
+ String label = imageFile.getName() + ", dirType[" + i
+ + "]=" + dirType + ", fieldTag[" + j + "]="
+ + fieldTag;
if (oldField.tag == 0x116 || oldField.tag == 0x117)
compare(label, oldField, newField);
else {
compare(label, oldField.valueOffsetBytes,
- newField.valueOffsetBytes,
- oldField.getBytesLength(),
- newField.getBytesLength());
+ newField.valueOffsetBytes,
+ oldField.getBytesLength(),
+ newField.getBytesLength());
}
- }
- else
- {
- // Debug.debug("oldField.tagInfo", oldField.tagInfo);
- // Debug.debug("oldField.fieldType", oldField.fieldType);
- // Debug.debug("newField.fieldType", newField.fieldType);
- // Debug.debug("oldField.getBytesLength", oldField
- // .getBytesLength());
- // Debug.debug("newField.getBytesLength", newField
- // .getBytesLength());
-
- // Debug.debug("oldField.oversizeValue", oldField.oversizeValue);
- // Debug.debug("newField.oversizeValue", newField.oversizeValue);
+ } else {
+ // Debug.debug("oldField.tagInfo", oldField.tagInfo);
+ // Debug.debug("oldField.fieldType",
+ // oldField.fieldType);
+ // Debug.debug("newField.fieldType",
+ // newField.fieldType);
+ // Debug.debug("oldField.getBytesLength", oldField
+ // .getBytesLength());
+ // Debug.debug("newField.getBytesLength", newField
+ // .getBytesLength());
+
+ // Debug.debug("oldField.oversizeValue",
+ // oldField.oversizeValue);
+ // Debug.debug("newField.oversizeValue",
+ // newField.oversizeValue);
compare(oldField.oversizeValue, newField.oversizeValue);
}
@@ -502,14 +475,14 @@ public class ExifRewriteTest extends Exi
}
- // Debug.debug();
+ // Debug.debug();
}
}
- private void compare(String label, byte a[], byte b[], int aLength, int bLength)
- {
- // Debug.debug("c0 a", a);
- // Debug.debug("c0 b", b);
+ private void compare(String label, byte a[], byte b[], int aLength,
+ int bLength) {
+ // Debug.debug("c0 a", a);
+ // Debug.debug("c0 b", b);
assertEquals(aLength, bLength);
assertTrue(a.length >= aLength);
assertTrue(b.length >= bLength);
@@ -517,39 +490,37 @@ public class ExifRewriteTest extends Exi
assertNotNull(b);
assertEquals(a.length, b.length);
int length = aLength;
- for (int i = 0; i < length; i++)
- {
- // byte ba = a[i];
- // byte bb = b[i];
- // boolean eq = ba == bb;
- // Debug.debug("i: " + i + ", a[i]: " + ba + ", b[i]: " + bb + " = "
- // + (ba == bb) + " " + eq);
- // if(ba != bb)
- // assertFalse(true);
+ for (int i = 0; i < length; i++) {
+ // byte ba = a[i];
+ // byte bb = b[i];
+ // boolean eq = ba == bb;
+ // Debug.debug("i: " + i + ", a[i]: " + ba + ", b[i]: " + bb + " = "
+ // + (ba == bb) + " " + eq);
+ // if(ba != bb)
+ // assertFalse(true);
//
- // Debug.debug("i: " + i + ", a[i]: " + ba + ", b[i]: " + bb + " = "
- // + (ba == bb) + " " + eq);
- // assertTrue(eq == true);
+ // Debug.debug("i: " + i + ", a[i]: " + ba + ", b[i]: " + bb + " = "
+ // + (ba == bb) + " " + eq);
+ // assertTrue(eq == true);
assertEquals(label + ", byte[" + i + "]", a[i], b[i]);
- // Debug.debug("c");
- // assertTrue((0xff & a[i]) == (0xff & b[i]));
+ // Debug.debug("c");
+ // assertTrue((0xff & a[i]) == (0xff & b[i]));
}
}
- private void compare(String label, TiffField a, TiffField b) throws ImageReadException
- {
+ private void compare(String label, TiffField a, TiffField b)
+ throws ImageReadException {
Object v1 = a.getValue();
Object v2 = b.getValue();
- // Debug.debug("v1", v1 + " (" + Debug.getType(v1) + ")");
- // Debug.debug("v2", v2 + " (" + Debug.getType(v2) + ")");
+ // Debug.debug("v1", v1 + " (" + Debug.getType(v1) + ")");
+ // Debug.debug("v2", v2 + " (" + Debug.getType(v2) + ")");
assertEquals(label, v1, v2);
}
- private void compare(byte a[], byte b[])
- {
- // Debug.debug("c1 a", a);
- // Debug.debug("c1 b", b);
+ private void compare(byte a[], byte b[]) {
+ // Debug.debug("c1 a", a);
+ // Debug.debug("c1 b", b);
assertNotNull(a);
assertNotNull(b);
assertEquals(a.length, b.length);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java Sat May 26 21:19:03 2012
@@ -28,29 +28,25 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
import org.apache.commons.imaging.util.Debug;
-public class GpsTest extends ExifBaseTest implements ImagingConstants
-{
+public class GpsTest extends ExifBaseTest implements ImagingConstants {
- public void test() throws Exception
- {
+ public void test() throws Exception {
List images = getImagesWithExifData(300);
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
File imageFile = (File) images.get(i);
-// Debug.debug();
-// Debug.debug("imageFile", imageFile);
+ // Debug.debug();
+ // Debug.debug("imageFile", imageFile);
- if (imageFile.getParentFile().getName().toLowerCase().equals(
- "@broken"))
+ if (imageFile.getParentFile().getName().toLowerCase()
+ .equals("@broken"))
continue;
- try
- {
+ try {
Map params = new HashMap();
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
@@ -71,24 +67,23 @@ public class GpsTest extends ExifBaseTes
Debug.debug("imageFile", imageFile);
Debug.debug("gpsInfo", gpsInfo);
- Debug.debug("gpsInfo longitude as degrees east", gpsInfo
- .getLongitudeAsDegreesEast());
- Debug.debug("gpsInfo latitude as degrees north", gpsInfo
- .getLatitudeAsDegreesNorth());
+ Debug.debug("gpsInfo longitude as degrees east",
+ gpsInfo.getLongitudeAsDegreesEast());
+ Debug.debug("gpsInfo latitude as degrees north",
+ gpsInfo.getLatitudeAsDegreesNorth());
Debug.debug();
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
Debug.debug("imageFile", imageFile.getAbsoluteFile());
Debug.debug("imageFile", imageFile.length());
Debug.debug(e, 13);
- // File brokenFolder = new File(imageFile.getParentFile(), "@Broken");
- // if(!brokenFolder.exists())
- // brokenFolder.mkdirs();
- // File movedFile = new File(brokenFolder, imageFile.getName());
- // imageFile.renameTo(movedFile);
+ // File brokenFolder = new File(imageFile.getParentFile(),
+ // "@Broken");
+ // if(!brokenFolder.exists())
+ // brokenFolder.mkdirs();
+ // File movedFile = new File(brokenFolder, imageFile.getName());
+ // imageFile.renameTo(movedFile);
throw e;
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java Sat May 26 21:19:03 2012
@@ -26,22 +26,19 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants;
import org.apache.commons.imaging.util.Debug;
-public class MakerNoteFieldTest extends SpecificExifTagTest
-{
- // public MakerNoteFieldTest(String name)
- // {
- // super(name);
- // }
+public class MakerNoteFieldTest extends SpecificExifTagTest {
+ // public MakerNoteFieldTest(String name)
+ // {
+ // super(name);
+ // }
@Override
protected void checkField(File imageFile, TiffField field)
- throws IOException, ImageReadException, ImageWriteException
- {
- if (field.tag != ExifTagConstants.EXIF_TAG_MAKER_NOTE.tag)
- {
- // if (field.tag == EXIF_TAG_EXIF_OFFSET.tag)
- // ;
- // else
+ throws IOException, ImageReadException, ImageWriteException {
+ if (field.tag != ExifTagConstants.EXIF_TAG_MAKER_NOTE.tag) {
+ // if (field.tag == EXIF_TAG_EXIF_OFFSET.tag)
+ // ;
+ // else
return;
}
@@ -53,21 +50,21 @@ public class MakerNoteFieldTest extends
Debug.debug("field", field.tagInfo);
Debug.debug("length", field.length);
Debug.debug("fieldType", field.fieldType);
- // Debug.debug("field", Debug.getType(field));
+ // Debug.debug("field", Debug.getType(field));
Debug.debug();
- // try
- // {
- // Object userCommentValue = field.getValue();
- // Debug.debug("Text field value(" + field.tagInfo.name + ")",
- // userCommentValue);
- // // Debug.debug("userCommentValue", Debug.getType(userCommentValue));
- // }
- // catch (ImageReadException e)
- // {
- // Debug.debug("imageFile", imageFile);
- // Debug.debug(e);
- // }
+ // try
+ // {
+ // Object userCommentValue = field.getValue();
+ // Debug.debug("Text field value(" + field.tagInfo.name + ")",
+ // userCommentValue);
+ // // Debug.debug("userCommentValue", Debug.getType(userCommentValue));
+ // }
+ // catch (ImageReadException e)
+ // {
+ // Debug.debug("imageFile", imageFile);
+ // Debug.debug(e);
+ // }
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java Sat May 26 21:19:03 2012
@@ -33,32 +33,27 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.constants.AllTagConstants;
import org.apache.commons.imaging.util.Debug;
-public abstract class SpecificExifTagTest extends ExifBaseTest
- implements
- AllTagConstants
-{
- // public SpecificExifTagTest(String name)
- // {
- // super(name);
- // }
+public abstract class SpecificExifTagTest extends ExifBaseTest implements
+ AllTagConstants {
+ // public SpecificExifTagTest(String name)
+ // {
+ // super(name);
+ // }
- public void testSingleImage() throws Exception
- {
+ public void testSingleImage() throws Exception {
File imageFile = getImageWithExifData();
checkImage(imageFile);
}
- public void testAllImages() throws Exception
- {
+ public void testAllImages() throws Exception {
List images = getImagesWithExifData();
- for (int i = 0; i < images.size(); i++)
- {
- if(i%10==0)
- Debug.purgeMemory();
+ for (int i = 0; i < images.size(); i++) {
+ if (i % 10 == 0)
+ Debug.purgeMemory();
File imageFile = (File) images.get(i);
- if (imageFile.getParentFile().getName().toLowerCase().equals(
- "@broken"))
+ if (imageFile.getParentFile().getName().toLowerCase()
+ .equals("@broken"))
continue;
checkImage(imageFile);
}
@@ -68,9 +63,8 @@ public abstract class SpecificExifTagTes
throws IOException, ImageReadException, ImageWriteException;
private void checkImage(File imageFile) throws IOException,
- ImageReadException, ImageWriteException
- {
- // Debug.debug("imageFile", imageFile.getAbsoluteFile());
+ ImageReadException, ImageWriteException {
+ // Debug.debug("imageFile", imageFile.getAbsoluteFile());
Map params = new HashMap();
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
@@ -88,8 +82,7 @@ public abstract class SpecificExifTagTes
return;
List fields = exif.getAllFields();
- for (int i = 0; i < fields.size(); i++)
- {
+ for (int i = 0; i < fields.size(); i++) {
TiffField field = (TiffField) fields.get(i);
checkField(imageFile, field);
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java Sat May 26 21:19:03 2012
@@ -28,45 +28,46 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.util.Debug;
-public class TextFieldTest extends SpecificExifTagTest
-{
- // public TextFieldTest(String name)
- // {
- // super(name);
- // }
+public class TextFieldTest extends SpecificExifTagTest {
+ // public TextFieldTest(String name)
+ // {
+ // super(name);
+ // }
@Override
protected void checkField(File imageFile, TiffField field)
- throws IOException, ImageReadException, ImageWriteException
- {
- if (field.tag == ExifTagConstants.EXIF_TAG_USER_COMMENT.tag)
- { /* do nothing */ }
- else if (field.tag == GpsTagConstants.GPS_TAG_GPS_PROCESSING_METHOD.tag
- && field.directoryType == TiffDirectoryType.EXIF_DIRECTORY_GPS.directoryType)
- { /* do nothing */ }
- else if (field.tag == GpsTagConstants.GPS_TAG_GPS_AREA_INFORMATION.tag
- && field.directoryType == TiffDirectoryType.EXIF_DIRECTORY_GPS.directoryType)
- { /* do nothing */ }
- else
+ throws IOException, ImageReadException, ImageWriteException {
+ if (field.tag == ExifTagConstants.EXIF_TAG_USER_COMMENT.tag) { /*
+ * do
+ * nothing
+ */
+ } else if (field.tag == GpsTagConstants.GPS_TAG_GPS_PROCESSING_METHOD.tag
+ && field.directoryType == TiffDirectoryType.EXIF_DIRECTORY_GPS.directoryType) { /*
+ * do
+ * nothing
+ */
+ } else if (field.tag == GpsTagConstants.GPS_TAG_GPS_AREA_INFORMATION.tag
+ && field.directoryType == TiffDirectoryType.EXIF_DIRECTORY_GPS.directoryType) { /*
+ * do
+ * nothing
+ */
+ } else
return;
- // Debug.debug("field", field);
- // Debug.debug("field", Debug.getType(field));
+ // Debug.debug("field", field);
+ // Debug.debug("field", Debug.getType(field));
//
- // Debug.debug("field", field.tag);
- // Debug.debug("field", field.tagInfo);
- // Debug.debug("field", Debug.getType(field));
+ // Debug.debug("field", field.tag);
+ // Debug.debug("field", field.tagInfo);
+ // Debug.debug("field", Debug.getType(field));
- try
- {
+ try {
Object textFieldValue = field.getValue();
- // Debug.debug("imageFile", imageFile.getAbsoluteFile());
- // Debug.debug("Text field value(" + field.tagInfo.name + ")",
- // textFieldValue);
- // Debug.debug("userCommentValue", Debug.getType(userCommentValue));
- }
- catch (ImageReadException e)
- {
+ // Debug.debug("imageFile", imageFile.getAbsoluteFile());
+ // Debug.debug("Text field value(" + field.tagInfo.name + ")",
+ // textFieldValue);
+ // Debug.debug("userCommentValue", Debug.getType(userCommentValue));
+ } catch (ImageReadException e) {
Debug.debug("imageFile", imageFile.getAbsoluteFile());
Debug.debug(e);
throw e;
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java Sat May 26 21:19:03 2012
@@ -25,20 +25,16 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.constants.AllTagConstants;
import org.apache.commons.imaging.util.Debug;
-public class WriteExifMetadataExampleTest extends ExifBaseTest
- implements
- AllTagConstants
-{
- // public WriteExifMetadataExampleTest(String name)
- // {
- // super(name);
- // }
+public class WriteExifMetadataExampleTest extends ExifBaseTest implements
+ AllTagConstants {
+ // public WriteExifMetadataExampleTest(String name)
+ // {
+ // super(name);
+ // }
- public void test() throws Exception
- {
+ public void test() throws Exception {
List images = getJpegImages();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -48,27 +44,22 @@ public class WriteExifMetadataExampleTes
File tempFile = createTempFile("test", ".jpg");
Debug.debug("tempFile", tempFile.getAbsoluteFile());
- try
- {
+ try {
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
if (ignoreImageData)
continue;
new WriteExifMetadataExample().changeExifMetadata(imageFile,
tempFile);
- }
- catch (ExifRewriter.ExifOverflowException e)
- {
+ } catch (ExifRewriter.ExifOverflowException e) {
Debug.debug("Error image", imageFile.getAbsoluteFile());
Debug.debug(e, 4);
}
}
}
- public void testInsert() throws Exception
- {
+ public void testInsert() throws Exception {
List images = getJpegImages();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -78,19 +69,17 @@ public class WriteExifMetadataExampleTes
File tempFile = createTempFile("test", ".jpg");
Debug.debug("tempFile", tempFile.getAbsoluteFile());
- try
- {
+ try {
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
if (ignoreImageData)
continue;
new WriteExifMetadataExample().changeExifMetadata(imageFile,
tempFile);
- }
- catch (ExifRewriter.ExifOverflowException e)
- {
- Debug.debug("Ignoring unavoidable ExifOverflowException", e.getMessage());
+ } catch (ExifRewriter.ExifOverflowException e) {
+ Debug.debug("Ignoring unavoidable ExifOverflowException",
+ e.getMessage());
Debug.debug("Error image", imageFile.getAbsoluteFile());
-// Debug.debug(e, 4);
+ // Debug.debug(e, 4);
}
}
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java Sat May 26 21:19:03 2012
@@ -27,78 +27,63 @@ import org.apache.commons.imaging.common
import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
-public abstract class IptcBaseTest extends ImagingTest
-{
- protected static boolean hasIptcData(File file)
- {
- // Debug.debug("hasIptcData file", file.getAbsoluteFile());
+public abstract class IptcBaseTest extends ImagingTest {
+ protected static boolean hasIptcData(File file) {
+ // Debug.debug("hasIptcData file", file.getAbsoluteFile());
if (!file.getName().toLowerCase().endsWith(".jpg"))
return false;
- //ImageFormat format = Sanselan.guessFormat(file);
- //if (format != ImageFormat.IMAGE_FORMAT_JPEG)
- // return false;
+ // ImageFormat format = Sanselan.guessFormat(file);
+ // if (format != ImageFormat.IMAGE_FORMAT_JPEG)
+ // return false;
- try
- {
+ try {
ByteSource byteSource = new ByteSourceFile(file);
return new JpegImageParser().hasIptcSegment(byteSource);
- }
- catch (Exception e)
- {
- // Debug.debug("Error file", file.getAbsoluteFile());
- // Debug.debug(e, 4);
+ } catch (Exception e) {
+ // Debug.debug("Error file", file.getAbsoluteFile());
+ // Debug.debug(e, 4);
return false;
}
}
- private static final ImageFilter HAS_IPTC_IMAGE_FILTER = new ImageFilter()
- {
- public boolean accept(File file) throws IOException, ImageReadException
- {
+ private static final ImageFilter HAS_IPTC_IMAGE_FILTER = new ImageFilter() {
+ public boolean accept(File file) throws IOException, ImageReadException {
return hasIptcData(file);
}
};
- private static final ImageFilter JPEG_IMAGE_FILTER = new ImageFilter()
- {
- public boolean accept(File file) throws IOException, ImageReadException
- {
+ private static final ImageFilter JPEG_IMAGE_FILTER = new ImageFilter() {
+ public boolean accept(File file) throws IOException, ImageReadException {
return file.getName().toLowerCase().endsWith(".jpg");
}
};
protected File getImageWithIptcData() throws IOException,
- ImageReadException
- {
+ ImageReadException {
return getTestImage(HAS_IPTC_IMAGE_FILTER);
}
protected List getImagesWithIptcData() throws IOException,
- ImageReadException
- {
+ ImageReadException {
return getTestImages(HAS_IPTC_IMAGE_FILTER);
}
protected List getImagesWithIptcData(int max) throws IOException,
- ImageReadException
- {
+ ImageReadException {
return getTestImages(HAS_IPTC_IMAGE_FILTER, max);
}
- protected File getJpegImage() throws IOException, ImageReadException
- {
+ protected File getJpegImage() throws IOException, ImageReadException {
return getTestImage(JPEG_IMAGE_FILTER);
}
- protected List getJpegImages() throws IOException, ImageReadException
- {
+ protected List getJpegImages() throws IOException, ImageReadException {
return getTestImages(JPEG_IMAGE_FILTER);
}
protected List getJpegImages(int max) throws IOException,
- ImageReadException
- {
+ ImageReadException {
return getTestImages(JPEG_IMAGE_FILTER, max);
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java Sat May 26 21:19:03 2012
@@ -28,14 +28,11 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.jpeg.iptc.IptcRecord;
import org.apache.commons.imaging.util.Debug;
-public class IptcDumpTest extends IptcBaseTest
-{
+public class IptcDumpTest extends IptcBaseTest {
- public void test() throws Exception
- {
+ public void test() throws Exception {
List images = getImagesWithIptcData();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -49,9 +46,7 @@ public class IptcDumpTest extends IptcBa
Map params = new HashMap();
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
- params
- .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
- !ignoreImageData));
+ params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
JpegImageMetadata metadata = (JpegImageMetadata) Imaging
@@ -68,8 +63,7 @@ public class IptcDumpTest extends IptcBa
List oldRecords = psMetadata.photoshopApp13Data.getRecords();
Debug.debug();
- for (int j = 0; j < oldRecords.size(); j++)
- {
+ for (int j = 0; j < oldRecords.size(); j++) {
IptcRecord record = (IptcRecord) oldRecords.get(j);
if (record.iptcType != IptcTypes.CITY)
Debug.debug("Key: " + record.iptcType.getName() + " (0x"
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java Sat May 26 21:19:03 2012
@@ -35,21 +35,18 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.jpeg.iptc.PhotoshopApp13Data;
import org.apache.commons.imaging.util.Debug;
-public class IptcUpdateTest extends IptcBaseTest
-{
+public class IptcUpdateTest extends IptcBaseTest {
private List imagesWithIptcData;
@Override
- public void setUp() throws Exception
- {
+ public void setUp() throws Exception {
super.setUp();
imagesWithIptcData = getImagesWithIptcData();
}
@Override
- public void tearDown() throws Exception
- {
+ public void tearDown() throws Exception {
super.tearDown();
imagesWithIptcData = null;
@@ -58,11 +55,9 @@ public class IptcUpdateTest extends Iptc
/*
* Remove all Photoshop IPTC data from a JPEG file.
*/
- public void testRemove() throws Exception
- {
+ public void testRemove() throws Exception {
List images = imagesWithIptcData;
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -74,9 +69,7 @@ public class IptcUpdateTest extends Iptc
Map params = new HashMap();
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
- params
- .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
- !ignoreImageData));
+ params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
JpegPhotoshopMetadata metadata = new JpegImageParser()
.getPhotoshopMetadata(byteSource, params);
@@ -89,13 +82,11 @@ public class IptcUpdateTest extends Iptc
// test remove
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(noIptcFile);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().removeIPTC(byteSource, os);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -112,11 +103,9 @@ public class IptcUpdateTest extends Iptc
}
}
- public void testRemoveInsertUpdate() throws Exception
- {
+ public void testRemoveInsertUpdate() throws Exception {
List images = imagesWithIptcData;
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -130,9 +119,7 @@ public class IptcUpdateTest extends Iptc
Map params = new HashMap();
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
- params
- .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
- !ignoreImageData));
+ params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
@@ -147,13 +134,11 @@ public class IptcUpdateTest extends Iptc
// test remove
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(noIptcFile);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().removeIPTC(byteSource, os);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -175,16 +160,14 @@ public class IptcUpdateTest extends Iptc
List newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
List oldRecords = metadata.photoshopApp13Data.getRecords();
List newRecords = new ArrayList();
- for (int j = 0; j < oldRecords.size(); j++)
- {
+ for (int j = 0; j < oldRecords.size(); j++) {
IptcRecord record = (IptcRecord) oldRecords.get(j);
if (record.iptcType != IptcTypes.CITY
&& record.iptcType != IptcTypes.CREDIT)
newRecords.add(record);
}
- newRecords.add(new IptcRecord(IptcTypes.CITY,
- "Albany, NY"));
+ newRecords.add(new IptcRecord(IptcTypes.CITY, "Albany, NY"));
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
@@ -194,13 +177,11 @@ public class IptcUpdateTest extends Iptc
File updated = createTempFile(imageFile.getName()
+ ".iptc.update.", ".jpg");
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(updated);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -229,8 +210,7 @@ public class IptcUpdateTest extends Iptc
List newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
List newRecords = new ArrayList();
- newRecords.add(new IptcRecord(IptcTypes.CITY,
- "Albany, NY"));
+ newRecords.add(new IptcRecord(IptcTypes.CITY, "Albany, NY"));
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
@@ -240,13 +220,11 @@ public class IptcUpdateTest extends Iptc
File updated = createTempFile(imageFile.getName()
+ ".iptc.update.", ".jpg");
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(updated);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -275,8 +253,7 @@ public class IptcUpdateTest extends Iptc
List newBlocks = new ArrayList();
List newRecords = new ArrayList();
- newRecords.add(new IptcRecord(IptcTypes.CITY,
- "Albany, NY"));
+ newRecords.add(new IptcRecord(IptcTypes.CITY, "Albany, NY"));
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
@@ -286,14 +263,12 @@ public class IptcUpdateTest extends Iptc
File updated = createTempFile(imageFile.getName()
+ ".iptc.insert.", ".jpg");
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(updated);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().writeIPTC(new ByteSourceFile(
noIptcFile), os, newData);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -323,27 +298,23 @@ public class IptcUpdateTest extends Iptc
* Add a few IPTC values to JPEG images, whether or not they have existing
* IPTC data.
*/
- public void testAddIptcData() throws Exception
- {
+ public void testAddIptcData() throws Exception {
List images = getJpegImages();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
File imageFile = (File) images.get(i);
-// Debug.debug("imageFile", imageFile);
-// Debug.debug();
+ // Debug.debug("imageFile", imageFile);
+ // Debug.debug();
ByteSource byteSource = new ByteSourceFile(imageFile);
-// Debug.debug("Segments:");
-// new JpegUtils().dumpJFIF(byteSource);
+ // Debug.debug("Segments:");
+ // new JpegUtils().dumpJFIF(byteSource);
Map params = new HashMap();
boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
- params
- .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
- !ignoreImageData));
+ params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
JpegPhotoshopMetadata metadata = new JpegImageParser()
.getPhotoshopMetadata(byteSource, params);
@@ -353,21 +324,18 @@ public class IptcUpdateTest extends Iptc
List newBlocks = new ArrayList();
List newRecords = new ArrayList();
- if (null != metadata)
- {
+ if (null != metadata) {
boolean keepOldIptcNonTextValues = true;
if (keepOldIptcNonTextValues)
newBlocks.addAll(metadata.photoshopApp13Data
.getNonIptcBlocks());
boolean keepOldIptcTextValues = true;
- if (keepOldIptcTextValues)
- {
+ if (keepOldIptcTextValues) {
List oldRecords = metadata.photoshopApp13Data
.getRecords();
newRecords = new ArrayList();
- for (int j = 0; j < oldRecords.size(); j++)
- {
+ for (int j = 0; j < oldRecords.size(); j++) {
IptcRecord record = (IptcRecord) oldRecords.get(j);
if (record.iptcType != IptcTypes.CITY
&& record.iptcType != IptcTypes.CREDIT)
@@ -376,8 +344,7 @@ public class IptcUpdateTest extends Iptc
}
}
- newRecords.add(new IptcRecord(IptcTypes.CITY,
- "Albany, NY"));
+ newRecords.add(new IptcRecord(IptcTypes.CITY, "Albany, NY"));
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
@@ -387,13 +354,11 @@ public class IptcUpdateTest extends Iptc
File updated = createTempFile(imageFile.getName()
+ ".iptc.add.", ".jpg");
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(updated);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java Sat May 26 21:19:03 2012
@@ -27,80 +27,69 @@ import org.apache.commons.imaging.common
import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
-public abstract class JpegXmpBaseTest extends ImagingTest
-{
+public abstract class JpegXmpBaseTest extends ImagingTest {
- protected static boolean hasJpegXmpData(File file)
- {
+ protected static boolean hasJpegXmpData(File file) {
if (!file.getName().toLowerCase().endsWith(".jpg"))
return false;
- //ImageFormat format = Sanselan.guessFormat(file);
- //if (format != ImageFormat.IMAGE_FORMAT_JPEG)
- // return false;
+ // ImageFormat format = Sanselan.guessFormat(file);
+ // if (format != ImageFormat.IMAGE_FORMAT_JPEG)
+ // return false;
- // Debug.debug("possible file", file);
+ // Debug.debug("possible file", file);
- try
- {
+ try {
ByteSource byteSource = new ByteSourceFile(file);
return new JpegImageParser().hasXmpSegment(byteSource);
- }
- catch (Exception e)
- {
- // Debug.debug("Error file", file.getAbsoluteFile());
- // Debug.debug(e, 4);
+ } catch (Exception e) {
+ // Debug.debug("Error file", file.getAbsoluteFile());
+ // Debug.debug(e, 4);
return false;
}
}
- private static final ImageFilter HAS_JPEG_XMP_IMAGE_FILTER = new ImageFilter()
- {
- public boolean accept(File file) throws IOException, ImageReadException
- {
+ private static final ImageFilter HAS_JPEG_XMP_IMAGE_FILTER = new ImageFilter() {
+ public boolean accept(File file) throws IOException, ImageReadException {
return hasJpegXmpData(file);
}
};
-// private static final ImageFilter JPEG_IMAGE_FILTER = new ImageFilter()
-// {
-// public boolean accept(File file) throws IOException, ImageReadException
-// {
-// return file.getName().toLowerCase().endsWith(".jpg");
-// }
-// };
-
- protected File getImageWithXmpData() throws IOException,
- ImageReadException
- {
+ // private static final ImageFilter JPEG_IMAGE_FILTER = new ImageFilter()
+ // {
+ // public boolean accept(File file) throws IOException, ImageReadException
+ // {
+ // return file.getName().toLowerCase().endsWith(".jpg");
+ // }
+ // };
+
+ protected File getImageWithXmpData() throws IOException, ImageReadException {
return getTestImage(HAS_JPEG_XMP_IMAGE_FILTER);
}
protected List getImagesWithXmpData() throws IOException,
- ImageReadException
- {
+ ImageReadException {
return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER);
}
protected List getImagesWithXmpData(int max) throws IOException,
- ImageReadException
- {
+ ImageReadException {
return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER, max);
}
-// protected File getJpegImage() throws IOException, ImageReadException
-// {
-// return getTestImage(JPEG_IMAGE_FILTER);
-// }
-//
-// protected List getJpegImages() throws IOException, ImageReadException
-// {
-// return getTestImages(JPEG_IMAGE_FILTER);
-// }
-//
-// protected List getJpegImages(int max) throws IOException,
-// ImageReadException
-// {
-// return getTestImages(JPEG_IMAGE_FILTER, max);
-// }
+ // protected File getJpegImage() throws IOException, ImageReadException
+ // {
+ // return getTestImage(JPEG_IMAGE_FILTER);
+ // }
+ //
+ // protected List getJpegImages() throws IOException, ImageReadException
+ // {
+ // return getTestImages(JPEG_IMAGE_FILTER);
+ // }
+ //
+ // protected List getJpegImages(int max) throws IOException,
+ // ImageReadException
+ // {
+ // return getTestImages(JPEG_IMAGE_FILTER, max);
+ // }
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java Sat May 26 21:19:03 2012
@@ -27,14 +27,11 @@ import org.apache.commons.imaging.common
import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
import org.apache.commons.imaging.util.Debug;
-public class JpegXmpDumpTest extends JpegXmpBaseTest
-{
+public class JpegXmpDumpTest extends JpegXmpBaseTest {
- public void test() throws Exception
- {
+ public void test() throws Exception {
List images = getImagesWithXmpData();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -44,7 +41,7 @@ public class JpegXmpDumpTest extends Jpe
ByteSource byteSource = new ByteSourceFile(imageFile);
Map params = new HashMap();
- String xmpXml = new JpegImageParser().getXmpXml(byteSource, params );
+ String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
assertNotNull(xmpXml);
Debug.debug("xmpXml", xmpXml);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java Sat May 26 21:19:03 2012
@@ -31,14 +31,11 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.jpeg.xmp.JpegXmpRewriter;
import org.apache.commons.imaging.util.Debug;
-public class JpegXmpRewriteTest extends JpegXmpBaseTest
-{
+public class JpegXmpRewriteTest extends JpegXmpBaseTest {
- public void testRemoveInsertUpdate() throws Exception
- {
+ public void testRemoveInsertUpdate() throws Exception {
List images = getImagesWithXmpData();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
@@ -65,13 +62,11 @@ public class JpegXmpRewriteTest extends
// test remove
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(noXmpFile);
os = new BufferedOutputStream(os);
new JpegXmpRewriter().removeXmpXml(byteSource, os);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -92,14 +87,12 @@ public class JpegXmpRewriteTest extends
String newXmpXml = "test";
File updated = createTempFile(imageFile.getName() + ".", ".jpg");
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(updated);
os = new BufferedOutputStream(os);
new JpegXmpRewriter().updateXmpXml(byteSource, os,
newXmpXml);
- } finally
- {
+ } finally {
if (os != null) {
os.close();
}
@@ -121,14 +114,12 @@ public class JpegXmpRewriteTest extends
String newXmpXml = "test";
File updated = createTempFile(imageFile.getName() + ".", ".jpg");
OutputStream os = null;
- try
- {
+ try {
os = new FileOutputStream(updated);
os = new BufferedOutputStream(os);
- new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(noXmpFile), os,
- newXmpXml);
- } finally
- {
+ new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(
+ noXmpFile), os, newXmpXml);
+ } finally {
if (os != null) {
os.close();
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java Sat May 26 21:19:03 2012
@@ -24,23 +24,19 @@ import java.util.List;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.ImagingTest;
-public abstract class PcxBaseTest extends ImagingTest
-{
+public abstract class PcxBaseTest extends ImagingTest {
- private static boolean isPcx(File file)
- {
+ private static boolean isPcx(File file) {
return file.getName().toLowerCase().endsWith(".pcx");
}
private static final ImageFilter IMAGE_FILTER = new ImageFilter() {
- public boolean accept(File file) throws IOException, ImageReadException
- {
+ public boolean accept(File file) throws IOException, ImageReadException {
return isPcx(file);
}
};
- protected List getPcxImages() throws IOException, ImageReadException
- {
+ protected List getPcxImages() throws IOException, ImageReadException {
return getTestImages(IMAGE_FILTER);
}
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java Sat May 26 21:19:03 2012
@@ -28,16 +28,13 @@ import org.apache.commons.imaging.Imagin
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
-public class PcxReadTest extends PcxBaseTest
-{
+public class PcxReadTest extends PcxBaseTest {
- public void test() throws Exception
- {
+ public void test() throws Exception {
Debug.debug("start");
List images = getPcxImages();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java Sat May 26 21:19:03 2012
@@ -28,10 +28,7 @@ import org.apache.commons.imaging.util.D
public class ConvertPngToGifTest extends PngBaseTest {
-
-
- public void test() throws Exception
- {
+ public void test() throws Exception {
List images = getPngImages();
for (int i = 0; i < images.size(); i++) {
@@ -45,13 +42,13 @@ public class ConvertPngToGifTest extends
// Debug.debug();
Hashtable params = new Hashtable();
-// params.put(SanselanConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
+ // params.put(SanselanConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
BufferedImage image = Imaging.getBufferedImage(imageFile, params);
assertNotNull(image);
- File outFile = createTempFile(imageFile.getName()+".", ".gif");
-// Debug.debug("outFile", outFile);
+ File outFile = createTempFile(imageFile.getName() + ".", ".gif");
+ // Debug.debug("outFile", outFile);
Imaging.writeImage(image, outFile, ImageFormat.IMAGE_FORMAT_GIF,
params);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java Sat May 26 21:19:03 2012
@@ -26,28 +26,22 @@ import org.apache.commons.imaging.ImageR
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingTest;
-public abstract class PngBaseTest extends ImagingTest
-{
+public abstract class PngBaseTest extends ImagingTest {
private static boolean isPng(File file) throws IOException,
- ImageReadException
- {
+ ImageReadException {
ImageFormat format = Imaging.guessFormat(file);
return format == ImageFormat.IMAGE_FORMAT_PNG;
}
private static final ImageFilter imageFilter = new ImageFilter() {
- public boolean accept(File file) throws IOException, ImageReadException
- {
+ public boolean accept(File file) throws IOException, ImageReadException {
return isPng(file);
}
};
- protected List getPngImages() throws IOException, ImageReadException
- {
+ protected List getPngImages() throws IOException, ImageReadException {
return getTestImages(imageFilter);
}
-
-
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java Sat May 26 21:19:03 2012
@@ -27,30 +27,27 @@ import org.apache.commons.imaging.ImageF
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.util.Debug;
-public class PngMultipleRoundtripTest extends PngBaseTest
-{
+public class PngMultipleRoundtripTest extends PngBaseTest {
- public void test() throws Exception
- {
- String imagesFolderPath = FilenameUtils.separatorsToSystem("src\\test\\data\\images\\png\\3");
+ public void test() throws Exception {
+ String imagesFolderPath = FilenameUtils
+ .separatorsToSystem("src\\test\\data\\images\\png\\3");
File imagesFolder = new File(imagesFolderPath);
assertTrue(imagesFolder.exists() && imagesFolder.isDirectory());
File files[] = imagesFolder.listFiles();
- for (int i = 0; i < files.length; i++)
- {
+ for (int i = 0; i < files.length; i++) {
File imageFile = files[i];
- if(!imageFile.isFile() )
+ if (!imageFile.isFile())
continue;
- if(!imageFile.getName().toLowerCase().endsWith(".png"))
+ if (!imageFile.getName().toLowerCase().endsWith(".png"))
continue;
Debug.debug();
Debug.debug("imageFile", imageFile);
File lastFile = imageFile;
- for (int j = 0; j < 10; j++)
- {
+ for (int j = 0; j < 10; j++) {
Map readParams = new HashMap();
// readParams.put(SanselanConstants.BUFFERED_IMAGE_FACTORY,
// new RgbBufferedImageFactory());
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java Sat May 26 21:19:03 2012
@@ -26,50 +26,37 @@ import org.apache.commons.imaging.Imagin
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
-public class PngReadTest extends PngBaseTest
-{
+public class PngReadTest extends PngBaseTest {
-
-
- public void test() throws Exception
- {
+ public void test() throws Exception {
Debug.debug("start");
List images = getPngImages();
- for (int i = 0; i < images.size(); i++)
- {
+ for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0)
Debug.purgeMemory();
File imageFile = (File) images.get(i);
Debug.debug("imageFile", imageFile);
- if (isInvalidPNGTestFile(imageFile))
- {
- try
- {
+ if (isInvalidPNGTestFile(imageFile)) {
+ try {
Imaging.getMetadata(imageFile);
fail("Image read should have failed.");
- } catch (Exception e)
- {
+ } catch (Exception e) {
}
- try
- {
+ try {
Imaging.getImageInfo(imageFile);
fail("Image read should have failed.");
- } catch (Exception e)
- {
+ } catch (Exception e) {
}
- try
- {
+ try {
Imaging.getBufferedImage(imageFile);
fail("Image read should have failed.");
- } catch (Exception e)
- {
+ } catch (Exception e) {
}
- } else
- {
+ } else {
IImageMetadata metadata = Imaging.getMetadata(imageFile);
// assertNotNull(metadata);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java Sat May 26 21:19:03 2012
@@ -32,11 +32,9 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.png.PngText;
import org.apache.commons.imaging.util.IoUtils;
-public class PngTextTest extends PngBaseTest
-{
+public class PngTextTest extends PngBaseTest {
- public void test() throws Exception
- {
+ public void test() throws Exception {
int width = 1;
int height = 1;
BufferedImage srcImage = new BufferedImage(width, height,
@@ -78,8 +76,7 @@ public class PngTextTest extends PngBase
List readTexts = imageInfo.getTextChunks();
assertEquals(readTexts.size(), 3);
- for (int i = 0; i < readTexts.size(); i++)
- {
+ for (int i = 0; i < readTexts.size(); i++) {
PngText text = (PngText) readTexts.get(i);
if (text.keyword.equals("a"))
assertEquals(text.text, "b");
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java Sat May 26 21:19:03 2012
@@ -30,8 +30,7 @@ import org.apache.commons.imaging.util.D
public class PngWriteForceTrueColorText extends PngBaseTest {
- public void test() throws Exception
- {
+ public void test() throws Exception {
List images = getPngImages();
for (int i = 0; i < images.size(); i++) {