@After public void tearDown() { Shell activeShell = new DefaultShell(); if (new DefaultShell().getText().equals(TestingWizard.TITLE)) { activeShell.close(); } }
@Test public void cancel() { wizardDialog.cancel(); Shell shell = new DefaultShell(); assertTrue(shell.getText().equals(new WorkbenchShell().getText())); }
@Test public void finish() { assertTrue("Finish button should be enabled", wizardDialog.isFinishEnabled()); wizardDialog.finish(); Shell shell = new DefaultShell(); assertTrue(shell.getText().equals(new WorkbenchShell().getText())); }
@Test public void preferencesMenuTest() { log.info("Preferences menu test"); new DefaultShell(); Menu m = new ShellMenu("Window", "Preferences"); m.select(); Shell s = new DefaultShell("Preferences"); s.close(); }
@Test public void menuWithMnemonicTest() { log.info("menu with mnemonic test"); new DefaultShell(); Menu m = new ShellMenu("File", "New", "Other..."); m.select(); Shell s = new DefaultShell("New"); s.close(); }
@Test public void contextMenuTest() { ProjectExplorer pe = new ProjectExplorer(); pe.open(); Menu menu = new ContextMenu("New", "Project..."); menu.select(); Shell s = new DefaultShell("New Project"); s.close(); }
@Test public void aboutMenuTest() { log.info("About menu test"); new DefaultShell(); @SuppressWarnings("unchecked") Menu m = new ShellMenu( new WithMnemonicTextMatcher("Help"), new WithTextMatcher(new RegexMatcher("About.*"))); m.select(); Shell s = new DefaultShell(); s.close(); }
@Override public boolean test() { if (shell == null) { return ShellLookup.getInstance().getCurrentActiveShell() != null; } else { org.eclipse.swt.widgets.Shell currentActiveShell = ShellLookup.getInstance().getCurrentActiveShell(); if (currentActiveShell == null) { log.debug("Current active shell is null"); return false; } return currentActiveShell.equals(shell.getSWTWidget()); } }
@Override public boolean test() { int childShells = 0; org.eclipse.swt.widgets.Shell swtShell = shell.getSWTWidget(); ShellHandler handler = ShellHandler.getInstance(); try { childShells = handler.getShells(swtShell).length; } catch (CoreLayerException e) { if (swtShell != null) { return handler.isDisposed(swtShell); } return true; } log.debug("number of child shells: " + childShells); return childShells > 0; }