Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Two more missing test classes, and missing annotation in ArrowElement
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed May 18, 2012
1 parent b245c6f commit 403ac57
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
Expand Up @@ -21,11 +21,15 @@

import java.awt.Color;

import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;

/**
* {@link IRenderingElement} for linear arrows.
*
* @cdk.module renderbasic
*/
@TestClass("org.openscience.cdk.renderer.elements.ArrowElementTest")
public class ArrowElement implements IRenderingElement {

public final double startX;
Expand Down Expand Up @@ -60,6 +64,7 @@ public ArrowElement(double startX, double startY, double endX, double endY,
}

/** {@inheritDoc} */
@TestMethod("testAccept")
public void accept(IRenderingVisitor v) {
v.visit(this);
}
Expand Down
Expand Up @@ -24,12 +24,16 @@
import java.util.Iterator;
import java.util.List;

import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;

/**
* A group of rendering elements, of any type.
*
* @cdk.module renderbasic
* @cdk.githash
*/
@TestClass("org.openscience.cdk.renderer.elements.ElementGroupTest")
public class ElementGroup
implements IRenderingElement, Iterable<IRenderingElement> {

Expand Down Expand Up @@ -72,6 +76,7 @@ public void visitChildren(IRenderingVisitor visitor) {
}

/** {@inheritDoc} */
@TestMethod("testAccept")
public void accept( IRenderingVisitor v ) {
v.visit( this );
}
Expand Down
Expand Up @@ -22,6 +22,9 @@
import java.util.ArrayList;
import java.util.List;

import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;

/**
* A group of text elements, particularly the element symbol (eg: "C")
* surrounded by other annotations such as mass number, charge, etc. These
Expand All @@ -30,6 +33,7 @@
* @cdk.module renderbasic
* @cdk.githash
*/
@TestClass("org.openscience.cdk.renderer.elements.TextGroupElementTest")
public class TextGroupElement extends TextElement {

/**
Expand Down Expand Up @@ -100,6 +104,7 @@ public Child(String text, String subscript, Position position) {
* @param text the text to render
* @param color the color of the text
*/
@TestMethod("testConstructor")
public TextGroupElement(double x, double y, String text, Color color) {
super(x, y, text, color);
this.children = new ArrayList<Child>();
Expand Down Expand Up @@ -129,6 +134,7 @@ public void addChild(String text, String subscript, Position position) {
/**
* {@inheritDoc}
*/
@TestMethod("testAccept")
public void accept(IRenderingVisitor v) {
v.visit(this);
}
Expand Down
Expand Up @@ -26,12 +26,14 @@
import org.openscience.cdk.renderer.BoundsCalculatorTest;
import org.openscience.cdk.renderer.elements.ArrowElementTest;
import org.openscience.cdk.renderer.elements.AtomSymbolElementTest;
import org.openscience.cdk.renderer.elements.ElementGroupTest;
import org.openscience.cdk.renderer.elements.GeneralPathTest;
import org.openscience.cdk.renderer.elements.LineElementTest;
import org.openscience.cdk.renderer.elements.OvalElementTest;
import org.openscience.cdk.renderer.elements.PathElementTest;
import org.openscience.cdk.renderer.elements.RectangleElementTest;
import org.openscience.cdk.renderer.elements.RingElementTest;
import org.openscience.cdk.renderer.elements.TextGroupElementTest;
import org.openscience.cdk.renderer.elements.WedgeLineElementTest;
import org.openscience.cdk.renderer.elements.path.CubicToTest;
import org.openscience.cdk.renderer.elements.path.LineToTest;
Expand Down Expand Up @@ -64,6 +66,8 @@
PathElementTest.class,
OvalElementTest.class,
RingElementTest.class,
ElementGroupTest.class,
TextGroupElementTest.class,
AtomSymbolElementTest.class,
RectangleElementTest.class,
ArrowElementTest.class,
Expand Down
@@ -0,0 +1,37 @@
/* Copyright (C) 2012 Egon Willighagen <egonw@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version. All we ask is that proper credit is given for our work,
* which includes - but is not limited to - adding the above copyright notice to
* the beginning of your source code files, and to any copyright notice that you
* may distribute with programs based on this work.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.openscience.cdk.renderer.elements;

import org.junit.BeforeClass;

/**
* @cdk.module test-renderbasic
*/
public class ElementGroupTest extends AbstractElementTest {

@BeforeClass
public static void setup() {
IRenderingElement element = new ElementGroup();
setRenderingElement(element);
}

}
@@ -0,0 +1,39 @@
/* Copyright (C) 2012 Egon Willighagen <egonw@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version. All we ask is that proper credit is given for our work,
* which includes - but is not limited to - adding the above copyright notice to
* the beginning of your source code files, and to any copyright notice that you
* may distribute with programs based on this work.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.openscience.cdk.renderer.elements;

import java.awt.Color;

import org.junit.BeforeClass;

/**
* @cdk.module test-renderbasic
*/
public class TextGroupElementTest extends AbstractElementTest {

@BeforeClass
public static void setup() {
IRenderingElement element = new TextGroupElement(0, 0, "Red text", Color.RED);
setRenderingElement(element);
}

}

0 comments on commit 403ac57

Please sign in to comment.