GP-1826 - Scripting - Created a Script Quick Launch dialog.

This commit is contained in:
dragonmacher 2022-03-28 17:17:46 -04:00
parent b6181be1e4
commit 2a5e6f45b8
24 changed files with 923 additions and 214 deletions

View file

@ -15,6 +15,8 @@
*/
package help.screenshot;
import java.awt.Component;
import java.awt.Window;
import java.io.*;
import java.util.*;
@ -23,6 +25,7 @@ import javax.swing.*;
import org.junit.Test;
import docking.ComponentProvider;
import docking.action.DockingActionIf;
import docking.widgets.tree.GTree;
import docking.widgets.tree.GTreeNode;
import generic.jar.ResourceFile;
@ -237,6 +240,30 @@ public class GhidraScriptMgrPluginScreenShots extends GhidraScreenShotGenerator
captureDialog(dialog);
}
@Test
public void testScriptQuickLaunchDialog() {
DockingActionIf action = getAction(tool, "Script Quick Launch");
performAction(action, false);
ScriptSelectionDialog dialog = waitForDialogComponent(ScriptSelectionDialog.class);
JTextField textField = findComponent(dialog.getComponent(), JTextField.class);
triggerText(textField, "Hello*Pop");
// note: textField is an instance of DropDownSelectionTextField
waitFor(() -> (Window) getInstanceField("matchingWindow", textField));
JComponent component = dialog.getComponent();
Window dataTypeDialog = windowForComponent(component);
Window[] popUpWindows = dataTypeDialog.getOwnedWindows();
List<Component> dataTypeWindows = new ArrayList<>(Arrays.asList(popUpWindows));
dataTypeWindows.add(dataTypeDialog);
captureComponents(dataTypeWindows);
closeAllWindows();
}
//==================================================================================================
// Private Methods
//==================================================================================================

View file

@ -58,7 +58,8 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
DialogComponentProvider dialog = getDialog();
JButton manualEntryButton =
(JButton) AbstractGenericTest.findComponentByName(dialog.getComponent(), "manual entry");
(JButton) AbstractGenericTest.findComponentByName(dialog.getComponent(),
"manual entry");
pressButton(manualEntryButton);
InsertBytesWidget comp = waitForDialogComponent(InsertBytesWidget.class);
@ -120,7 +121,7 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
waitForSwing();
Component previewTable =
this.findChildWithType(this.getDialog().getComponent(), PreviewTablePanel.class, null);
findComponent(this.getDialog().getComponent(), PreviewTablePanel.class);
captureComponent(previewTable);
}
@ -140,7 +141,7 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
waitForSwing();
Component controlPanel =
this.findChildWithType(this.getDialog().getComponent(), ControlPanel.class, null);
findComponent(this.getDialog().getComponent(), ControlPanel.class);
captureComponent(controlPanel);
}
@ -161,7 +162,7 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
waitForSwing();
Component instructionTable =
this.findChildWithType(this.getDialog().getComponent(), InstructionTable.class, null);
findComponent(this.getDialog().getComponent(), InstructionTable.class);
InstructionTable instrTable = (InstructionTable) instructionTable;
captureComponent(instrTable.getToolbar());
@ -183,7 +184,7 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
waitForSwing();
Component previewTable =
this.findChildWithType(this.getDialog().getComponent(), PreviewTable.class, null);
findComponent(this.getDialog().getComponent(), PreviewTable.class);
PreviewTable prevTable = (PreviewTable) previewTable;
captureComponent(prevTable.getToolbar());
@ -209,7 +210,8 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
DialogComponentProvider dialog = getDialog();
JButton searchButton =
(JButton) AbstractGenericTest.findAbstractButtonByText(dialog.getComponent(), "Search All");
(JButton) AbstractGenericTest.findAbstractButtonByText(dialog.getComponent(),
"Search All");
pressButton(searchButton);
waitForComponentProvider(TableComponentProvider.class);