Skip to content

Commit 881bf3a

Browse files
committed
Add test for Drawing to an OutputStream
1 parent 94f4e2c commit 881bf3a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/groovy/geoscript/render/DrawTestCase.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ class DrawTestCase {
4747
ImageAssert.assertEquals(expectedFile, ImageIO.read(file), 100)
4848
}
4949

50+
@Test void drawGeometryToOutputStream() {
51+
Symbolizer sym = new Stroke('black', 2) + new Fill('gray',0.75)
52+
Geometry geom = new Point(0,0).buffer(0.2)
53+
File file = folder.newFile("draw_geometry.png")
54+
OutputStream outputStream = new FileOutputStream(file)
55+
draw(geom, style: sym, bounds: geom.bounds.scale(1.1), size: [250,250], out: outputStream, format: "png", backgroundColor: "white")
56+
outputStream.flush()
57+
outputStream.close()
58+
assertTrue file.exists()
59+
assertTrue file.length() > 0
60+
File expectedFile = getFile("geoscript/render/draw_geometry.png")
61+
ImageAssert.assertEquals(expectedFile, ImageIO.read(file), 100)
62+
}
63+
5064
@Test void drawGeometries() {
5165
Symbolizer sym = new Stroke('navy', 0.1)
5266
Geometry geom = new Point(0,0)

0 commit comments

Comments
 (0)