/** @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { // Only dispose if the dialog hasn't already been dismissed by the // test case. if (JDialogOperator.findJDialog("Select font", true, false) != null) { JDialogOperator dialog = new JDialogOperator("Select font"); JDialog dialogSource = (JDialog) dialog.getSource(); dialogSource.setVisible(false); dialogSource.dispose(); } // new QueueTool().waitEmpty(10000); // dialog.waitClosed(); // QueueTool.uninstallQueue(); super.tearDown(); }
/** @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); // JemmyProperties.setCurrentDispatchingModel( // JemmyProperties.ROBOT_MODEL_MASK); JemmyProperties.setCurrentOutput(TestOut.getNullOutput()); final JFontChooserDialog fsd = new JFontChooserDialog(new JFrame(), "Select font", false); fsd.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); fsd.addFontDialogListener( new IFontChooserDialogListener() { public void okButtonPressed(JFontChooser fontPanel) { logger_.debug("OK button pressed"); fsd.dispose(); } public void cancelButtonPressed(JFontChooser fontPanel) { logger_.debug("Cancel button pressed"); fsd.dispose(); } public void applyButtonPressed(JFontChooser fontPanel) { logger_.debug("Apply button pressed"); } }); SwingUtil.centerWindow(fsd); fsd.setVisible(true); dialog_ = new JDialogOperator("Select font"); applyButton_ = JemmyUtil.findButton(dialog_, JFontChooserDialog.NAME_APPLY_BUTTON); cancelButton_ = JemmyUtil.findButton(dialog_, JFontChooserDialog.NAME_CANCEL_BUTTON); okButton_ = JemmyUtil.findButton(dialog_, JFontChooserDialog.NAME_OK_BUTTON); fontList_ = new JListOperator(dialog_, new NameComponentChooser(JFontChooser.NAME_FONT_LIST)); styleList_ = new JListOperator(dialog_, new NameComponentChooser(JFontChooser.NAME_STYLE_LIST)); sizeList_ = new JListOperator(dialog_, new NameComponentChooser(JFontChooser.NAME_SIZE_LIST)); }