Skip to content

Commit

Permalink
Fixup test compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Sep 11, 2017
1 parent d8cd6d6 commit e014a00
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ AtomSymbol generateSymbol(IAtomContainer container, IAtom atom, HydrogenPosition
// unset the mass if it's the major isotope (could be an option)
Integer mass = atom.getMassNumber();
if (mass != null &&
model != null &&
model.get(StandardGenerator.OmitMajorIsotopes.class) &&
isMajorIsotope(number, mass)) {
mass = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public static IRenderingElement embedText(Font font, String text, Color color, d
public List<IGeneratorParameter<?>> getParameters() {
return Arrays.asList(atomColor, visibility, strokeRatio, separationRatio, wedgeRatio, marginRatio,
hatchSections, dashSections, waveSections, fancyBoldWedges, fancyHashedWedges, highlighting, glowWidth,
annCol, annDist, annFontSize, sgroupBracketDepth, sgroupFontScale);
annCol, annDist, annFontSize, sgroupBracketDepth, sgroupFontScale, new OmitMajorIsotopes());
}

static String getAnnotationLabel(IChemObject chemObject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IPseudoAtom;
import org.openscience.cdk.renderer.RendererModel;

import java.awt.Font;
import java.awt.Shape;
Expand Down Expand Up @@ -399,8 +400,8 @@ public void generatesRgroupPseudoAtom() {
IAtomContainer container = mock(IAtomContainer.class);
IPseudoAtom atom = mock(IPseudoAtom.class);
when(atom.getLabel()).thenReturn("R1");
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
List<Shape> shapes = atomSymbol.getOutlines();
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(2));
}

Expand All @@ -413,7 +414,7 @@ public void generatesCarbon12() {
when(atom.getMassNumber()).thenReturn(12);
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(0);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(1));
}
Expand All @@ -426,7 +427,7 @@ public void generatesCarbon13() {
when(atom.getMassNumber()).thenReturn(13);
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(0);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(2));
}
Expand All @@ -439,7 +440,7 @@ public void nullMassNumber() {
when(atom.getMassNumber()).thenReturn(null);
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(0);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(1));
}
Expand All @@ -452,7 +453,7 @@ public void nullHydrogenCount() {
when(atom.getMassNumber()).thenReturn(12);
when(atom.getImplicitHydrogenCount()).thenReturn(null);
when(atom.getFormalCharge()).thenReturn(0);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(1));
}
Expand All @@ -465,7 +466,7 @@ public void nullFormatCharge() {
when(atom.getMassNumber()).thenReturn(12);
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(null);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(1));
}
Expand All @@ -479,7 +480,7 @@ public void nullAtomicNumber() {
when(atom.getMassNumber()).thenReturn(12);
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(0);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(1));
assertThat(atomSymbol.elementOutline().text(), is("C"));
Expand All @@ -494,7 +495,7 @@ public void nullAtomicNumberAndSymbol() {
when(atom.getMassNumber()).thenReturn(12);
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(0);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(1));
assertThat(atomSymbol.elementOutline().text(), is("?"));
Expand All @@ -509,7 +510,7 @@ public void unpairedElectronsAreAccessed() {
when(atom.getImplicitHydrogenCount()).thenReturn(0);
when(atom.getFormalCharge()).thenReturn(0);
when(container.getConnectedSingleElectronsCount(atom)).thenReturn(1);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left);
AtomSymbol atomSymbol = atomGenerator.generateSymbol(container, atom, HydrogenPosition.Left, new RendererModel());
List<Shape> shapes = atomSymbol.getOutlines();
assertThat(shapes.size(), is(2));
verify(container).getConnectedSingleElectronsCount(atom);
Expand Down

0 comments on commit e014a00

Please sign in to comment.