Skip to content

Commit f5e123e

Browse files
Stefan Kuhnegonw
authored andcommitted
Added a test case for GeometryTools.has2DCoordinatesNew where a mol file has a single atom with 0,0,0 as coordinate. This is not considered a 2d coordinate right now, but in a way it is one.
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
1 parent 0064458 commit f5e123e

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
CDK 1/12/10,12:20
3+
4+
1 0 0 0 0 0 0 0 0 0999 V2000
5+
0.0000 0.0000 0.0000 N 0 0 0 0 0 3 0 0 0 0 0 0
6+
M END

src/test/org/openscience/cdk/geometry/GeometryToolsTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.openscience.cdk.Molecule;
3737
import org.openscience.cdk.Reaction;
3838
import org.openscience.cdk.config.Elements;
39+
import org.openscience.cdk.exception.CDKException;
3940
import org.openscience.cdk.interfaces.IAtom;
4041
import org.openscience.cdk.interfaces.IAtomContainer;
4142
import org.openscience.cdk.interfaces.IBond;
@@ -89,6 +90,15 @@ public class GeometryToolsTest extends CDKTestCase {
8990
Assert.assertFalse(GeometryTools.has2DCoordinates((IAtomContainer)null));
9091
}
9192

93+
@Test public void testHas2DCoordinates_With000() throws CDKException {
94+
String filenameMol = "data/mdl/with000coordinate.mol";
95+
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filenameMol);
96+
Molecule molOne=null;
97+
MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.STRICT);
98+
molOne = (Molecule)reader.read(new Molecule());
99+
Assert.assertEquals(2,GeometryTools.has2DCoordinatesNew(molOne));
100+
}
101+
92102
@Test public void testTranslateAllPositive_IAtomContainer() {
93103
IAtomContainer container = new NNAtomContainer();
94104
IAtom atom = new NNAtom(Elements.CARBON);

0 commit comments

Comments
 (0)