Source Code Cross Referenced for JTabbedPaneOperatorTest.java in  » IDE-Netbeans » jemmy » org » netbeans » jemmy » operators » 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 » IDE Netbeans » jemmy » org.netbeans.jemmy.operators 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id$
003:         *
004:         * ---------------------------------------------------------------------------
005:         *
006:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
007:         *
008:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
009:         *
010:         * The contents of this file are subject to the terms of either the GNU
011:         * General Public License Version 2 only ("GPL") or the Common
012:         * Development and Distribution License("CDDL") (collectively, the
013:         * "License"). You may not use this file except in compliance with the
014:         * License. You can obtain a copy of the License at
015:         * http://www.netbeans.org/cddl-gplv2.html
016:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
017:         * specific language governing permissions and limitations under the
018:         * License.  When distributing the software, include this License Header
019:         * Notice in each file and include the License file at
020:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
021:         * particular file as subject to the "Classpath" exception as provided
022:         * by Sun in the GPL Version 2 section of the License file that
023:         * accompanied this code. If applicable, add the following below the
024:         * License Header, with the fields enclosed by brackets [] replaced by
025:         * your own identifying information:
026:         * "Portions Copyrighted [year] [name of copyright owner]"
027:         *
028:         * Contributor(s): Manfred Riem (mriem@netbeans.org).
029:         *
030:         * The Original Software is the Jemmy library. The Initial Developer of the
031:         * Original Software is Alexandre Iline. All Rights Reserved.
032:         *
033:         * If you wish your version of this file to be governed by only the CDDL
034:         * or only the GPL Version 2, indicate your decision by adding
035:         * "[Contributor] elects to include this software in this distribution
036:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
037:         * single choice of license, a recipient has the option to distribute
038:         * your version of this file under either the CDDL, the GPL Version 2 or
039:         * to extend the choice of license to its licensees as provided above.
040:         * However, if you add GPL Version 2 code and therefore, elected the GPL
041:         * Version 2 license, then the option applies only if the new code is
042:         * made subject to such option by the copyright holder.
043:         *
044:         * ---------------------------------------------------------------------------
045:         *
046:         */
047:        package org.netbeans.jemmy.operators;
048:
049:        import java.awt.Color;
050:        import java.awt.Component;
051:        import java.awt.Graphics;
052:        import javax.swing.DefaultSingleSelectionModel;
053:        import javax.swing.Icon;
054:        import javax.swing.ImageIcon;
055:        import javax.swing.JFrame;
056:        import javax.swing.JPanel;
057:        import javax.swing.JTabbedPane;
058:        import javax.swing.event.ChangeEvent;
059:        import javax.swing.event.ChangeListener;
060:        import junit.framework.Test;
061:        import junit.framework.TestCase;
062:        import junit.framework.TestSuite;
063:        import org.netbeans.jemmy.util.NameComponentChooser;
064:
065:        /**
066:         * A JUnit test for JTabbedPaneOperator.
067:         *
068:         * @author Manfred Riem (mriem@netbeans.org)
069:         * @version $Revision$
070:         */
071:        public class JTabbedPaneOperatorTest extends TestCase {
072:            /**
073:             * Stores the frame.
074:             */
075:            private JFrame frame;
076:
077:            /**
078:             * Stores the tabbed pane.
079:             */
080:            private JTabbedPane tabbedPane;
081:
082:            /**
083:             * Constructor.
084:             *
085:             * @param testName the name of the test.
086:             */
087:            public JTabbedPaneOperatorTest(String testName) {
088:                super (testName);
089:            }
090:
091:            /**
092:             * Setup before testing.
093:             */
094:            protected void setUp() throws Exception {
095:                frame = new JFrame();
096:                tabbedPane = new JTabbedPane();
097:                tabbedPane.setName("JTabbedPaneOperatorTest");
098:                tabbedPane.setToolTipText("JTabbedPaneOperatorTest");
099:
100:                JPanel panel1 = new JPanel();
101:                panel1.setName("Tab1");
102:
103:                JPanel panel2 = new JPanel();
104:                panel2.setName("Tab2");
105:
106:                tabbedPane.add(panel1);
107:                tabbedPane.add(panel2);
108:
109:                frame.getContentPane().add(tabbedPane);
110:                frame.setSize(400, 300);
111:                frame.setLocationRelativeTo(null);
112:            }
113:
114:            /**
115:             * Cleanup after testing.
116:             */
117:            protected void tearDown() throws Exception {
118:                frame.setVisible(false);
119:                frame.dispose();
120:                frame = null;
121:            }
122:
123:            /**
124:             * Suite method.
125:             */
126:            public static Test suite() {
127:                TestSuite suite = new TestSuite(JTabbedPaneOperatorTest.class);
128:
129:                return suite;
130:            }
131:
132:            /**
133:             * Test constructor.
134:             */
135:            public void testConstructor() {
136:                frame.setVisible(true);
137:
138:                JFrameOperator operator = new JFrameOperator();
139:                assertNotNull(operator);
140:
141:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
142:                        operator);
143:                assertNotNull(operator1);
144:
145:                JTabbedPaneOperator operator2 = new JTabbedPaneOperator(
146:                        operator, "Tab1");
147:                assertNotNull(operator2);
148:
149:                JTabbedPaneOperator operator3 = new JTabbedPaneOperator(
150:                        operator, new NameComponentChooser(
151:                                "JTabbedPaneOperatorTest"));
152:                assertNotNull(operator3);
153:            }
154:
155:            /**
156:             * Test findJTabbedPane method.
157:             */
158:            public void testFindJTabbedPane() {
159:                frame.setVisible(true);
160:
161:                JTabbedPane tabbedPane1 = JTabbedPaneOperator.findJTabbedPane(
162:                        frame, new NameComponentChooser(
163:                                "JTabbedPaneOperatorTest"));
164:                assertNotNull(tabbedPane1);
165:
166:                JTabbedPane tabbedPane2 = JTabbedPaneOperator.findJTabbedPane(
167:                        frame, "Tab1", false, false, 0);
168:                assertNotNull(tabbedPane2);
169:            }
170:
171:            /**
172:             * Test findJTabbedPaneUnder method.
173:             */
174:            public void testFindJTabbedPaneUnder() {
175:                frame.setVisible(true);
176:
177:                JTabbedPane tabbedPane1 = JTabbedPaneOperator
178:                        .findJTabbedPaneUnder(new JPanel());
179:                assertNull(tabbedPane1);
180:
181:                JTabbedPane tabbedPane2 = JTabbedPaneOperator
182:                        .findJTabbedPaneUnder(new JPanel(),
183:                                new NameComponentChooser("Test"));
184:                assertNull(tabbedPane2);
185:            }
186:
187:            /**
188:             * Test waitJTabbedPane method.
189:             */
190:            public void testWaitJTabbedPane() {
191:                frame.setVisible(true);
192:
193:                JTabbedPane tabbedPane1 = JTabbedPaneOperator.waitJTabbedPane(
194:                        frame, new NameComponentChooser(
195:                                "JTabbedPaneOperatorTest"));
196:                assertNotNull(tabbedPane1);
197:
198:                JTabbedPane tabbedPane2 = JTabbedPaneOperator.waitJTabbedPane(
199:                        frame, "Tab1", false, false, 0);
200:                assertNotNull(tabbedPane2);
201:            }
202:
203:            /**
204:             * Test findPage method.
205:             */
206:            public void testFindPage() {
207:                frame.setVisible(true);
208:
209:                JFrameOperator operator = new JFrameOperator();
210:                assertNotNull(operator);
211:
212:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
213:                        operator);
214:                assertNotNull(operator1);
215:
216:                operator1.findPage("Tab1");
217:                operator1.findPage("Tab1", false, false);
218:            }
219:
220:            /**
221:             * Test selectPage method.
222:             */
223:            public void testSelectPage() {
224:                frame.setVisible(true);
225:
226:                JFrameOperator operator = new JFrameOperator();
227:                assertNotNull(operator);
228:
229:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
230:                        operator);
231:                assertNotNull(operator1);
232:
233:                operator1.selectPage("Tab1");
234:                operator1.selectPage("Tab1", false, false);
235:            }
236:
237:            /**
238:             * Test waitPage method.
239:             */
240:            public void testWaitPage() {
241:                frame.setVisible(true);
242:
243:                JFrameOperator operator = new JFrameOperator();
244:                assertNotNull(operator);
245:
246:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
247:                        operator);
248:                assertNotNull(operator1);
249:
250:                operator1.waitPage("Tab1");
251:            }
252:
253:            /**
254:             * Test waitSelected method.
255:             */
256:            public void testWaitSelected() {
257:                frame.setVisible(true);
258:
259:                JFrameOperator operator = new JFrameOperator();
260:                assertNotNull(operator);
261:
262:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
263:                        operator);
264:                assertNotNull(operator1);
265:
266:                operator1.selectPage("Tab1");
267:                operator1.waitSelected("Tab1");
268:            }
269:
270:            /**
271:             * Test getDump method.
272:             */
273:            public void testGetDump() {
274:                frame.setVisible(true);
275:
276:                JFrameOperator operator = new JFrameOperator();
277:                assertNotNull(operator);
278:
279:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
280:                        operator);
281:                assertNotNull(operator1);
282:
283:                operator1.getDump();
284:            }
285:
286:            /**
287:             * Test addChangeListener method.
288:             */
289:            public void testAddChangeListener() {
290:                frame.setVisible(true);
291:
292:                JFrameOperator operator = new JFrameOperator();
293:                assertNotNull(operator);
294:
295:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
296:                        operator);
297:                assertNotNull(operator1);
298:
299:                ChangeListenerTest listener = new ChangeListenerTest();
300:                operator1.addChangeListener(listener);
301:                operator1.removeChangeListener(listener);
302:            }
303:
304:            /**
305:             * Inner class used for testing.
306:             */
307:            public class ChangeListenerTest implements  ChangeListener {
308:                public void stateChanged(ChangeEvent e) {
309:                }
310:            }
311:
312:            /**
313:             * Test addTab method.
314:             */
315:            public void testAddTab() {
316:                frame.setVisible(true);
317:
318:                JFrameOperator operator = new JFrameOperator();
319:                assertNotNull(operator);
320:
321:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
322:                        operator);
323:                assertNotNull(operator1);
324:
325:                operator1.addTab("Test", new JPanel());
326:                operator1.addTab("Tab1", new IconTest(), new JPanel());
327:                operator1.addTab("Tab1", new IconTest(), new JPanel(), "Tab1");
328:            }
329:
330:            /**
331:             * Inner class for testing.
332:             */
333:            public class IconTest implements  Icon {
334:                public void paintIcon(Component c, Graphics g, int x, int y) {
335:                }
336:
337:                public int getIconWidth() {
338:                    return 0;
339:                }
340:
341:                public int getIconHeight() {
342:                    return 0;
343:                }
344:            }
345:
346:            /**
347:             * Test getBackgroundAt method.
348:             */
349:            public void testGetBackgroundAt() {
350:                frame.setVisible(true);
351:
352:                JFrameOperator operator = new JFrameOperator();
353:                assertNotNull(operator);
354:
355:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
356:                        operator);
357:                assertNotNull(operator1);
358:
359:                operator1.setBackgroundAt(0, Color.black);
360:                operator1.getBackgroundAt(0);
361:            }
362:
363:            /**
364:             * Test getBoundsAt method.
365:             */
366:            public void testGetBoundsAt() {
367:                frame.setVisible(true);
368:
369:                JFrameOperator operator = new JFrameOperator();
370:                assertNotNull(operator);
371:
372:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
373:                        operator);
374:                assertNotNull(operator1);
375:
376:                operator1.getBoundsAt(0);
377:            }
378:
379:            /**
380:             * Test getComponentAt method.
381:             */
382:            public void testGetComponentAt() {
383:                frame.setVisible(true);
384:
385:                JFrameOperator operator = new JFrameOperator();
386:                assertNotNull(operator);
387:
388:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
389:                        operator);
390:                assertNotNull(operator1);
391:
392:                operator1.setComponentAt(0, new JPanel());
393:                operator1.getComponentAt(0);
394:            }
395:
396:            /**
397:             * Test getDisabledIconAt method.
398:             */
399:            public void testGetDisabledIconAt() {
400:                frame.setVisible(true);
401:
402:                JFrameOperator operator = new JFrameOperator();
403:                assertNotNull(operator);
404:
405:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
406:                        operator);
407:                assertNotNull(operator1);
408:
409:                operator1.setDisabledIconAt(0, new ImageIcon());
410:                operator1.getDisabledIconAt(0);
411:            }
412:
413:            /**
414:             * Test getForegroundAt method.
415:             */
416:            public void testGetForegroundAt() {
417:                frame.setVisible(true);
418:
419:                JFrameOperator operator = new JFrameOperator();
420:                assertNotNull(operator);
421:
422:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
423:                        operator);
424:                assertNotNull(operator1);
425:
426:                operator1.setForegroundAt(0, Color.white);
427:                operator1.getForegroundAt(0);
428:            }
429:
430:            /**
431:             * Test getIconAt method.
432:             */
433:            public void testGetIconAt() {
434:                frame.setVisible(true);
435:
436:                JFrameOperator operator = new JFrameOperator();
437:                assertNotNull(operator);
438:
439:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
440:                        operator);
441:                assertNotNull(operator1);
442:
443:                operator1.setIconAt(0, new ImageIcon());
444:                operator1.getIconAt(0);
445:            }
446:
447:            /**
448:             * Test getModel method.
449:             */
450:            public void testGetModel() {
451:                frame.setVisible(true);
452:
453:                JFrameOperator operator = new JFrameOperator();
454:                assertNotNull(operator);
455:
456:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
457:                        operator);
458:                assertNotNull(operator1);
459:
460:                operator1.setModel(new DefaultSingleSelectionModel());
461:                operator1.getModel();
462:            }
463:
464:            /**
465:             * Test getSelectedComponent method.
466:             */
467:            public void testGetSelectedComponent() {
468:                frame.setVisible(true);
469:
470:                JFrameOperator operator = new JFrameOperator();
471:                assertNotNull(operator);
472:
473:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
474:                        operator);
475:                assertNotNull(operator1);
476:
477:                operator1
478:                        .setSelectedComponent(operator1.getSelectedComponent());
479:            }
480:
481:            /**
482:             * Test getSelectedIndex method.
483:             */
484:            public void testGetSelectedIndex() {
485:                frame.setVisible(true);
486:
487:                JFrameOperator operator = new JFrameOperator();
488:                assertNotNull(operator);
489:
490:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
491:                        operator);
492:                assertNotNull(operator1);
493:
494:                operator1.setSelectedIndex(0);
495:                operator1.getSelectedIndex();
496:            }
497:
498:            /**
499:             * Test getTabCount method.
500:             */
501:            public void testGetTabCount() {
502:                frame.setVisible(true);
503:
504:                JFrameOperator operator = new JFrameOperator();
505:                assertNotNull(operator);
506:
507:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
508:                        operator);
509:                assertNotNull(operator1);
510:
511:                operator1.getTabCount();
512:            }
513:
514:            /**
515:             * Test getTabPlacement method.
516:             */
517:            public void testGetTabPlacement() {
518:                frame.setVisible(true);
519:
520:                JFrameOperator operator = new JFrameOperator();
521:                assertNotNull(operator);
522:
523:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
524:                        operator);
525:                assertNotNull(operator1);
526:
527:                operator1.setTabPlacement(operator1.getTabPlacement());
528:            }
529:
530:            /**
531:             * Test getTabRunCount method.
532:             */
533:            public void testGetTabRunCount() {
534:                frame.setVisible(true);
535:
536:                JFrameOperator operator = new JFrameOperator();
537:                assertNotNull(operator);
538:
539:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
540:                        operator);
541:                assertNotNull(operator1);
542:
543:                operator1.getTabRunCount();
544:            }
545:
546:            /**
547:             * Test getTitleAt method.
548:             */
549:            public void testGetTitleAt() {
550:                frame.setVisible(true);
551:
552:                JFrameOperator operator = new JFrameOperator();
553:                assertNotNull(operator);
554:
555:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
556:                        operator);
557:                assertNotNull(operator1);
558:
559:                operator1.setTitleAt(0, "Title");
560:                operator1.getTitleAt(0);
561:            }
562:
563:            /**
564:             * Test getUI method.
565:             */
566:            public void testGetUI() {
567:                frame.setVisible(true);
568:
569:                JFrameOperator operator = new JFrameOperator();
570:                assertNotNull(operator);
571:
572:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
573:                        operator);
574:                assertNotNull(operator1);
575:
576:                operator1.setUI(operator1.getUI());
577:            }
578:
579:            /**
580:             * Test indexOfComponent method.
581:             */
582:            public void testIndexOfComponent() {
583:                frame.setVisible(true);
584:
585:                JFrameOperator operator = new JFrameOperator();
586:                assertNotNull(operator);
587:
588:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
589:                        operator);
590:                assertNotNull(operator1);
591:
592:                operator1.indexOfComponent(new JPanel());
593:            }
594:
595:            /**
596:             * Test indexOfTab method.
597:             */
598:            public void testIndexOfTab() {
599:                frame.setVisible(true);
600:
601:                JFrameOperator operator = new JFrameOperator();
602:                assertNotNull(operator);
603:
604:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
605:                        operator);
606:                assertNotNull(operator1);
607:
608:                operator1.indexOfTab("Tab1");
609:                operator1.indexOfTab(new ImageIcon());
610:            }
611:
612:            /**
613:             * Test insertTab method.
614:             */
615:            public void testInsertTab() {
616:                frame.setVisible(true);
617:
618:                JFrameOperator operator = new JFrameOperator();
619:                assertNotNull(operator);
620:
621:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
622:                        operator);
623:                assertNotNull(operator1);
624:
625:                operator1.insertTab("Insert", null, new JPanel(), "Insert", 0);
626:            }
627:
628:            /**
629:             * Test isEnabledAt method.
630:             */
631:            public void testIsEnabledAt() {
632:                frame.setVisible(true);
633:
634:                JFrameOperator operator = new JFrameOperator();
635:                assertNotNull(operator);
636:
637:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
638:                        operator);
639:                assertNotNull(operator1);
640:
641:                operator1.isEnabledAt(0);
642:            }
643:
644:            /**
645:             * Test removeTabAt method.
646:             */
647:            public void testRemoveTabAt() {
648:                frame.setVisible(true);
649:
650:                JFrameOperator operator = new JFrameOperator();
651:                assertNotNull(operator);
652:
653:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
654:                        operator);
655:                assertNotNull(operator1);
656:
657:                operator1.removeTabAt(0);
658:            }
659:
660:            /**
661:             * Test setEnabledAt method.
662:             */
663:            public void testSetEnabledAt() {
664:                frame.setVisible(true);
665:
666:                JFrameOperator operator = new JFrameOperator();
667:                assertNotNull(operator);
668:
669:                JTabbedPaneOperator operator1 = new JTabbedPaneOperator(
670:                        operator);
671:                assertNotNull(operator1);
672:
673:                operator1.setEnabledAt(0, true);
674:            }
675:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.