Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
catch exactly what's thrown below ControllerHub.generateNewCoords; ad…
Browse files Browse the repository at this point in the history
…d test for JChemPaint#165 = CDK1269
  • Loading branch information
rwst committed Nov 6, 2012
1 parent a46b642 commit 8b9c98a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ public static void generateNewCoordinates(IAtomContainer container) {
container.getAtom(i).setPoint2d(
cleanedMol.getAtom(i).getPoint2d());
}
} catch (Exception e) {
} catch (CDKException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Expand Down
1 change: 1 addition & 0 deletions src/test/org/openscience/jchempaint/AllJCPTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
BugSF70Test.class,
BugSF75Test.class,
BugSF80Test.class,
CDK1269Test.class,
CDK1272Test.class,
Issue4Test.class,
Issue8Test.class,
Expand Down
43 changes: 43 additions & 0 deletions src/test/org/openscience/jchempaint/CDK1269Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.openscience.jchempaint;

import org.fest.swing.fixture.JPanelFixture;
import org.junit.Assert;
import org.junit.Test;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;

/**
* @author Ralf Stephan <[email protected]>
*
* Tests chiral SMILES input with following cleanup.
* See also #165.
*/
public class CDK1269Test extends AbstractAppletTest {

@Test public void testCDK1269() {
JPanelFixture jcppanel=applet.panel("appletframe");
JChemPaintPanel panel = (JChemPaintPanel)jcppanel.target;
try {
jcpApplet.setSmiles("O=C(O)[C@H](N)C"); // L-alanine
panel.get2DHub().updateView();
applet.panel("renderpanel").robot.waitForIdle();
panel.get2DHub().cleanup();
panel.get2DHub().updateView();
applet.panel("renderpanel").robot.waitForIdle();
} catch (Throwable e) {
Assert.fail();
}
/*
int atomCount=0, bondCount=0, implicitHCount=0;
for(IAtomContainer atc : panel.getChemModel().getMoleculeSet().atomContainers()) {
for (IAtom a : atc.atoms())
implicitHCount += a.getImplicitHydrogenCount();
atomCount+=atc.getAtomCount();
bondCount+=atc.getBondCount();
}
Assert.assertEquals(7, atomCount);
Assert.assertEquals(6, bondCount);
Assert.assertEquals(6, implicitHCount);*/
}

}

0 comments on commit 8b9c98a

Please sign in to comment.