1 19 20 package org.netbeans.core.windows; 21 22 import junit.framework.*; 23 import org.netbeans.junit.*; 24 25 import org.openide.windows.*; 26 27 28 34 public class DockingCompatibilityTest extends NbTestCase { 35 36 37 public DockingCompatibilityTest (String name) { 38 super (name); 39 } 40 41 44 public static void main(java.lang.String [] args) { 45 junit.textui.TestRunner.run(suite()); 46 } 47 48 public static Test suite() { 49 TestSuite suite = new NbTestSuite(DockingCompatibilityTest.class); 50 51 return suite; 52 } 53 54 protected boolean runInEQ () { 55 return true; 56 } 57 58 59 public void testSimplyOpenedComponentCanBeDockedWhereeverItWants () throws Exception { 60 TopComponent tc = new TopComponent (); 61 tc.open (); 62 63 assertCanBeDocked (tc, Boolean.TRUE); 64 } 65 66 public void testComponentPutIntoOwnModeCanBeDockedAsWell () { 67 Mode mode = WindowManager.getDefault ().getCurrentWorkspace ().createMode ("OwnMode", "displayName", null); 68 TopComponent tc = new TopComponent (); 69 mode.dockInto (tc); 70 tc.open (); 71 72 assertCanBeDocked (tc, Boolean.TRUE); 73 } 74 75 public void testComponentPlacedDirectlyIntoEditorModeHasToStayThere () { 76 Mode mode = WindowManager.getDefault ().findMode ("editor"); 77 assertNotNull ("Shall not be null", mode); 78 TopComponent tc = new TopComponent (); 79 mode.dockInto (tc); 80 assertCanBeDocked (tc, null); 81 } 82 83 84 private static void assertCanBeDocked (TopComponent tc, Boolean expectedValue) { 85 assertEquals ( 86 expectedValue, 87 tc.getClientProperty (Constants.TOPCOMPONENT_ALLOW_DOCK_ANYWHERE) 88 ); 89 } 90 } 91 92 | Popular Tags |