Source Code Cross Referenced for BevelBorderTest.java in  » Apache-Harmony-Java-SE » javax-package » javax » swing » border » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » javax package » javax.swing.border 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 Alexander T. Simbirtsev
019:         * @version $Revision$
020:         * Created on 03.12.2004
021:
022:         */package javax.swing.border;
023:
024:        import java.awt.Color;
025:        import java.awt.Insets;
026:        import javax.swing.JComponent;
027:        import javax.swing.JPanel;
028:        import javax.swing.SwingTestCase;
029:
030:        public class BevelBorderTest extends SwingTestCase {
031:            public static void main(final String[] args) {
032:                junit.textui.TestRunner.run(BevelBorderTest.class);
033:            }
034:
035:            /*
036:             * Class under test for void BevelBorder(int)
037:             */
038:            public void testBevelBorderint() {
039:                int bevelType = BevelBorder.LOWERED;
040:                Color highlightColor = null;
041:                Color shadowColor = null;
042:                BevelBorder border = new BevelBorder(bevelType);
043:                assertEquals("highlightOuterColor coinsides", highlightColor,
044:                        border.getHighlightOuterColor());
045:                assertEquals("highlightInnerColor coinsides", highlightColor,
046:                        border.getHighlightInnerColor());
047:                assertEquals("shadowOuterColor coinsides", shadowColor, border
048:                        .getShadowOuterColor());
049:                assertEquals("shadowInnerColor coinsides", shadowColor, border
050:                        .getShadowInnerColor());
051:                assertEquals("Bevel type coinsides", bevelType, border
052:                        .getBevelType());
053:                bevelType = BevelBorder.RAISED;
054:                border = new BevelBorder(bevelType);
055:                assertEquals("highlightOuterColor coinsides", highlightColor,
056:                        border.getHighlightOuterColor());
057:                assertEquals("highlightInnerColor coinsides", highlightColor,
058:                        border.getHighlightInnerColor());
059:                assertEquals("shadowOuterColor coinsides", shadowColor, border
060:                        .getShadowOuterColor());
061:                assertEquals("shadowInnerColor coinsides", shadowColor, border
062:                        .getShadowInnerColor());
063:                assertEquals("Bevel type coinsides", bevelType, border
064:                        .getBevelType());
065:            }
066:
067:            /*
068:             * Class under test for void BevelBorder(int, Color, Color)
069:             */
070:            public void testBevelBorderintColorColor() {
071:                int bevelType = BevelBorder.LOWERED;
072:                Color highlightColor = Color.RED;
073:                Color shadowColor = Color.GREEN;
074:                BevelBorder border = new BevelBorder(bevelType, highlightColor,
075:                        shadowColor);
076:                assertEquals("highlightOuterColor coinsides", highlightColor,
077:                        border.getHighlightOuterColor());
078:                assertEquals("highlightInnerColor coinsides", highlightColor,
079:                        border.getHighlightInnerColor());
080:                assertEquals("shadowOuterColor coinsides", shadowColor, border
081:                        .getShadowOuterColor());
082:                assertEquals("shadowInnerColor coinsides", shadowColor, border
083:                        .getShadowInnerColor());
084:                assertEquals("Bevel type coinsides", bevelType, border
085:                        .getBevelType());
086:                bevelType = BevelBorder.RAISED;
087:                highlightColor = Color.YELLOW;
088:                shadowColor = Color.WHITE;
089:                border = new BevelBorder(bevelType, highlightColor, shadowColor);
090:                assertEquals("highlightOuterColor coinsides", highlightColor,
091:                        border.getHighlightOuterColor());
092:                assertEquals("highlightInnerColor coinsides", highlightColor,
093:                        border.getHighlightInnerColor());
094:                assertEquals("shadowOuterColor coinsides", shadowColor, border
095:                        .getShadowOuterColor());
096:                assertEquals("shadowInnerColor coinsides", shadowColor, border
097:                        .getShadowInnerColor());
098:                assertEquals("Bevel type coinsides", bevelType, border
099:                        .getBevelType());
100:            }
101:
102:            /*
103:             * Class under test for void BevelBorder(int, Color, Color, Color, Color)
104:             */
105:            public void testBevelBorderintColorColorColorColor() {
106:                int bevelType = BevelBorder.LOWERED;
107:                Color highlightOuterColor = Color.RED;
108:                Color highlightInnerColor = Color.YELLOW;
109:                Color shadowOuterColor = Color.GREEN;
110:                Color shadowInnerColor = Color.BLACK;
111:                BevelBorder border = new BevelBorder(bevelType,
112:                        highlightOuterColor, highlightInnerColor,
113:                        shadowOuterColor, shadowInnerColor);
114:                assertEquals("highlightOuterColor coinsides",
115:                        highlightOuterColor, border.getHighlightOuterColor());
116:                assertEquals("highlightInnerColor coinsides",
117:                        highlightInnerColor, border.getHighlightInnerColor());
118:                assertEquals("shadowOuterColor coinsides", shadowOuterColor,
119:                        border.getShadowOuterColor());
120:                assertEquals("shadowInnerColor coinsides", shadowInnerColor,
121:                        border.getShadowInnerColor());
122:                assertEquals("Bevel type coinsides", bevelType, border
123:                        .getBevelType());
124:                bevelType = BevelBorder.RAISED;
125:                highlightOuterColor = Color.YELLOW;
126:                highlightInnerColor = Color.RED;
127:                shadowOuterColor = Color.WHITE;
128:                shadowInnerColor = Color.BLUE;
129:                border = new BevelBorder(bevelType, highlightOuterColor,
130:                        highlightInnerColor, shadowOuterColor, shadowInnerColor);
131:                assertEquals("highlightOuterColor coinsides",
132:                        highlightOuterColor, border.getHighlightOuterColor());
133:                assertEquals("highlightInnerColor coinsides",
134:                        highlightInnerColor, border.getHighlightInnerColor());
135:                assertEquals("shadowOuterColor coinsides", shadowOuterColor,
136:                        border.getShadowOuterColor());
137:                assertEquals("shadowInnerColor coinsides", shadowInnerColor,
138:                        border.getShadowInnerColor());
139:                assertEquals("Bevel type coinsides", bevelType, border
140:                        .getBevelType());
141:            }
142:
143:            /*
144:             * Class under test for Insets getBorderInsets(Component, Insets)
145:             */
146:            public void testGetBorderInsetsComponentInsets() {
147:                int thickness1 = 2;
148:                int thickness2 = 22;
149:                int thickness3 = 33;
150:                BevelBorder border = new BevelBorder(BevelBorder.RAISED,
151:                        Color.black, Color.white);
152:                Insets insets = new Insets(1, 1, 1, 1);
153:                JPanel panel = new JPanel();
154:                border.getBorderInsets(panel, insets);
155:                assertEquals("insets values coinside", thickness1, insets.top);
156:                assertEquals("insets values coinside", thickness1, insets.left);
157:                assertEquals("insets values coinside", thickness1, insets.right);
158:                assertEquals("insets values coinside", thickness1,
159:                        insets.bottom);
160:                panel.setBorder(new LineBorder(Color.black, thickness2));
161:                border.getBorderInsets(panel, insets);
162:                assertEquals("insets values coinside", thickness1, insets.top);
163:                assertEquals("insets values coinside", thickness1, insets.left);
164:                assertEquals("insets values coinside", thickness1, insets.right);
165:                assertEquals("insets values coinside", thickness1,
166:                        insets.bottom);
167:                insets = new Insets(thickness3, thickness3, thickness3,
168:                        thickness3);
169:                panel.setBorder(new BevelBorder(BevelBorder.LOWERED));
170:                Insets newInsets = border.getBorderInsets(panel, insets);
171:                assertEquals("insets values coinside", thickness1,
172:                        newInsets.top);
173:                assertEquals("insets values coinside", thickness1,
174:                        newInsets.left);
175:                assertEquals("insets values coinside", thickness1,
176:                        newInsets.right);
177:                assertEquals("insets values coinside", thickness1,
178:                        newInsets.bottom);
179:                assertEquals("insets values coinside", thickness1, insets.top);
180:                assertEquals("insets values coinside", thickness1, insets.left);
181:                assertEquals("insets values coinside", thickness1, insets.right);
182:                assertEquals("insets values coinside", thickness1,
183:                        insets.bottom);
184:            }
185:
186:            /*
187:             * Class under test for Insets getBorderInsets(Component)
188:             */
189:            public void testGetBorderInsetsComponent() {
190:                int thickness1 = 2;
191:                int thickness2 = 22;
192:                int thickness3 = 33;
193:                BevelBorder border = new BevelBorder(BevelBorder.RAISED,
194:                        Color.black, Color.white);
195:                Insets insets = new Insets(1, 1, 1, 1);
196:                JPanel panel = new JPanel();
197:                insets = border.getBorderInsets(null);
198:                assertEquals("insets values coinside", thickness1, insets.top);
199:                assertEquals("insets values coinside", thickness1, insets.left);
200:                assertEquals("insets values coinside", thickness1, insets.right);
201:                assertEquals("insets values coinside", thickness1,
202:                        insets.bottom);
203:                panel.setBorder(new LineBorder(Color.black, thickness2));
204:                insets = border.getBorderInsets(panel);
205:                assertEquals("insets values coinside", thickness1, insets.top);
206:                assertEquals("insets values coinside", thickness1, insets.left);
207:                assertEquals("insets values coinside", thickness1, insets.right);
208:                assertEquals("insets values coinside", thickness1,
209:                        insets.bottom);
210:                insets = new Insets(thickness3, thickness3, thickness3,
211:                        thickness3);
212:                panel.setBorder(new BevelBorder(BevelBorder.LOWERED));
213:                insets = border.getBorderInsets(panel);
214:                assertEquals("insets values coinside", thickness1, insets.top);
215:                assertEquals("insets values coinside", thickness1, insets.left);
216:                assertEquals("insets values coinside", thickness1, insets.right);
217:                assertEquals("insets values coinside", thickness1,
218:                        insets.bottom);
219:            }
220:
221:            /**
222:             * This method is being tested by testPaintBorder()
223:             */
224:            public void testPaintRaisedBevel() {
225:            }
226:
227:            /**
228:             * This method is being tested by testPaintBorder()
229:             */
230:            public void testPaintLoweredBevel() {
231:            }
232:
233:            public void testPaintBorder() {
234:                //      JPanel panel1 = new JPanel();
235:                //      JPanel panel2 = new JPanel();
236:                //      JPanel panel3 = new JPanel();
237:                //
238:                //      Color shadowInnerColor = Color.GREEN;
239:                //      Color shadowOuterColor = Color.BLACK;
240:                //      Color highlightedInnerColor = Color.RED;
241:                //      Color highlightedOuterColor = Color.BLUE;
242:                //
243:                //      BevelBorder border1 = new BevelBorder(EtchedBorder.LOWERED, highlightedOuterColor, highlightedInnerColor,
244:                //                                                                  shadowOuterColor, shadowInnerColor);
245:                //      BevelBorder border2 = new BevelBorder(EtchedBorder.RAISED, highlightedOuterColor, highlightedInnerColor,
246:                //                                                                  shadowOuterColor, shadowInnerColor);
247:                //      panel2.setBorder(border1);
248:                //      panel3.setBorder(border2);
249:                //      panel2.setPreferredSize(new Dimension(200, 150));
250:                //      panel3.setPreferredSize(new Dimension(200, 150));
251:                //
252:                //      panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));
253:                //      panel1.add(panel2);
254:                //      panel1.add(panel3);
255:                //
256:                //      JFrame frame = new JFrame();
257:                //      frame.getContentPane().add(panel1);
258:                //      frame.pack();
259:                //      frame.show();
260:                //      while(!frame.isActive());
261:                //      while(frame.isActive());
262:            }
263:
264:            public void testIsBorderOpaque() {
265:                Color shadowColor = Color.GREEN;
266:                Color highlightedColor = Color.RED;
267:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
268:                        highlightedColor, shadowColor);
269:                assertTrue("BevelBorder is opaque", border.isBorderOpaque());
270:                border = new BevelBorder(BevelBorder.RAISED);
271:                assertTrue("BevelBorder is opaque", border.isBorderOpaque());
272:            }
273:
274:            /*
275:             * Class under test for Color getShadowOuterColor(Component)
276:             */
277:            public void testGetShadowOuterColorComponent() {
278:                JComponent c1 = new JPanel();
279:                JComponent c2 = new JPanel();
280:                c1.setBackground(new Color(110, 110, 110));
281:                c1.setForeground(new Color(210, 210, 210));
282:                c2.setBackground(new Color(10, 10, 10));
283:                c2.setForeground(new Color(110, 110, 110));
284:                Color shadowInnerColor = Color.GREEN;
285:                Color shadowOuterColor = Color.CYAN;
286:                Color highlightedInnerColor = Color.RED;
287:                Color highlightedOuterColor = Color.YELLOW;
288:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
289:                        highlightedOuterColor, highlightedInnerColor,
290:                        shadowOuterColor, shadowInnerColor);
291:                assertEquals("Shadow Outer color coinsides", shadowOuterColor,
292:                        border.getShadowOuterColor(c1));
293:                assertEquals("Shadow Outer color coinsides", shadowOuterColor,
294:                        border.getShadowOuterColor(c2));
295:                border = new BevelBorder(BevelBorder.RAISED);
296:                assertEquals("Shadow Outer color coinsides", new Color(53, 53,
297:                        53), border.getShadowOuterColor(c1));
298:                assertEquals("Shadow Outer color coinsides",
299:                        new Color(4, 4, 4), border.getShadowOuterColor(c2));
300:            }
301:
302:            /*
303:             * Class under test for Color getShadowInnerColor(Component)
304:             */
305:            public void testGetShadowInnerColorComponent() {
306:                JComponent c1 = new JPanel();
307:                JComponent c2 = new JPanel();
308:                c1.setBackground(new Color(110, 110, 110));
309:                c1.setForeground(new Color(210, 210, 210));
310:                c2.setBackground(new Color(10, 10, 10));
311:                c2.setForeground(new Color(110, 110, 110));
312:                Color shadowInnerColor = Color.GREEN;
313:                Color shadowOuterColor = Color.CYAN;
314:                Color highlightedInnerColor = Color.RED;
315:                Color highlightedOuterColor = Color.YELLOW;
316:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
317:                        highlightedOuterColor, highlightedInnerColor,
318:                        shadowOuterColor, shadowInnerColor);
319:                assertEquals("Shadow Inner color coinsides", shadowInnerColor,
320:                        border.getShadowInnerColor(c1));
321:                assertEquals("Shadow Inner color coinsides", shadowInnerColor,
322:                        border.getShadowInnerColor(c2));
323:                border = new BevelBorder(BevelBorder.RAISED);
324:                assertEquals("Shadow Inner color coinsides", new Color(77, 77,
325:                        77), border.getShadowInnerColor(c1));
326:                assertEquals("Shadow Inner color coinsides",
327:                        new Color(7, 7, 7), border.getShadowInnerColor(c2));
328:            }
329:
330:            /*
331:             * Class under test for Color getHighlightOuterColor(Component)
332:             */
333:            public void testGetHighlightOuterColorComponent() {
334:                JComponent c1 = new JPanel();
335:                JComponent c2 = new JPanel();
336:                c1.setBackground(new Color(110, 110, 110));
337:                c1.setForeground(new Color(210, 210, 210));
338:                c2.setBackground(new Color(10, 10, 10));
339:                c2.setForeground(new Color(110, 110, 110));
340:                Color shadowInnerColor = Color.GREEN;
341:                Color shadowOuterColor = Color.CYAN;
342:                Color highlightedInnerColor = Color.RED;
343:                Color highlightedOuterColor = Color.YELLOW;
344:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
345:                        highlightedOuterColor, highlightedInnerColor,
346:                        shadowOuterColor, shadowInnerColor);
347:                assertEquals("Highlight Outer color coinsides",
348:                        highlightedOuterColor, border
349:                                .getHighlightOuterColor(c1));
350:                assertEquals("Highlight Outer color coinsides",
351:                        highlightedOuterColor, border
352:                                .getHighlightOuterColor(c2));
353:                border = new BevelBorder(BevelBorder.RAISED);
354:                assertEquals("Highlight Outer color coinsides", new Color(224,
355:                        224, 224), border.getHighlightOuterColor(c1));
356:                assertEquals("Highlight Outer color coinsides", new Color(20,
357:                        20, 20), border.getHighlightOuterColor(c2));
358:            }
359:
360:            /*
361:             * Class under test for Color getHighlightInnerColor(Component)
362:             */
363:            public void testGetHighlightInnerColorComponent() {
364:                JComponent c1 = new JPanel();
365:                JComponent c2 = new JPanel();
366:                c1.setBackground(new Color(110, 110, 110));
367:                c1.setForeground(new Color(210, 210, 210));
368:                c2.setBackground(new Color(10, 10, 10));
369:                c2.setForeground(new Color(110, 110, 110));
370:                Color shadowInnerColor = Color.GREEN;
371:                Color shadowOuterColor = Color.CYAN;
372:                Color highlightedInnerColor = Color.RED;
373:                Color highlightedOuterColor = Color.YELLOW;
374:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
375:                        highlightedOuterColor, highlightedInnerColor,
376:                        shadowOuterColor, shadowInnerColor);
377:                assertEquals("Highlight Inner color coinsides",
378:                        highlightedInnerColor, border
379:                                .getHighlightInnerColor(c1));
380:                assertEquals("Highlight Inner color coinsides",
381:                        highlightedInnerColor, border
382:                                .getHighlightInnerColor(c2));
383:                border = new BevelBorder(BevelBorder.RAISED);
384:                assertEquals("Highlight Inner color coinsides", new Color(157,
385:                        157, 157), border.getHighlightInnerColor(c1));
386:                assertEquals("Highlight Inner color coinsides", new Color(14,
387:                        14, 14), border.getHighlightInnerColor(c2));
388:            }
389:
390:            /*
391:             * Class under test for Color getShadowOuterColor()
392:             */
393:            public void testGetShadowOuterColor() {
394:                Color shadowInnerColor = Color.YELLOW;
395:                Color shadowOuterColor = Color.CYAN;
396:                Color highlightedInnerColor = Color.RED;
397:                Color highlightedOuterColor = Color.GRAY;
398:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
399:                        highlightedOuterColor, highlightedInnerColor,
400:                        shadowOuterColor, shadowInnerColor);
401:                assertEquals("Shadow Outer color coinsides", shadowOuterColor,
402:                        border.getShadowOuterColor());
403:                shadowOuterColor = Color.GREEN;
404:                highlightedOuterColor = Color.WHITE;
405:                border = new BevelBorder(BevelBorder.RAISED,
406:                        highlightedOuterColor, highlightedInnerColor,
407:                        shadowOuterColor, shadowInnerColor);
408:                assertEquals("Shadow Outer color coinsides", shadowOuterColor,
409:                        border.getShadowOuterColor());
410:            }
411:
412:            /*
413:             * Class under test for Color getShadowInnerColor()
414:             */
415:            public void testGetShadowInnerColor() {
416:                Color shadowInnerColor = Color.YELLOW;
417:                Color shadowOuterColor = Color.CYAN;
418:                Color highlightedInnerColor = Color.RED;
419:                Color highlightedOuterColor = Color.GRAY;
420:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
421:                        highlightedOuterColor, highlightedInnerColor,
422:                        shadowOuterColor, shadowInnerColor);
423:                assertEquals("Shadow Inner color coinsides", shadowInnerColor,
424:                        border.getShadowInnerColor());
425:                shadowInnerColor = Color.GREEN;
426:                highlightedInnerColor = Color.WHITE;
427:                border = new BevelBorder(BevelBorder.RAISED,
428:                        highlightedOuterColor, highlightedInnerColor,
429:                        shadowOuterColor, shadowInnerColor);
430:                assertEquals("Shadow Inner color coinsides", shadowInnerColor,
431:                        border.getShadowInnerColor());
432:            }
433:
434:            /*
435:             * Class under test for Color getHighlightOuterColor()
436:             */
437:            public void testGetHighlightOuterColor() {
438:                Color shadowInnerColor = Color.YELLOW;
439:                Color shadowOuterColor = Color.CYAN;
440:                Color highlightedInnerColor = Color.RED;
441:                Color highlightedOuterColor = Color.GRAY;
442:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
443:                        highlightedOuterColor, highlightedInnerColor,
444:                        shadowOuterColor, shadowInnerColor);
445:                assertEquals("Highlighted Outer color coinsides",
446:                        highlightedOuterColor, border.getHighlightOuterColor());
447:                shadowOuterColor = Color.GREEN;
448:                highlightedOuterColor = Color.WHITE;
449:                border = new BevelBorder(BevelBorder.RAISED,
450:                        highlightedOuterColor, highlightedInnerColor,
451:                        shadowOuterColor, shadowInnerColor);
452:                assertEquals("Highlighted Outer color coinsides",
453:                        highlightedOuterColor, border.getHighlightOuterColor());
454:            }
455:
456:            /*
457:             * Class under test for Color getHighlightInnerColor()
458:             */
459:            public void testGetHighlightInnerColor() {
460:                Color shadowInnerColor = Color.YELLOW;
461:                Color shadowOuterColor = Color.CYAN;
462:                Color highlightedInnerColor = Color.RED;
463:                Color highlightedOuterColor = Color.GRAY;
464:                BevelBorder border = new BevelBorder(BevelBorder.LOWERED,
465:                        highlightedOuterColor, highlightedInnerColor,
466:                        shadowOuterColor, shadowInnerColor);
467:                assertEquals("Highlighted Inner color coinsides",
468:                        highlightedInnerColor, border.getHighlightInnerColor());
469:                shadowInnerColor = Color.GREEN;
470:                highlightedInnerColor = Color.WHITE;
471:                border = new BevelBorder(BevelBorder.LOWERED,
472:                        highlightedOuterColor, highlightedInnerColor,
473:                        shadowOuterColor, shadowInnerColor);
474:                assertEquals("Highlighted Inner color coinsides",
475:                        highlightedInnerColor, border.getHighlightInnerColor());
476:            }
477:
478:            public void testGetBevelType() {
479:                int bevelType = BevelBorder.LOWERED;
480:                BevelBorder border = new BevelBorder(bevelType);
481:                assertEquals("Bevel type coinsides", bevelType, border
482:                        .getBevelType());
483:                bevelType = BevelBorder.RAISED;
484:                border = new BevelBorder(bevelType);
485:                assertEquals("Etch type coinsides", bevelType, border
486:                        .getBevelType());
487:            }
488:
489:            public void testReadWriteObject() throws Exception {
490:                Color shadowInnerColor1 = Color.RED;
491:                Color shadowInnerColor2 = Color.BLUE;
492:                Color shadowOuterColor1 = Color.CYAN;
493:                Color shadowOuterColor2 = Color.MAGENTA;
494:                Color highlightedInnerColor1 = Color.YELLOW;
495:                Color highlightedInnerColor2 = Color.GREEN;
496:                Color highlightedOuterColor1 = Color.DARK_GRAY;
497:                Color highlightedOuterColor2 = Color.LIGHT_GRAY;
498:                int bevelType1 = BevelBorder.LOWERED;
499:                int bevelType2 = BevelBorder.RAISED;
500:                BevelBorder border1 = new BevelBorder(bevelType1,
501:                        highlightedOuterColor1, highlightedInnerColor1,
502:                        shadowOuterColor1, shadowInnerColor1);
503:                BevelBorder border2 = new BevelBorder(bevelType2,
504:                        highlightedOuterColor2, highlightedInnerColor2,
505:                        shadowOuterColor2, shadowInnerColor2);
506:                BevelBorder resurrectedBorder = (BevelBorder) serializeObject(border1);
507:                assertNotNull(resurrectedBorder);
508:                assertEquals("Deserialized values coinsides", resurrectedBorder
509:                        .getBevelType(), border1.getBevelType());
510:                assertEquals("Deserialized values coinsides", resurrectedBorder
511:                        .getShadowInnerColor(), border1.getShadowInnerColor());
512:                assertEquals("Deserialized values coinsides", resurrectedBorder
513:                        .getShadowOuterColor(), border1.getShadowOuterColor());
514:                assertEquals("Deserialized values coinsides", resurrectedBorder
515:                        .getHighlightInnerColor(), border1
516:                        .getHighlightInnerColor());
517:                assertEquals("Deserialized values coinsides", resurrectedBorder
518:                        .getHighlightOuterColor(), border1
519:                        .getHighlightOuterColor());
520:                resurrectedBorder = (BevelBorder) serializeObject(border2);
521:                assertNotNull(resurrectedBorder);
522:                assertEquals("Deserialized values coinsides", resurrectedBorder
523:                        .getBevelType(), border2.getBevelType());
524:                assertEquals("Deserialized values coinsides", resurrectedBorder
525:                        .getShadowInnerColor(), border2.getShadowInnerColor());
526:                assertEquals("Deserialized values coinsides", resurrectedBorder
527:                        .getShadowOuterColor(), border2.getShadowOuterColor());
528:                assertEquals("Deserialized values coinsides", resurrectedBorder
529:                        .getHighlightInnerColor(), border2
530:                        .getHighlightInnerColor());
531:                assertEquals("Deserialized values coinsides", resurrectedBorder
532:                        .getHighlightOuterColor(), border2
533:                        .getHighlightOuterColor());
534:            }
535:
536:            public void testBevelType() throws Exception {
537:                // Regression test for HARMONY-2590
538:                for (int i = -10; i < 10; i++) {
539:                    new BevelBorder(i);
540:                }
541:            }
542:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.