Skip to content

Commit 9e6f406

Browse files
committed
Added test for SVG generation
1 parent 7c7a2c7 commit 9e6f406

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app/depict/src/test/java/org/openscience/cdk/depict/DepictionTest.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/*
2-
* Copyright (c) 2018 Saulius Gražulis <grazulis@ibt.lt>
1+
/* Copyright (c) 2018 Saulius Gražulis <grazulis@ibt.lt>
2+
* 2021 Egon Willighagen <egonw@users.sf.net>
33
*
44
* Contact: cdk-devel@lists.sourceforge.net
55
*
@@ -69,4 +69,16 @@ public void depictAsEps2() throws CDKException {
6969
assertEquals("%%BoundingBox: 0 0 92 33", lines[1]);
7070
}
7171

72+
@Test
73+
public void depictAsSvg() throws CDKException {
74+
DepictionGenerator dg = new DepictionGenerator();
75+
SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
76+
IAtomContainer ac = sp.parseSmiles("[nH]1cccc1");
77+
String svg = dg.depict(ac).toSvgStr();
78+
String nl = System.getProperty("line.separator");
79+
String lines[] = svg.split(nl,3);
80+
assertEquals("<?xml version='1.0' encoding='UTF-8'?>", lines[0]);
81+
assertEquals("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">", lines[1]);
82+
}
83+
7284
}

0 commit comments

Comments
 (0)