@Test public void testThreeGeoTIFFTagsWithOneAscii() { metadata.addGeoShortParam(2300, 4576); metadata.addGeoAscii(2400, "String"); metadata.addGeoShortParam(2401, 3456); final List<TIFFField> list = Utils.createGeoTIFFFields(metadata); assertNotNull(list); assertEquals(2, list.size()); final TIFFField dirField = list.get(0); final TIFFField asciiField = list.get(1); assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag()); assertEquals(GeoTIFFTagSet.TAG_GEO_ASCII_PARAMS, asciiField.getTag()); assertEquals(TIFFField.TIFF_SHORT, dirField.getType()); assertEquals(TIFFField.TIFF_ASCII, asciiField.getType()); assertEquals(16, dirField.getCount()); assertEquals(1, asciiField.getCount()); final char[] expected = { 1, 1, 2, 3, 2300, 0, 1, 4576, 2400, GeoTIFFTagSet.TAG_GEO_ASCII_PARAMS, 7, 0, 2401, 0, 1, 3456 }; assertArrayEquals(expected, dirField.getAsChars()); assertEquals("String|", asciiField.getAsString(0)); }
@Test public void testThreeGeoTIFFTagsWithOneDouble() { metadata.addGeoShortParam(2300, 4576); metadata.addGeoDoubleParam(2400, 4.5); metadata.addGeoShortParam(2401, 3456); final List<TIFFField> list = Utils.createGeoTIFFFields(metadata); assertNotNull(list); assertEquals(2, list.size()); final TIFFField dirField = list.get(0); final TIFFField doubleField = list.get(1); assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag()); assertEquals(GeoTIFFTagSet.TAG_GEO_DOUBLE_PARAMS, doubleField.getTag()); assertEquals(TIFFField.TIFF_SHORT, dirField.getType()); assertEquals(TIFFField.TIFF_DOUBLE, doubleField.getType()); assertEquals(16, dirField.getCount()); assertEquals(1, doubleField.getCount()); final char[] expected = { 1, 1, 2, 3, 2300, 0, 1, 4576, 2400, GeoTIFFTagSet.TAG_GEO_DOUBLE_PARAMS, 1, 0, 2401, 0, 1, 3456 }; assertArrayEquals(expected, dirField.getAsChars()); assertEquals(true, Arrays.equals(new double[] {4.5}, doubleField.getAsDoubles())); }
@Test public void testThreeGeoTIFFShortTags() { metadata.addGeoShortParam(2300, 4576); metadata.addGeoShortParam(2400, 12); metadata.addGeoShortParam(2401, 3456); final List<TIFFField> list = Utils.createGeoTIFFFields(metadata); assertNotNull(list); assertEquals(1, list.size()); final TIFFField dirField = list.get(0); assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag()); assertEquals(TIFFField.TIFF_SHORT, dirField.getType()); assertEquals(16, dirField.getCount()); final char[] expected = { 1, 1, 2, 3, 2300, 0, 1, 4576, 2400, 0, 1, 12, 2401, 0, 1, 3456 }; assertArrayEquals(expected, dirField.getAsChars()); }