mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 20:26:56 +08:00
Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-9-10-25'
This commit is contained in:
@@ -538,7 +538,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
|
|||||||
DockingWindowManager.setMouseOverAction(windowMenuAction);
|
DockingWindowManager.setMouseOverAction(windowMenuAction);
|
||||||
|
|
||||||
performLaunchKeyStrokeDialogAction();
|
performLaunchKeyStrokeDialogAction();
|
||||||
DialogComponentProvider warningDialog = waitForDialogComponent("Unable to Set Keybinding");
|
DialogComponentProvider warningDialog = waitForDialogComponent("Unable to Set Key Binding");
|
||||||
close(warningDialog);
|
close(warningDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-13
@@ -51,7 +51,6 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
private KeyBindingsPanel panel;
|
private KeyBindingsPanel panel;
|
||||||
private JTable table;
|
private JTable table;
|
||||||
private TableModel model;
|
private TableModel model;
|
||||||
private JTextField keyField;
|
|
||||||
private JTextPane statusPane;
|
private JTextPane statusPane;
|
||||||
private JDialog dialog;
|
private JDialog dialog;
|
||||||
|
|
||||||
@@ -82,8 +81,8 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testKeyBindingsDisplay() throws Exception {
|
public void testKeyBindingsDisplay() throws Exception {
|
||||||
|
|
||||||
assertEquals(3, model.getColumnCount());
|
assertEquals(3, table.getColumnCount());
|
||||||
String[] ids = new String[] { "Action Name", "KeyBinding", "Plugin Name" };
|
String[] ids = new String[] { "Action Name", "Key Binding", "Owner" };
|
||||||
TableColumnModel m = table.getColumnModel();
|
TableColumnModel m = table.getColumnModel();
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
TableColumn c = m.getColumn(i);
|
TableColumn c = m.getColumn(i);
|
||||||
@@ -91,15 +90,9 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
}
|
}
|
||||||
assertTrue(model.getRowCount() > 0);
|
assertTrue(model.getRowCount() > 0);
|
||||||
|
|
||||||
// look for the info panel
|
assertMessage("Select an action to change a keybinding");
|
||||||
MultiLineLabel label = findComponent(panel, MultiLineLabel.class);
|
|
||||||
String str = "To add or change a key binding, select an action\n" +
|
|
||||||
"and type any key combination.";
|
|
||||||
|
|
||||||
assertEquals(str, label.getLabel());
|
|
||||||
|
|
||||||
// verify that the description is displayed for the selected action
|
// verify that the description is displayed for the selected action
|
||||||
|
|
||||||
selectRowForAction(action1);
|
selectRowForAction(action1);
|
||||||
|
|
||||||
String actualText = getText(statusPane);
|
String actualText = getText(statusPane);
|
||||||
@@ -130,6 +123,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
assertNotNull("Could not find edit key binding action.", action);
|
assertNotNull("Could not find edit key binding action.", action);
|
||||||
|
|
||||||
selectRowForAction(action);
|
selectRowForAction(action);
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
triggerText(keyField, "z");
|
triggerText(keyField, "z");
|
||||||
assertKeyFieldText("Z");
|
assertKeyFieldText("Z");
|
||||||
|
|
||||||
@@ -148,14 +142,16 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerText(keyField, "z");
|
JTextField keyField = getKeyField();
|
||||||
assertMessage("No action is selected.");
|
assertNull(keyField);
|
||||||
|
assertMessage("Select an action to change a keybinding");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetKeyBinding() throws Exception {
|
public void testSetKeyBinding() throws Exception {
|
||||||
// set a key binding on an action that does not have a key binding
|
// set a key binding on an action that does not have a key binding
|
||||||
selectRowForAction(action1);
|
selectRowForAction(action1);
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
triggerActionKey(keyField, InputEvent.CTRL_DOWN_MASK, KeyEvent.VK_X);
|
triggerActionKey(keyField, InputEvent.CTRL_DOWN_MASK, KeyEvent.VK_X);
|
||||||
KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK);
|
KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK);
|
||||||
assertKeyFieldText(KeyBindingUtils.parseKeyStroke(ks));
|
assertKeyFieldText(KeyBindingUtils.parseKeyStroke(ks));
|
||||||
@@ -168,6 +164,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
public void testSetKeyBinding2() throws Exception {
|
public void testSetKeyBinding2() throws Exception {
|
||||||
|
|
||||||
selectRowForAction(action1);
|
selectRowForAction(action1);
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
triggerText(keyField, "x");
|
triggerText(keyField, "x");
|
||||||
assertKeyFieldText("X");
|
assertKeyFieldText("X");
|
||||||
|
|
||||||
@@ -394,6 +391,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertNoKeyStrokeText() {
|
private void assertNoKeyStrokeText() {
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
assertEquals("", keyField.getText());
|
assertEquals("", keyField.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,6 +400,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertKeyFieldText(String s) {
|
private void assertKeyFieldText(String s) {
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
assertEquals(s, runSwing(() -> keyField.getText()));
|
assertEquals(s, runSwing(() -> keyField.getText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,6 +409,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void typeKeyStroke(KeyStroke ks) {
|
private void typeKeyStroke(KeyStroke ks) {
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
triggerKey(keyField, ks);
|
triggerKey(keyField, ks);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
@@ -419,6 +419,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void typeKeyStroke(int modifiers, int keyCode) {
|
private void typeKeyStroke(int modifiers, int keyCode) {
|
||||||
|
JTextField keyField = getKeyField();
|
||||||
triggerKey(keyField, modifiers, keyCode, KeyEvent.CHAR_UNDEFINED);
|
triggerKey(keyField, modifiers, keyCode, KeyEvent.CHAR_UNDEFINED);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
@@ -538,12 +539,16 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
});
|
});
|
||||||
table = findComponent(panel, JTable.class);
|
table = findComponent(panel, JTable.class);
|
||||||
keyField = (JTextField) findComponentByName(panel, "Key Entry Text Field");
|
|
||||||
statusPane = findComponent(panel, JTextPane.class);
|
statusPane = findComponent(panel, JTextPane.class);
|
||||||
model = table.getModel();
|
model = table.getModel();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JTextField getKeyField() {
|
||||||
|
JTextField keyField = (JTextField) findComponentByName(panel, "Key Entry Text Field");
|
||||||
|
return keyField;
|
||||||
|
}
|
||||||
|
|
||||||
// find 2 actions that do not have key bindings so that we can add and change the values
|
// find 2 actions that do not have key bindings so that we can add and change the values
|
||||||
private void grabActionsWithoutKeyBinding() {
|
private void grabActionsWithoutKeyBinding() {
|
||||||
Set<DockingActionIf> list = tool.getAllActions();
|
Set<DockingActionIf> list = tool.getAllActions();
|
||||||
|
|||||||
-6
@@ -980,8 +980,6 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
|
|
||||||
selectRowForAction(panel, actionName, actionOwner);
|
selectRowForAction(panel, actionName, actionOwner);
|
||||||
|
|
||||||
setToggleButtonSelected(panel, "Enter Mouse Binding", true);
|
|
||||||
|
|
||||||
JPanel actionBindingPanel = (JPanel) getInstanceField("actionBindingPanel", panel);
|
JPanel actionBindingPanel = (JPanel) getInstanceField("actionBindingPanel", panel);
|
||||||
JTextField textField = (JTextField) getInstanceField("mouseEntryField", actionBindingPanel);
|
JTextField textField = (JTextField) getInstanceField("mouseEntryField", actionBindingPanel);
|
||||||
|
|
||||||
@@ -1008,8 +1006,6 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
|
|
||||||
selectRowForAction(panel, actionName, actionOwner);
|
selectRowForAction(panel, actionName, actionOwner);
|
||||||
|
|
||||||
setToggleButtonSelected(panel, "Enter Mouse Binding", false);
|
|
||||||
|
|
||||||
JPanel actionBindingPanel = (JPanel) getInstanceField("actionBindingPanel", panel);
|
JPanel actionBindingPanel = (JPanel) getInstanceField("actionBindingPanel", panel);
|
||||||
KeyEntryPanel keyEntryPanel =
|
KeyEntryPanel keyEntryPanel =
|
||||||
(KeyEntryPanel) getInstanceField("keyEntryPanel", actionBindingPanel);
|
(KeyEntryPanel) getInstanceField("keyEntryPanel", actionBindingPanel);
|
||||||
@@ -1031,8 +1027,6 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
|
|
||||||
selectRowForAction(panel, actionName, actionOwner);
|
selectRowForAction(panel, actionName, actionOwner);
|
||||||
|
|
||||||
setToggleButtonSelected(panel, "Enter Mouse Binding", false);
|
|
||||||
|
|
||||||
pressButtonByName(panel, "Clear Key Binding");
|
pressButtonByName(panel, "Clear Key Binding");
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user