Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-5-7-26'

This commit is contained in:
Ryan Kurtz
2026-05-07 11:07:10 -04:00
9 changed files with 107 additions and 115 deletions
+3 -3
View File
@@ -704,9 +704,9 @@ src/main/help/help/topics/Search/images/SearchMemoryRegex.png||GHIDRA||||END|
src/main/help/help/topics/Search/images/SearchText.png||GHIDRA||||END| src/main/help/help/topics/Search/images/SearchText.png||GHIDRA||||END|
src/main/help/help/topics/Search/images/StringSearchDialog.png||GHIDRA||||END| src/main/help/help/topics/Search/images/StringSearchDialog.png||GHIDRA||||END|
src/main/help/help/topics/Search/images/StringSearchResults.png||GHIDRA||||END| src/main/help/help/topics/Search/images/StringSearchResults.png||GHIDRA||||END|
src/main/help/help/topics/SelectBlockPlugin/Select_Block_Help.html||GHIDRA||||END| src/main/help/help/topics/SelectBytesPlugin/Select_Bytes_Help.html||GHIDRA||||END|
src/main/help/help/topics/SelectBlockPlugin/images/Dialog.png||GHIDRA||||END| src/main/help/help/topics/SelectBytesPlugin/images/Dialog.png||GHIDRA||||END|
src/main/help/help/topics/SelectBlockPlugin/images/ToBadAddr.png||GHIDRA||||END| src/main/help/help/topics/SelectBytesPlugin/images/ToBadAddr.png||GHIDRA||||END|
src/main/help/help/topics/Selection/Selecting.htm||GHIDRA||||END| src/main/help/help/topics/Selection/Selecting.htm||GHIDRA||||END|
src/main/help/help/topics/SetHighlightPlugin/Highlighting.htm||GHIDRA||||END| src/main/help/help/topics/SetHighlightPlugin/Highlighting.htm||GHIDRA||||END|
src/main/help/help/topics/ShowInstructionInfoPlugin/ShowInstructionInfo.htm||GHIDRA||||END| src/main/help/help/topics/ShowInstructionInfoPlugin/ShowInstructionInfo.htm||GHIDRA||||END|
@@ -10,81 +10,84 @@
<body> <body>
<h1 align="center">Select Bytes</h1> <h1 align="center">Select Bytes</h1>
<p><br> <p>
This tool allows the user to select a range of bytes starting from the cursor position. This tool allows the user to select a range of bytes starting from the cursor position.
</p> </p>
<div align="center">
&nbsp;
</div> <TABLE x-use-null-cells="" width="100%">
<div align="center"> <TBODY>
<img src="images/Dialog.png"> <TR>
&nbsp;<br> <TD align="center" width="100%"><IMG border="1" src="images/Dialog.png" /></TD>
</div> </TR>
&nbsp; </TBODY>
<div align="left"> </TABLE>
<h3>By Method Options</h3> <h3>By Method Options</h3>
<blockquote> <blockquote>
<p><i><b>Select All: &nbsp;<br> <p><i><b>Select All: &nbsp;
</b></i></p> </b></i></p>
<p>Makes a selection that covers all of the bytes in a file.<br> <p>Makes a selection that covers all of the bytes in a file.
<i><b><br> <i><b>
To Address: &nbsp;<br> To Address: &nbsp;
</b></i></p> </b></i></p>
<p>Makes a selection from current cursor position to a selected address, if <p>Makes a selection from current cursor position to a selected address, if
the address exists. &nbsp;If the address is an invalid address, the user is the address exists. &nbsp;If the address is an invalid address, the user is
prompted to select another address. &nbsp;If the address is outside of the prompted to select another address. &nbsp;If the address is outside of the
current program's memory, the selection will contain bytes from the cursor current program's memory, the selection will contain bytes from the cursor
position to the beginning or end of the program's memory.<br> position to the beginning or end of the program's memory.
<i><b><br> <i><b>
Select Forward: &nbsp;<br> Select Forward: &nbsp;
</b></i></p> </b></i></p>
<p>Default direction. &nbsp;Makes a selection of size <i>n </i>from <p>Default direction. &nbsp;Makes a selection of size <i>n </i>from
the cursor position to <i>n-1</i> number of bytes.<br> the cursor position to <i>n-1</i> number of bytes.
<i><b><br> <i><b>
Select Backward: &nbsp;<br> Select Backward: &nbsp;
</b></i></p> </b></i></p>
<p>Makes a selection of size <i>m</i> from the cursor position to <i>m-1</i> <p>Makes a selection of size <i>m</i> from the cursor position to <i>m-1</i>
number of bytes.<br> number of bytes.
</p> </p>
</blockquote> </blockquote>
<h3>Byte Selection</h3> <h3>Byte Selection</h3>
<blockquote> <blockquote>
<p><i><b>Ending Address: &nbsp;<br> <p><i><b>Ending Address: &nbsp;
</b></i></p> </b></i></p>
<p>Enter an appropriate address that will be either the ending address of the bytes (if <p>Enter an appropriate address that will be either the ending address of the bytes (if
the selected address is greater than the current address) or the starting the selected address is greater than the current address) or the starting
address of the bytes (if the selected address is lower than the current address of the bytes (if the selected address is lower than the current
address). This value may be in either <b>hex</b> or <b>decimal</b><br> address). This value may be in either <b>hex</b> or <b>decimal</b>
<p><i><b>Length: &nbsp;<br> <p><i><b>Length: &nbsp;
</b></i></p> </b></i></p>
<p>Enter an appropriate length (number of bytes to be contained in the <p>Enter an appropriate length (number of bytes to be contained in the
selection) that will point to either the ending address of the bytes (if selection) that will point to either the ending address of the bytes (if
the selected address is greater than the current address) or the starting the selected address is greater than the current address) or the starting
address of the bytes (if the selected address is lower than the current address of the bytes (if the selected address is lower than the current
address). This value may be in either <b>hex</b> or <b>decimal</b><br> address). This value may be in either <b>hex</b> or <b>decimal</b>
</blockquote> </blockquote>
<h3>Error Messages</h3> <h3>Error Messages</h3>
<blockquote> <blockquote>
<p><i><b>To Address Error Message:</b></i></p> <p><i><b>To Address Error Message:</b></i></p>
<div align="center">
<img src="images/ToBadAddr.png"><br> <img src="images/ToBadAddr.png">
</div>
<p></p> <p></p>
<p align="left">This occurs only when an invalid address is entered. &nbsp;The <p align="left">This occurs only when an invalid address is entered. &nbsp;The
user is prompted to enter a valid address.<br> user is prompted to enter a valid address.
<br>
<br>
</p> </p>
<br>
<br>
</blockquote> </blockquote>
<p class="providedbyplugin">Provided By: <i>Select Block</i> Plugin</p> <p class="providedbyplugin">Provided By: <i>Select Bytes</i> Plugin</p>
<p class="relatedtopic">Related Topics</p> <p class="relatedtopic">Related Topics</p>
<ul> <ul>
<li><a href="help/topics/Selection/Selecting.htm">Selection</a></li> <li><a href="help/topics/Selection/Selecting.htm">Selection</a></li>
</ul> </ul>
<br>
</body> </body>
@@ -37,7 +37,7 @@ import ghidra.util.layout.PairLayout;
/** /**
* Dialog for making program selections * Dialog for making program selections
*/ */
class SelectBlockDialog extends ReusableDialogComponentProvider { class SelectBytesDialog extends ReusableDialogComponentProvider {
private PluginTool tool; private PluginTool tool;
private Navigatable navigatable; private Navigatable navigatable;
@@ -49,7 +49,7 @@ class SelectBlockDialog extends ReusableDialogComponentProvider {
private JRadioButton allButton; private JRadioButton allButton;
private JRadioButton toButton; private JRadioButton toButton;
SelectBlockDialog(PluginTool tool, Navigatable navigatable) { SelectBytesDialog(PluginTool tool, Navigatable navigatable) {
super("Select Bytes", false, true, true, false); super("Select Bytes", false, true, true, false);
this.tool = tool; this.tool = tool;
this.navigatable = navigatable; this.navigatable = navigatable;
@@ -58,7 +58,7 @@ class SelectBlockDialog extends ReusableDialogComponentProvider {
addOKButton(); addOKButton();
setOkButtonText("Select Bytes"); setOkButtonText("Select Bytes");
addDismissButton(); addDismissButton();
setHelpLocation(new HelpLocation("SelectBlockPlugin", "Select_Block_Help")); setHelpLocation(new HelpLocation("SelectBytesPlugin", "Select_Bytes_Help"));
setItemsEnabled(false); setItemsEnabled(false);
forwardButton.doClick(); forwardButton.doClick();
@@ -72,14 +72,13 @@ class SelectBlockDialog extends ReusableDialogComponentProvider {
gbc.insets = new Insets(2, 2, 2, 2); gbc.insets = new Insets(2, 2, 2, 2);
gbc.gridx = 0; gbc.gridx = 0;
gbc.gridy = 0; gbc.gridy = 0;
mainPanel.add(methodPanel(), gbc); mainPanel.add(buildMethodPanel(), gbc);
gbc.gridx++; gbc.gridx++;
mainPanel.add(buildBlockPanel(), gbc); mainPanel.add(buildInputPanel(), gbc);
mainPanel.getAccessibleContext().setAccessibleName("Select Block");
return mainPanel; return mainPanel;
} }
private JPanel buildBlockPanel() { private JPanel buildInputPanel() {
JPanel main = new JPanel(); JPanel main = new JPanel();
main.setBorder(BorderFactory.createTitledBorder("Byte Selection")); main.setBorder(BorderFactory.createTitledBorder("Byte Selection"));
@@ -94,12 +93,10 @@ class SelectBlockDialog extends ReusableDialogComponentProvider {
lengthField = new IntegerTextField(10); lengthField = new IntegerTextField(10);
lengthField.getComponent().getAccessibleContext().setAccessibleName("Number Input"); lengthField.getComponent().getAccessibleContext().setAccessibleName("Number Input");
lengthField.setMinValue(BigInteger.ZERO); lengthField.setMinValue(BigInteger.ZERO);
main.add(lengthField.getComponent());
main.getAccessibleContext().setAccessibleName("Block");
return main; return main;
} }
private JPanel methodPanel() { private JPanel buildMethodPanel() {
ButtonGroup buttonGroup = new ButtonGroup(); ButtonGroup buttonGroup = new ButtonGroup();
JPanel main = new JPanel(); JPanel main = new JPanel();
main.setBorder(BorderFactory.createTitledBorder("By Method")); main.setBorder(BorderFactory.createTitledBorder("By Method"));
@@ -175,6 +172,10 @@ class SelectBlockDialog extends ReusableDialogComponentProvider {
repack(); repack();
} }
void setLength(int length) {
lengthField.setText(Integer.toString(length));
}
private void setItemsEnabled(boolean enabled) { private void setItemsEnabled(boolean enabled) {
setAddressFieldEnabled(enabled); setAddressFieldEnabled(enabled);
setLengthInputEnabled(enabled); setLengthInputEnabled(enabled);
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,12 +30,7 @@ import ghidra.framework.plugintool.util.PluginStatus;
import ghidra.util.HelpLocation; import ghidra.util.HelpLocation;
/** /**
* This plugin class contains the structure needed for the user to * This plugin allows users to select bytes anywhere inside of the Code Browser and Byte Viewer.
* select blocks of data anywhere inside of the Code Browser and Byte Viewer.
* <p>
* Note: This plugin used to refer to selections as blocks instead of lengths
* of bytes. The GUI has been changed, but the internal comments and
* variable names have not.
*/ */
//@formatter:off //@formatter:off
@PluginInfo( @PluginInfo(
@@ -43,16 +38,15 @@ import ghidra.util.HelpLocation;
packageName = CorePluginPackage.NAME, packageName = CorePluginPackage.NAME,
category = PluginCategoryNames.COMMON, category = PluginCategoryNames.COMMON,
shortDescription = "Select Bytes", shortDescription = "Select Bytes",
description = "Allows the user to select different size " description = "Allows the user to select different size lengths of bytes, "
+ "lengths of bytes from the Byte Viewer "
+ "generally starting from the cursor position or entire file" + "generally starting from the cursor position or entire file"
) )
//@formatter:on //@formatter:on
public class SelectBlockPlugin extends Plugin { public class SelectBytesPlugin extends Plugin {
private DockingAction toolBarAction; private DockingAction action;
private SelectBlockDialog dialog; private SelectBytesDialog dialog;
public SelectBlockPlugin(PluginTool tool) { public SelectBytesPlugin(PluginTool tool) {
super(tool); super(tool);
createActions(); createActions();
} }
@@ -68,7 +62,7 @@ public class SelectBlockPlugin extends Plugin {
private void createActions() { private void createActions() {
toolBarAction = new NavigatableContextAction("SelectBlock", getName()) { action = new NavigatableContextAction("SelectBytes", getName()) {
@Override @Override
public void actionPerformed(NavigatableActionContext context) { public void actionPerformed(NavigatableActionContext context) {
showDialog(context.getComponentProvider(), context.getNavigatable()); showDialog(context.getComponentProvider(), context.getNavigatable());
@@ -84,13 +78,13 @@ public class SelectBlockPlugin extends Plugin {
new MenuData(new String[] { ToolConstants.MENU_SELECTION, "Bytes..." }, null, new MenuData(new String[] { ToolConstants.MENU_SELECTION, "Bytes..." }, null,
"Select Group 2"); "Select Group 2");
menuData.setMenuSubGroup("1"); menuData.setMenuSubGroup("1");
toolBarAction.setMenuBarData(menuData); action.setMenuBarData(menuData);
toolBarAction.addToWindowWhen(NavigatableActionContext.class); action.addToWindowWhen(NavigatableActionContext.class);
toolBarAction.setEnabled(false); action.setEnabled(false);
toolBarAction.setDescription("Allows user to select blocks of data."); action.setDescription("Allows user to select bytes of data.");
toolBarAction.setHelpLocation(new HelpLocation("SelectBlockPlugin", "Select_Block_Help")); action.setHelpLocation(new HelpLocation("SelectBytesPlugin", "Select_Bytes_Help"));
tool.addAction(toolBarAction); tool.addAction(action);
} }
protected void updateNavigatable(ActionContext context) { protected void updateNavigatable(ActionContext context) {
@@ -109,7 +103,7 @@ public class SelectBlockPlugin extends Plugin {
if (dialog != null) { if (dialog != null) {
dialog.close(); dialog.close();
} }
dialog = new SelectBlockDialog(tool, navigatable); dialog = new SelectBytesDialog(tool, navigatable);
dialog.show(provider); dialog.show(provider);
} }
@@ -45,7 +45,7 @@ import ghidra.util.task.TaskMonitor;
/** /**
* Test class to test the Select Bytes dialog. * Test class to test the Select Bytes dialog.
*/ */
public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest { public class SelectBytesPluginTest extends AbstractGhidraHeadedIntegrationTest {
private static final String SELECT_BYTES_BUTTON_NAME = "Select Bytes"; private static final String SELECT_BYTES_BUTTON_NAME = "Select Bytes";
@@ -64,9 +64,9 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
configureTool(tool); configureTool(tool);
browser = env.getPlugin(CodeBrowserPlugin.class); browser = env.getPlugin(CodeBrowserPlugin.class);
SelectBlockPlugin plugin = env.getPlugin(SelectBlockPlugin.class); SelectBytesPlugin plugin = env.getPlugin(SelectBytesPlugin.class);
showDialogAction = (DockingActionIf) getInstanceField("toolBarAction", plugin); showDialogAction = getAction(plugin, "SelectBytes");
} }
@After @After
@@ -97,7 +97,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
toolToConfigure.addPlugin(NextPrevAddressPlugin.class.getName()); toolToConfigure.addPlugin(NextPrevAddressPlugin.class.getName());
toolToConfigure.addPlugin(CodeBrowserPlugin.class.getName()); toolToConfigure.addPlugin(CodeBrowserPlugin.class.getName());
toolToConfigure.addPlugin(GoToAddressLabelPlugin.class.getName()); toolToConfigure.addPlugin(GoToAddressLabelPlugin.class.getName());
toolToConfigure.addPlugin(SelectBlockPlugin.class.getName()); toolToConfigure.addPlugin(SelectBytesPlugin.class.getName());
} }
@Test @Test
@@ -107,7 +107,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
openProgram(); openProgram();
assertTrue(showDialogAction.isEnabledForContext(getContext())); assertTrue(showDialogAction.isEnabledForContext(getContext()));
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
closeProgram(); closeProgram();
assertTrue(!showDialogAction.isEnabledForContext(getContext())); assertTrue(!showDialogAction.isEnabledForContext(getContext()));
@@ -117,7 +117,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
@Test @Test
public void testSelectAll() throws Exception { public void testSelectAll() throws Exception {
openProgram(); openProgram();
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectAll(dialog); pressSelectAll(dialog);
pressSelectBytes(dialog); pressSelectBytes(dialog);
@@ -132,7 +132,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
openProgram(); openProgram();
goTo(addr(0x1006420)); goTo(addr(0x1006420));
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectAll(dialog); pressSelectAll(dialog);
assertAddressFieldDisabled(dialog); assertAddressFieldDisabled(dialog);
@@ -157,7 +157,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
openProgram(); openProgram();
goTo(addr(0x1006420)); goTo(addr(0x1006420));
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectForward(dialog); pressSelectForward(dialog);
@@ -173,7 +173,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
openProgram(); openProgram();
goTo(addr(0x1006420)); goTo(addr(0x1006420));
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectBackward(dialog); pressSelectBackward(dialog);
@@ -192,7 +192,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
openProgram(); openProgram();
goTo(addr(0x1006420)); goTo(addr(0x1006420));
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectToAddress(dialog); pressSelectToAddress(dialog);
@@ -216,7 +216,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
Address overlayEnd = block.getEnd(); Address overlayEnd = block.getEnd();
goTo(overlayStart); goTo(overlayStart);
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectForward(dialog); pressSelectForward(dialog);
@@ -241,7 +241,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
Address overlayEnd = block.getEnd(); Address overlayEnd = block.getEnd();
goTo(overlayStart); goTo(overlayStart);
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectForward(dialog); pressSelectForward(dialog);
@@ -266,7 +266,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
Address overlayEnd = block.getEnd(); Address overlayEnd = block.getEnd();
goTo(overlayEnd); goTo(overlayEnd);
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectBackward(dialog); pressSelectBackward(dialog);
@@ -291,7 +291,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
Address overlayEnd = block.getEnd(); Address overlayEnd = block.getEnd();
goTo(overlayEnd); goTo(overlayEnd);
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectBackward(dialog); pressSelectBackward(dialog);
@@ -311,7 +311,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
Address startAddress = addr(0x6420); Address startAddress = addr(0x6420);
goTo(startAddress); goTo(startAddress);
SelectBlockDialog dialog = showDialog(); SelectBytesDialog dialog = showDialog();
pressSelectAll(dialog); pressSelectAll(dialog);
@@ -381,14 +381,14 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
// Private Methods // Private Methods
//================================================================================================= //=================================================================================================
private void pressSelectToAddress(SelectBlockDialog dialog) { private void pressSelectToAddress(SelectBytesDialog dialog) {
JRadioButton toButton = (JRadioButton) findComponentByName(dialog, "toButton"); JRadioButton toButton = (JRadioButton) findComponentByName(dialog, "toButton");
pressButton(toButton, true); pressButton(toButton, true);
} }
private SelectBlockDialog showDialog() { private SelectBytesDialog showDialog() {
performAction(showDialogAction, getContext(), true); performAction(showDialogAction, getContext(), true);
SelectBlockDialog dialog = waitForDialogComponent(SelectBlockDialog.class); SelectBytesDialog dialog = waitForDialogComponent(SelectBytesDialog.class);
return dialog; return dialog;
} }
@@ -420,51 +420,49 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
} }
} }
private void pressSelectBackward(SelectBlockDialog dialog) { private void pressSelectBackward(SelectBytesDialog dialog) {
JRadioButton backwardButton = (JRadioButton) findComponentByName(dialog, "backwardButton"); JRadioButton backwardButton = (JRadioButton) findComponentByName(dialog, "backwardButton");
pressButton(backwardButton, true); pressButton(backwardButton, true);
} }
private void setAddress(SelectBlockDialog dialog, String text) { private void setAddress(SelectBytesDialog dialog, String text) {
final JTextField addressInputField = final JTextField addressInputField =
(JTextField) getInstanceField("toAddressField", dialog); (JTextField) getInstanceField("toAddressField", dialog);
runSwing(() -> addressInputField.setText(text)); runSwing(() -> addressInputField.setText(text));
} }
private void setLength(SelectBlockDialog dialog, int length) { private void setLength(SelectBytesDialog dialog, int length) {
IntegerTextField inputField = runSwing(() -> dialog.setLength(length));
(IntegerTextField) getInstanceField("numberInputField", dialog);
runSwing(() -> inputField.setValue(length));
} }
private void pressSelectForward(SelectBlockDialog dialog) { private void pressSelectForward(SelectBytesDialog dialog) {
JRadioButton forwardButton = (JRadioButton) findComponentByName(dialog, "forwardButton"); JRadioButton forwardButton = (JRadioButton) findComponentByName(dialog, "forwardButton");
pressButton(forwardButton, true); pressButton(forwardButton, true);
} }
private void assertLengthFieldDisabled(SelectBlockDialog dialog) { private void assertLengthFieldDisabled(SelectBytesDialog dialog) {
IntegerTextField inputField = IntegerTextField inputField =
(IntegerTextField) getInstanceField("numberInputField", dialog); (IntegerTextField) getInstanceField("lengthField", dialog);
assertFalse(inputField.getComponent().isEnabled()); assertFalse(inputField.getComponent().isEnabled());
} }
private void assertLengthFieldEnabled(SelectBlockDialog dialog) { private void assertLengthFieldEnabled(SelectBytesDialog dialog) {
IntegerTextField inputField = IntegerTextField inputField =
(IntegerTextField) getInstanceField("numberInputField", dialog); (IntegerTextField) getInstanceField("lengthField", dialog);
assertTrue(inputField.getComponent().isEnabled()); assertTrue(inputField.getComponent().isEnabled());
} }
private void assertAddressFieldDisabled(SelectBlockDialog dialog) { private void assertAddressFieldDisabled(SelectBytesDialog dialog) {
JTextField addressInputField = (JTextField) getInstanceField("toAddressField", dialog); JTextField addressInputField = (JTextField) getInstanceField("toAddressField", dialog);
assertFalse(addressInputField.isEnabled()); assertFalse(addressInputField.isEnabled());
} }
private void assertAddressFieldEnabled(SelectBlockDialog dialog) { private void assertAddressFieldEnabled(SelectBytesDialog dialog) {
JTextField addressInputField = (JTextField) getInstanceField("toAddressField", dialog); JTextField addressInputField = (JTextField) getInstanceField("toAddressField", dialog);
assertTrue(addressInputField.isEnabled()); assertTrue(addressInputField.isEnabled());
} }
private void pressSelectAll(SelectBlockDialog dialog) { private void pressSelectAll(SelectBytesDialog dialog) {
JRadioButton allButton = (JRadioButton) findComponentByName(dialog, "allButton"); JRadioButton allButton = (JRadioButton) findComponentByName(dialog, "allButton");
pressButton(allButton, true); pressButton(allButton, true);
} }
@@ -477,7 +475,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
runSwing(() -> browser.getProvider().setSelection(null)); runSwing(() -> browser.getProvider().setSelection(null));
} }
private void pressSelectBytes(final SelectBlockDialog dialog) { private void pressSelectBytes(final SelectBytesDialog dialog) {
executeOnSwingWithoutBlocking( executeOnSwingWithoutBlocking(
() -> pressButtonByText(dialog, SELECT_BYTES_BUTTON_NAME, true)); () -> pressButtonByText(dialog, SELECT_BYTES_BUTTON_NAME, true));
@@ -399,7 +399,7 @@
<li><a href="help/topics/Charsets/Charsets.htm">Charsets</a></li> <li><a href="help/topics/Charsets/Charsets.htm">Charsets</a></li>
<li><a href="help/topics/CodeBrowserPlugin/CodeBrowser.htm">Code Browser</a></li> <li><a href="help/topics/CodeBrowserPlugin/CodeBrowser.htm">Code Browser</a></li>
<li><a href="help/topics/Tool/Configure_Tool.htm">Configure Tool</a></li> <li><a href="help/topics/Tool/Configure_Tool.htm">Configure Tool</a></li>
<li><a href="help/topics/SelectBlockPlugin/Select_Block_Help.html">Select Bytes</a></li> <li><a href="help/topics/SelectBytesPlugin/Select_Bytes_Help.html">Select Bytes</a></li>
</ul> </ul>
<p></p> <p></p>
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,24 +22,20 @@ import org.junit.Test;
import docking.DialogComponentProvider; import docking.DialogComponentProvider;
public class SelectBlockPluginScreenShots extends GhidraScreenShotGenerator { public class SelectBytesPluginScreenShots extends GhidraScreenShotGenerator {
public SelectBlockPluginScreenShots() { @Test
super(); public void testDialog() {
}
@Test performAction("SelectBytes", "SelectBytesPlugin", false);
public void testDialog() {
performAction("SelectBlock", "SelectBlockPlugin", false);
captureDialog(); captureDialog();
} }
@Test @Test
public void testToBadAddr() { public void testToBadAddr() {
performAction("SelectBlock", "SelectBlockPlugin", false); performAction("SelectBytes", "SelectBytesPlugin", false);
DialogComponentProvider dialog = getDialog(); DialogComponentProvider dialog = getDialog();