Skip to content

Commit

Permalink
Added Unit test for GeoTiff HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanOltmann committed Apr 1, 2024
1 parent 9455032 commit 33ec829
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/src/jvmTest/kotlin/HtmlGeneratorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,30 @@ class HtmlGeneratorTest {
}
}

@Test
fun testToGeoTiffHtmlString() {

val imageBytes = Path("src/jvmTest/resources/photo_8.tif").readBytes()

val metadata = Kim.readMetadata(imageBytes)

assertNotNull(metadata)

val actualHtml = metadata.toGeoTiffHtmlString()

val expectedHtml = Path("src/jvmTest/resources/photo_8_geotiff.html")
.readBytes()
.decodeToString()

if (expectedHtml != actualHtml) {

Path("build/photo_8_geotiff.html")
.writeText(actualHtml)

fail("HTML photo_8_geotiff.html differs.")
}
}

@Test
fun testGenerateHexHtmlJpeg() {

Expand Down
Binary file added app/src/jvmTest/resources/photo_8.tif
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/jvmTest/resources/photo_8_geotiff.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<table><tr><th>Name</th><th>Value</th></tr><tr><td>Version</td><td>1.0.2</tr><tr><td>Model type</td><td>Geographic</tr><tr><td>Raster type</td><td>Pixel Is Point</tr><tr><td>Geographic type</td><td>WGS 84</tr></table>

0 comments on commit 33ec829

Please sign in to comment.