diff options
author | Paul Pazderski | 2020-01-23 20:58:50 +0000 |
---|---|---|
committer | Paul Pazderski | 2020-01-24 14:42:36 +0000 |
commit | 49eb87afcc945d45f52d003981dab20e71e3af82 (patch) | |
tree | 323f59e1f187cca5e074da8944775bce1252bfff | |
parent | b966f80120da724d83d5b473b1032d5bca3443d0 (diff) | |
download | eclipse.platform.ui-49eb87afcc945d45f52d003981dab20e71e3af82.tar.gz eclipse.platform.ui-49eb87afcc945d45f52d003981dab20e71e3af82.tar.xz eclipse.platform.ui-49eb87afcc945d45f52d003981dab20e71e3af82.zip |
Bug 559476 - [Tests] Some tests leak modal shellsI20200124-1800
ResourceSelectionFilteringDialogTest.testMatch and
WizardsStatusHandlingTestCase.testWizardWithNoDefaultContructor open but
do not close a modal dialog. As consequence TextHandlerTests fail on
Windows and Mac because they cannot set focus on there widgets.
(tests succeed on Linux due to an uncommon (maybe wrong) focus handling)
Change-Id: I97e114ceca953fbf6b614e7c4fa3932d526172b9
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
2 files changed, 39 insertions, 32 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceSelectionFilteringDialogTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceSelectionFilteringDialogTest.java index c6d1e549577..5b1f2b3387c 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceSelectionFilteringDialogTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceSelectionFilteringDialogTest.java @@ -64,12 +64,16 @@ public class ResourceSelectionFilteringDialogTest extends UITestCase { IFile file = project.getFile("a/b/c/f"); file.create(new ByteArrayInputStream(new byte[0]), true, null); SeeThroughFilteredResourcesSelectionDialog dialog = createDialog(); - dialog.setInitialPattern("c/f"); - dialog.open(); - dialog.refresh(); - Assert.assertTrue(DisplayHelper.waitForCondition(dialog.getShell().getDisplay(), 3000, () -> - file.equals(dialog.getSelectedItems().getFirstElement()) - )); + try { + dialog.setInitialPattern("c/f"); + dialog.open(); + dialog.refresh(); + Assert.assertTrue(DisplayHelper.waitForCondition(dialog.getShell().getDisplay(), 3000, + () -> file.equals(dialog.getSelectedItems().getFirstElement()) + )); + } finally { + dialog.close(); + } } @Override diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WizardsStatusHandlingTestCase.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WizardsStatusHandlingTestCase.java index 5d6b711ed53..197718edc90 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WizardsStatusHandlingTestCase.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WizardsStatusHandlingTestCase.java @@ -105,36 +105,39 @@ public class WizardsStatusHandlingTestCase { UITestCase.processEvents(); final CustomWizardDialog dialog = exportWizard(); - dialog.setBlockOnOpen(false); - dialog.open(); - - UITestCase.processEvents(); - - // selecting FaultyExportWizard - IWizardPage currenPage = dialog.getCurrentPage(); - Composite control = (Composite) currenPage.getControl(); - Control[] widgets = control.getChildren(); - - Table table = (Table) widgets[1]; - - for (int i = 0; i < table.getItemCount(); i++) { - if (table.getItem(i).getText().equals(FAULTY_WIZARD_NAME)) { - table.select(i); - table.notifyListeners(SWT.Selection, new Event()); - UITestCase.processEvents(); - break; + try { + dialog.setBlockOnOpen(false); + dialog.open(); + + UITestCase.processEvents(); + + // selecting FaultyExportWizard + IWizardPage currenPage = dialog.getCurrentPage(); + Composite control = (Composite) currenPage.getControl(); + Control[] widgets = control.getChildren(); + + Table table = (Table) widgets[1]; + + for (int i = 0; i < table.getItemCount(); i++) { + if (table.getItem(i).getText().equals(FAULTY_WIZARD_NAME)) { + table.select(i); + table.notifyListeners(SWT.Selection, new Event()); + UITestCase.processEvents(); + break; + } } - } - // pressing "Next" - TestStatusHandler.install(); + // pressing "Next" + TestStatusHandler.install(); - dialog.nextPressed2(); + dialog.nextPressed2(); - UITestCase.processEvents(); - assertStatusAdapter(TestStatusHandler.getLastHandledStatusAdapter()); - assertEquals(TestStatusHandler.getLastHandledStyle(), - StatusManager.SHOW); + UITestCase.processEvents(); + assertStatusAdapter(TestStatusHandler.getLastHandledStatusAdapter()); + assertEquals(TestStatusHandler.getLastHandledStyle(), StatusManager.SHOW); + } finally { + dialog.close(); + } } /** |