Source Code Cross Referenced for CompactHierarchyTest.java in  » Testing » abbot-1.0.1 » abbot » editor » 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 » Testing » abbot 1.0.1 » abbot.editor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package abbot.editor;
002:
003:        import java.awt.*;
004:        import javax.swing.*;
005:        import java.util.*;
006:
007:        import junit.extensions.abbot.*;
008:
009:        public class CompactHierarchyTest extends ComponentTestFixture {
010:
011:            private CompactHierarchy hierarchy;
012:
013:            protected void setUp() {
014:                hierarchy = new CompactHierarchy(getHierarchy());
015:            }
016:
017:            public void testElideScrollPaneChildren() {
018:                Object[][] data = { { "one", "two" }, { "three", "four" } };
019:                String[] columns = { "one", "two" };
020:                JTable table = new JTable(data, columns);
021:                JScrollPane sp = new JScrollPane(table);
022:                showFrame(sp);
023:                Collection kids = hierarchy.getComponents(sp);
024:                assertEquals("Scroll pane should show two children", 2, kids
025:                        .size());
026:                assertTrue("One child should be the table header", kids
027:                        .contains(table.getTableHeader()));
028:                assertTrue("One child should be the table", kids
029:                        .contains(table));
030:            }
031:
032:            public void testElidePopups() {
033:                JLabel label = new JLabel(getName());
034:                JFrame f = new JFrame(getName());
035:                f.getContentPane().add(label);
036:                showWindow(f, new Dimension(200, 200));
037:                JPopupMenu light = new JPopupMenu();
038:                light.add(new JMenuItem("item"));
039:                JPopupMenu heavy = new JPopupMenu();
040:                for (int i = 0; i < 10; i++) {
041:                    heavy.add(new JMenuItem("item " + i));
042:                }
043:
044:                showPopup(light, label);
045:                assertEquals("LW Popup parent should be its invoker", label,
046:                        hierarchy.getParent(light));
047:                Collection kids = hierarchy.getComponents(label);
048:                assertEquals("Label should have LW popup child: " + kids, 1,
049:                        kids.size());
050:                assertEquals("Label child should be the LW popup", light, kids
051:                        .iterator().next());
052:                // Normally, a heavyweight popup will be a child of the frame's
053:                // layered pane.  Make sure it's not represented that way
054:                kids = hierarchy.getComponents(f.getLayeredPane());
055:                assertEquals("Frame should have a single child: " + kids, f
056:                        .getContentPane(), kids.iterator().next());
057:
058:                showPopup(heavy, label);
059:                assertEquals("HW Popup parent should be its invoker", label,
060:                        hierarchy.getParent(heavy));
061:                kids = hierarchy.getComponents(label);
062:                assertEquals("Label should have HW popup child: " + kids, 1,
063:                        kids.size());
064:                assertEquals("Label child should be the HW popup", heavy, kids
065:                        .iterator().next());
066:                // Normally, a heavyweight popup will be a sub-window of the frame
067:                // Make sure it's not represented that way
068:                kids = hierarchy.getComponents(f);
069:                assertEquals("Frame should have a single child: " + kids, f
070:                        .getContentPane(), kids.iterator().next());
071:            }
072:
073:            public void testElideMenuContents() {
074:                JMenuBar mb = new JMenuBar();
075:                JMenu menu = new JMenu("file");
076:                JMenuItem item = new JMenuItem("open");
077:                menu.add(item);
078:                mb.add(menu);
079:                JFrame f = new JFrame(getName());
080:                f.setJMenuBar(mb);
081:                showWindow(f);
082:
083:                Collection kids = hierarchy.getComponents(menu);
084:                assertEquals("Menu should have one child: " + kids, 1, kids
085:                        .size());
086:                assertEquals("Menu child should be menu item", item, kids
087:                        .iterator().next());
088:            }
089:
090:            public void testElideRootPaneContainer() {
091:                JFrame f = (JFrame) showFrame(new JLabel(getName()));
092:
093:                Collection kids = hierarchy.getComponents(f);
094:                assertEquals("Frame should have a single child: " + kids, 1,
095:                        kids.size());
096:                assertEquals("Content pane should appear as child of frame", f
097:                        .getContentPane(), kids.iterator().next());
098:            }
099:
100:            public CompactHierarchyTest(String name) {
101:                super (name);
102:            }
103:
104:            public static void main(String[] args) {
105:                TestHelper.runTests(args, CompactHierarchyTest.class);
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.