01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package java.awt.geom;
18:
19: import java.awt.geom.ShapeTestCase;
20:
21: public class RoundRectangle2DTest extends ShapeTestCase {
22:
23: public RoundRectangle2DTest(String name) {
24: super (name);
25: // filterImage = createFilter("^(round).*([.]ico)$", "(.*)((affine)|(flat)|(bounds))(.*)");
26: filterShape = createFilter("^(round).*([.]shape)$", null);
27: }
28:
29: public void testSetRoundRect() {
30: RoundRectangle2D r = new RoundRectangle2D.Double(1, 2, 3, 4, 5,
31: 6);
32: r.setRoundRect(7, 8, 9, 10, 11, 12);
33: assertEquals(7.0, r.getX(), 0.0);
34: assertEquals(8.0, r.getY(), 0.0);
35: assertEquals(9.0, r.getWidth(), 0.0);
36: assertEquals(10.0, r.getHeight(), 0.0);
37: assertEquals(11.0, r.getArcWidth(), 0.0);
38: assertEquals(12.0, r.getArcHeight(), 0.0);
39: }
40:
41: public void testSetFrame() {
42: RoundRectangle2D r = new RoundRectangle2D.Double(1, 2, 3, 4, 5,
43: 6);
44: r.setFrame(7, 8, 9, 10);
45: assertEquals(7.0, r.getX(), 0.0);
46: assertEquals(8.0, r.getY(), 0.0);
47: assertEquals(9.0, r.getWidth(), 0.0);
48: assertEquals(10.0, r.getHeight(), 0.0);
49: assertEquals(5.0, r.getArcWidth(), 0.0);
50: assertEquals(6.0, r.getArcHeight(), 0.0);
51: }
52:
53: public void testGetPathIteratorEmpty() {
54: // Regression test HARMONY-1585
55: RoundRectangle2D e = new RoundRectangle2D.Double();
56: PathIterator p = e.getPathIterator(null);
57: checkPathMove(p, false, 0, 0, 0.0);
58: checkPathLine(p, false, 0, 0, 0.0);
59: checkPathCubic(p, false, 0, 0, 0, 0, 0, 0, 0.0);
60: checkPathLine(p, false, 0, 0, 0.0);
61: checkPathCubic(p, false, 0, 0, 0, 0, 0, 0, 0.0);
62: checkPathLine(p, false, 0, 0, 0.0);
63: checkPathCubic(p, false, 0, 0, 0, 0, 0, 0, 0.0);
64: checkPathLine(p, false, 0, 0, 0.0);
65: checkPathCubic(p, false, 0, 0, 0, 0, 0, 0, 0.0);
66: checkPathClose(p, true);
67: }
68:
69: public static void main(String[] args) {
70: junit.textui.TestRunner.run(RoundRectangle2DTest.class);
71: }
72:
73: }
|