001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Denis M. Kishenko
019: * @version $Revision$
020: */package java.awt.geom;
021:
022: public class RoundRectangle2DDoubleTest extends GeomTestCase {
023:
024: RoundRectangle2D.Double r;
025:
026: public RoundRectangle2DDoubleTest(String name) {
027: super (name);
028: }
029:
030: @Override
031: protected void setUp() throws Exception {
032: super .setUp();
033: r = new RoundRectangle2D.Double(1, 2, 3, 4, 5, 6);
034: }
035:
036: @Override
037: protected void tearDown() throws Exception {
038: super .tearDown();
039: }
040:
041: public void testCreate() {
042: assertEquals(new RoundRectangle2D.Double(),
043: new RoundRectangle2D.Double(0, 0, 0, 0, 0, 0));
044: }
045:
046: public void testGetX() {
047: assertEquals(1.0, r.getX(), 0.0);
048: }
049:
050: public void testGetY() {
051: assertEquals(2.0, r.getY(), 0.0);
052: }
053:
054: public void testGetWidth() {
055: assertEquals(3.0, r.getWidth(), 0.0);
056: }
057:
058: public void testGetHeight() {
059: assertEquals(4.0, r.getHeight(), 0.0);
060: }
061:
062: public void testGetArcWidth() {
063: assertEquals(5.0, r.getArcWidth(), 0.0);
064: }
065:
066: public void testGetArcHeight() {
067: assertEquals(6.0, r.getArcHeight(), 0.0);
068: }
069:
070: public void testIsEmpty() {
071: assertFalse(r.isEmpty());
072: assertTrue(new RoundRectangle2D.Double().isEmpty());
073: assertTrue(new RoundRectangle2D.Double(0, 0, -1, -2, 3, 4)
074: .isEmpty());
075: }
076:
077: public void testSetRoundRect1() {
078: r.setRoundRect(7.0, 8.0, 9.0, 10.0, 11.0, 12.0);
079: assertEquals(new RoundRectangle2D.Double(7, 8, 9, 10, 11, 12),
080: r);
081: }
082:
083: public void testSetRoundRect2() {
084: r.setRoundRect(7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f);
085: assertEquals(new RoundRectangle2D.Double(7, 8, 9, 10, 11, 12),
086: r);
087: }
088:
089: public void testSetRoundRect3() {
090: r
091: .setRoundRect(new RoundRectangle2D.Double(7, 8, 9, 10,
092: 11, 12));
093: assertEquals(new RoundRectangle2D.Double(7, 8, 9, 10, 11, 12),
094: r);
095: }
096:
097: public void testGetBounds() {
098: assertEquals(new Rectangle2D.Double(1, 2, 3, 4), r.getBounds());
099: assertEquals(new Rectangle2D.Double(),
100: new RoundRectangle2D.Double().getBounds());
101: }
102:
103: public static void main(String[] args) {
104: junit.textui.TestRunner.run(RoundRectangle2DDoubleTest.class);
105: }
106:
107: }
|