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 RoundRectangle2DFloatTest extends GeomTestCase {
023:
024: RoundRectangle2D.Float r;
025:
026: public RoundRectangle2DFloatTest(String name) {
027: super (name);
028: }
029:
030: @Override
031: protected void setUp() throws Exception {
032: super .setUp();
033: r = new RoundRectangle2D.Float(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.Float(),
043: new RoundRectangle2D.Float(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.Float().isEmpty());
073: assertTrue(new RoundRectangle2D.Float(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.Float(7, 8, 9, 10, 11, 12), r);
080: }
081:
082: public void testSetRoundRect2() {
083: r.setRoundRect(7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f);
084: assertEquals(new RoundRectangle2D.Float(7, 8, 9, 10, 11, 12), r);
085: }
086:
087: public void testSetRoundRect3() {
088: r
089: .setRoundRect(new RoundRectangle2D.Double(7, 8, 9, 10,
090: 11, 12));
091: assertEquals(new RoundRectangle2D.Float(7, 8, 9, 10, 11, 12), r);
092: }
093:
094: public void testGetBounds() {
095: assertEquals(new Rectangle2D.Float(1, 2, 3, 4), r.getBounds());
096: assertEquals(new Rectangle2D.Float(),
097: new RoundRectangle2D.Float().getBounds());
098: }
099:
100: public static void main(String[] args) {
101: junit.textui.TestRunner.run(RoundRectangle2DFloatTest.class);
102: }
103:
104: }
|