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: /**
18: * @author Denis M. Kishenko
19: * @version $Revision$
20: */package org.apache.harmony.awt.gl;
21:
22: import org.apache.harmony.awt.gl.MultiRectArea;
23:
24: public class MultiRectAreaLineCashTest extends MultiRectAreaTestCase {
25:
26: static int CASH_SIZE = 100;
27:
28: MultiRectArea.LineCash area;
29:
30: static {
31: SERIALIZATION_TEST = false;
32: }
33:
34: public MultiRectAreaLineCashTest(String name) {
35: super (name);
36: }
37:
38: @Override
39: protected void setUp() throws Exception {
40: super .setUp();
41: area = new MultiRectArea.LineCash(CASH_SIZE);
42: }
43:
44: @Override
45: protected void tearDown() throws Exception {
46: area = null;
47: super .tearDown();
48: }
49:
50: // 1234567
51: // 10 ##
52: // 11 ##
53: // 12 ##
54: // 13 ## ##
55: // 14 ## ##
56: // 15 ####
57: // 16 ## ##
58: public void testCash() {
59: checkArea("LineCash1", area, new int[] {});
60:
61: area.setLine(10);
62: area.addLine(new int[] { 1, 2 }, 2);
63: checkArea("LineCash2", area, new int[] { 1, 10, 2, 10 });
64:
65: area.addLine(new int[] { 1, 2 }, 2);
66: checkArea("LineCash3", area, new int[] { 1, 10, 2, 11 });
67:
68: area.addLine(new int[] { 1, 2 }, 2);
69: checkArea("LineCash4", area, new int[] { 1, 10, 2, 12 });
70:
71: area.addLine(new int[] { 1, 2, 4, 5 }, 4);
72: checkArea("LineCash5", area, new int[] { 1, 10, 2, 13, 4, 13,
73: 5, 13 });
74:
75: area.addLine(new int[] { 1, 2, 4, 5 }, 4);
76: checkArea("LineCash6", area, new int[] { 1, 10, 2, 14, 4, 13,
77: 5, 14 });
78:
79: area.addLine(new int[] { 4, 5, 6, 7 }, 4);
80: checkArea("LineCash7", area, new int[] { 1, 10, 2, 14, 4, 13,
81: 5, 15, 6, 15, 7, 15 });
82:
83: /// ????????
84: area.addLine(new int[] { 1, 2, 4, 5 }, 4);
85: checkArea("LineCash8", area, new int[] { 1, 10, 2, 14, 4, 13,
86: 5, 16, 6, 15, 7, 15, 1, 16, 2, 16 });
87:
88: }
89:
90: public static void main(String[] args) {
91: junit.textui.TestRunner.run(MultiRectAreaLineCashTest.class);
92: }
93:
94: }
|