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: import junit.framework.TestCase;
023:
024: public class Ellipse2DFloatTest extends TestCase {
025:
026: Ellipse2D.Float e;
027:
028: @Override
029: protected void setUp() throws Exception {
030: e = new Ellipse2D.Float(1.0f, 2.0f, 3.0f, 4.0f);
031: }
032:
033: @Override
034: protected void tearDown() throws Exception {
035: e = null;
036: }
037:
038: public void testCreate1() {
039: e = new Ellipse2D.Float();
040: assertNotNull(e);
041: assertEquals(e.x, 0.0f, 0.0f);
042: assertEquals(e.y, 0.0f, 0.0f);
043: assertEquals(e.width, 0.0f, 0.0f);
044: assertEquals(e.height, 0.0f, 0.0f);
045: }
046:
047: public void testCreate2() {
048: assertNotNull(e);
049: assertEquals(e.x, 1.0f, 0.0f);
050: assertEquals(e.y, 2.0f, 0.0f);
051: assertEquals(e.width, 3.0f, 0.0f);
052: assertEquals(e.height, 4.0f, 0.0f);
053: }
054:
055: public void testGetX() {
056: assertEquals(e.getX(), 1.0f, 0.0f);
057: }
058:
059: public void testGetY() {
060: assertEquals(e.getY(), 2.0f, 0.0f);
061: }
062:
063: public void testGetWidth() {
064: assertEquals(e.getWidth(), 3.0f, 0.0f);
065: }
066:
067: public void testGetHeight() {
068: assertEquals(e.getHeight(), 4.0f, 0.0f);
069: }
070:
071: public void testGetBounds2D() {
072: assertEquals(e.getBounds2D(), new Rectangle2D.Float(1.0f, 2.0f,
073: 3.0f, 4.0f));
074: }
075:
076: public void testIsEmpty() {
077: assertFalse(e.isEmpty());
078: assertTrue(new Ellipse2D.Float().isEmpty());
079: }
080:
081: public void testSetFrame1() {
082: e.setFrame(5.0, 6.0, 7.0, 8.0);
083: assertEquals(e.x, 5.0, 0.0);
084: assertEquals(e.y, 6.0, 0.0);
085: assertEquals(e.width, 7.0, 0.0);
086: assertEquals(e.height, 8.0, 0.0);
087: }
088:
089: public void testSetFrame2() {
090: e.setFrame(5.0f, 6.0f, 7.0f, 8.0f);
091: assertEquals(e.x, 5.0f, 0.0f);
092: assertEquals(e.y, 6.0f, 0.0f);
093: assertEquals(e.width, 7.0f, 0.0f);
094: assertEquals(e.height, 8.0f, 0.0f);
095: }
096:
097: public static void main(String[] args) {
098: junit.textui.TestRunner.run(Ellipse2DFloatTest.class);
099: }
100:
101: }
|