Skip to content

Commit f0b0c76

Browse files
committed
Added a missing test
1 parent a410f3e commit f0b0c76

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* Copyright (C) 2021 Egon Willighagen <egonw@users.sf.net>
2+
*
3+
* Contact: cdk-devel@lists.sourceforge.net
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public License
7+
* as published by the Free Software Foundation; either version 2.1
8+
* of the License, or (at your option) any later version.
9+
* All we ask is that proper credit is given for our work, which includes
10+
* - but is not limited to - adding the above copyright notice to the beginning
11+
* of your source code files, and to any copyright notice that you may distribute
12+
* with programs based on this work.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this program; if not, write to the Free Software
21+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22+
*/
23+
package org.openscience.cdk.renderer.color;
24+
25+
import java.awt.Color;
26+
27+
import org.junit.Assert;
28+
import org.junit.Test;
29+
import org.openscience.cdk.Atom;
30+
import org.openscience.cdk.CDKTestCase;
31+
import org.openscience.cdk.PseudoAtom;
32+
import org.openscience.cdk.interfaces.IAtom;
33+
34+
/**
35+
* @cdk.module test-render
36+
*/
37+
public class JmolColorsTest extends CDKTestCase {
38+
39+
@Test
40+
public void testGetAtomColor() {
41+
IAtomColorer colors = new JmolColors();
42+
Assert.assertNotNull(colors);
43+
Assert.assertEquals(
44+
new Color(0xFFFFFF).getRGB(), colors.getAtomColor(new Atom("H")).getRGB()
45+
);
46+
}
47+
48+
@Test
49+
public void testGetDefaultAtomColor() {
50+
IAtomColorer colors = new JmolColors();
51+
52+
Assert.assertNotNull(colors);
53+
IAtom imaginary = new PseudoAtom("Ix");
54+
Assert.assertEquals(
55+
new Color(0xB31FBA).getRGB(), colors.getAtomColor(imaginary).getRGB()
56+
);
57+
}
58+
}

0 commit comments

Comments
 (0)