mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 22:17:08 +08:00
GT-0 fixing junit tests
This commit is contained in:
+1
-1
@@ -110,7 +110,7 @@ public abstract class AbstractNextPreviousAction extends CodeViewerContextAction
|
|||||||
|
|
||||||
void setDirection(boolean isForward) {
|
void setDirection(boolean isForward) {
|
||||||
this.isForward = isForward;
|
this.isForward = isForward;
|
||||||
setDescription(getDescription());
|
setDescription(getDescriptionString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDescriptionString() {
|
private String getDescriptionString() {
|
||||||
|
|||||||
+8
-1
@@ -227,7 +227,14 @@ public class NextPreviousBookmarkAction extends MultiStateDockingAction<String>
|
|||||||
|
|
||||||
public void setDirection(boolean isForward) {
|
public void setDirection(boolean isForward) {
|
||||||
this.isForward = isForward;
|
this.isForward = isForward;
|
||||||
setDescription(getDescription());
|
setDescription(getToolTipText());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToolTipText() {
|
||||||
|
String description = "Go To " + (isForward ? "Next" : "Previous");
|
||||||
|
description += " Bookmark: " + getCurrentState().getName();
|
||||||
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNavigationTypeName() {
|
private String getNavigationTypeName() {
|
||||||
|
|||||||
+23
-24
@@ -118,36 +118,35 @@ public class NextPrevCodeUnitPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||||||
Icon downIcon = ResourceManager.loadImage("images/down.png");
|
Icon downIcon = ResourceManager.loadImage("images/down.png");
|
||||||
|
|
||||||
assertEquals(downIcon, direction.getToolBarData().getIcon());
|
assertEquals(downIcon, direction.getToolBarData().getIcon());
|
||||||
assertEquals("Next Instruction", nextInst.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Instruction", nextInst.getDescription());
|
||||||
assertEquals("Next Data", nextData.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Data", nextData.getDescription());
|
||||||
assertEquals("Next Undefined", nextUndef.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Undefined", nextUndef.getDescription());
|
||||||
assertEquals("Next Label", nextLabel.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Label", nextLabel.getDescription());
|
||||||
assertEquals("Next Function", nextFunc.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Function", nextFunc.getDescription());
|
||||||
assertEquals("Next Instruction Not In a Function",
|
assertEquals("Go To Next Instruction Not In a Function", nextNonFunc.getDescription());
|
||||||
nextNonFunc.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Bookmark: All Types", nextBookmark.getDescription());
|
||||||
assertEquals("Next Bookmark", nextBookmark.getMenuBarData().getMenuPath()[1]);
|
|
||||||
|
|
||||||
performAction(direction, cb.getProvider(), true);
|
performAction(direction, cb.getProvider(), true);
|
||||||
|
|
||||||
assertEquals(upIcon, direction.getToolBarData().getIcon());
|
assertEquals(upIcon, direction.getToolBarData().getIcon());
|
||||||
assertEquals("Previous Instruction", nextInst.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Previous Instruction", nextInst.getDescription());
|
||||||
assertEquals("Previous Data", nextData.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Previous Data", nextData.getDescription());
|
||||||
assertEquals("Previous Undefined", nextUndef.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Previous Undefined", nextUndef.getDescription());
|
||||||
assertEquals("Previous Label", nextLabel.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Previous Label", nextLabel.getDescription());
|
||||||
assertEquals("Previous Function", nextFunc.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Previous Function", nextFunc.getDescription());
|
||||||
assertEquals("Previous Instruction Not In a Function",
|
assertEquals("Go To Previous Instruction Not In a Function", nextNonFunc.getDescription());
|
||||||
nextNonFunc.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Previous Bookmark: All Types", nextBookmark.getDescription());
|
||||||
assertEquals("Previous Bookmark", nextBookmark.getMenuBarData().getMenuPath()[1]);
|
|
||||||
|
|
||||||
performAction(direction, cb.getProvider(), true);
|
performAction(direction, cb.getProvider(), true);
|
||||||
|
|
||||||
assertEquals(downIcon, direction.getToolBarData().getIcon());
|
assertEquals(downIcon, direction.getToolBarData().getIcon());
|
||||||
assertEquals("Next Instruction", nextInst.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Instruction", nextInst.getDescription());
|
||||||
assertEquals("Next Data", nextData.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Data", nextData.getDescription());
|
||||||
assertEquals("Next Undefined", nextUndef.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Undefined", nextUndef.getDescription());
|
||||||
assertEquals("Next Label", nextLabel.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Label", nextLabel.getDescription());
|
||||||
assertEquals("Next Function", nextFunc.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Function", nextFunc.getDescription());
|
||||||
assertEquals("Next Instruction Not In a Function",
|
assertEquals("Go To Next Instruction Not In a Function", nextNonFunc.getDescription());
|
||||||
nextNonFunc.getMenuBarData().getMenuPath()[1]);
|
assertEquals("Go To Next Bookmark: All Types", nextBookmark.getDescription());
|
||||||
assertEquals("Next Bookmark", nextBookmark.getMenuBarData().getMenuPath()[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ public abstract class MultiStateDockingAction<T> extends DockingAction {
|
|||||||
ToolBarData tbd = getToolBarData();
|
ToolBarData tbd = getToolBarData();
|
||||||
tbd.setIcon(getIcon(actionState));
|
tbd.setIcon(getIcon(actionState));
|
||||||
|
|
||||||
setDescription(getTooTipText());
|
setDescription(getToolTipText());
|
||||||
actionStateChanged(actionState, trigger);
|
actionStateChanged(actionState, trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +288,7 @@ public abstract class MultiStateDockingAction<T> extends DockingAction {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTooTipText() {
|
public String getToolTipText() {
|
||||||
return getName() + ": " + getCurrentState().getName();
|
return getName() + ": " + getCurrentState().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import resources.Icons;
|
|||||||
public class ActionBuilderTest {
|
public class ActionBuilderTest {
|
||||||
private int actionCount = 0;
|
private int actionCount = 0;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDescription() {
|
public void testDescription() {
|
||||||
DockingAction action = new ActionBuilder("Test", "Test")
|
DockingAction action = new ActionBuilder("Test", "Test")
|
||||||
@@ -163,7 +162,7 @@ public class ActionBuilderTest {
|
|||||||
.onAction(e -> actionCount++)
|
.onAction(e -> actionCount++)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertEquals(KeyStroke.getKeyStroke("ALT A"), action.getKeyBinding());
|
assertEquals(KeyStroke.getKeyStroke("alt pressed A"), action.getKeyBinding());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user