1 29 30 package nextapp.echo2.app.test; 31 32 import nextapp.echo2.app.ApplicationInstance; 33 import nextapp.echo2.app.WindowPane; 34 import junit.framework.TestCase; 35 36 40 public class ModalTest extends TestCase { 41 42 private ColumnApp app; 43 44 47 public void setUp() { 48 app = new ColumnApp(); 49 ApplicationInstance.setActive(app); 50 app.doInit(); 51 } 52 53 56 public void tearDown() { 57 ApplicationInstance.setActive(null); 58 app = null; 59 } 60 61 64 public void testBasicModal() { 65 WindowPane windowPane = new WindowPane(); 66 windowPane.setModal(true); 67 68 assertNull(app.getModalContextRoot()); 69 70 app.getDefaultWindow().getContent().add(windowPane); 71 assertEquals(windowPane, app.getModalContextRoot()); 72 73 app.getDefaultWindow().getContent().remove(windowPane); 74 assertNull(app.getModalContextRoot()); 75 76 windowPane.setModal(false); 77 app.getDefaultWindow().getContent().add(windowPane); 78 assertNull(app.getModalContextRoot()); 79 80 windowPane.setModal(true); 81 assertEquals(windowPane, app.getModalContextRoot()); 82 83 windowPane.setModal(false); 84 assertNull(app.getModalContextRoot()); 85 } 86 87 90 public void testInvisibleModal() { 91 WindowPane windowPane = new WindowPane(); 92 windowPane.setModal(true); 93 app.getDefaultWindow().getContent().add(windowPane); 94 assertEquals(windowPane, app.getModalContextRoot()); 95 96 windowPane.setVisible(false); 97 assertEquals(null, app.getModalContextRoot()); 98 99 windowPane.setVisible(true); 100 assertEquals(windowPane, app.getModalContextRoot()); 101 102 app.getDefaultWindow().getContent().remove(windowPane); 103 windowPane.setVisible(false); 104 app.getDefaultWindow().getContent().add(windowPane); 105 assertEquals(null, app.getModalContextRoot()); 106 } 107 } 108 | Popular Tags |