Fixed tests failing due to focus timing issues by allowing the test

framework to specify the source of key bindings
This commit is contained in:
dragonmacher 2020-03-13 16:50:54 -04:00
parent 3418492a8c
commit 3f62f91a2e
5 changed files with 71 additions and 10 deletions

View file

@ -337,7 +337,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
// Note: there may be a test focus issue here. If this test fails sporadically due to
// how the action context is generated (it depends on focus). It is only useful to fail
// here in development mode.
triggerKey(tool.getToolFrame(), controlEsc);
triggerKey(provider.getComponent(), controlEsc);
assertProviderIsHidden_InNonBatchMode();
}
@ -376,6 +376,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
provider.addToTool();
tool.showComponentProvider(provider, true);
waitForSwing();
waitForCondition(() -> provider.isVisible());
}
private void hideProvider() {
@ -546,6 +547,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
// simulate the user mousing over the toolbar button
DockingActionIf closeAction = getAction(tool, provider.getOwner(), "Close Window");
assertNotNull("Provider action not installed in toolbar", closeAction);
DockingWindowManager.setMouseOverAction(closeAction);
performLaunchKeyStrokeDialogAction();
@ -554,6 +556,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
runSwing(() -> dialog.setKeyStroke(ks));
pressButtonByText(dialog, "OK");
waitForSwing();
assertFalse("Invalid key stroke: " + ks, runSwing(() -> dialog.isVisible()));
}