mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Fix DataActionTest failures due to data settings dockingaction changes.
The settings action's behavior changed when there was an active selection. The tests needed to change to reflect that.
This commit is contained in:
parent
79d8f164f8
commit
e6c542e281
@ -1270,7 +1270,9 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
||||
checkAction(actions, EDIT_DATA_TYPE,
|
||||
pdata != null && (pdata.isStructure() || pdata.isUnion()), caseName);
|
||||
checkAction(actions, CREATE_ARRAY, true, caseName);
|
||||
checkAction(actions, DEFAULT_DATA_SETTINGS, !hasSelection && hasSettings, caseName);
|
||||
checkAction(actions, DEFAULT_DATA_SETTINGS,
|
||||
(hasSelection == false || isSelectionJustSingleDataInstance(sel, d)) && hasSettings,
|
||||
caseName);
|
||||
checkAction(actions, DATA_SETTINGS, hasNormalUnitSelection || hasSettings, caseName);
|
||||
checkAction(actions, CYCLE_FLOAT_DOUBLE, onFloatDoubleData, caseName);
|
||||
checkAction(actions, CYCLE_BYTE_WORD_DWORD_QWORD, onByteWordData, caseName);
|
||||
@ -1332,7 +1334,9 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
||||
checkAction(actions, EDIT_DATA_TYPE,
|
||||
pdata != null && (pdata.isStructure() || pdata.isUnion()), caseName);
|
||||
checkAction(actions, CREATE_ARRAY, true, caseName);
|
||||
checkAction(actions, DEFAULT_DATA_SETTINGS, hasSettings && !hasSelection, caseName);
|
||||
checkAction(actions, DEFAULT_DATA_SETTINGS,
|
||||
hasSettings && (hasSelection == false || isSelectionJustSingleDataInstance(sel, d)),
|
||||
caseName);
|
||||
checkAction(actions, DATA_SETTINGS, hasSettings, caseName);
|
||||
checkAction(actions, CYCLE_FLOAT_DOUBLE, true, caseName);
|
||||
checkAction(actions, CYCLE_BYTE_WORD_DWORD_QWORD, true, caseName);
|
||||
@ -1474,6 +1478,14 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
||||
return;
|
||||
}
|
||||
|
||||
private boolean isSelectionJustSingleDataInstance(ProgramSelection selection, Data data) {
|
||||
if (selection != null && data != null) {
|
||||
AddressSet dataAS = new AddressSet(data.getAddress(), data.getMaxAddress());
|
||||
return dataAS.hasSameAddresses(selection);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ActionContext getProgramContext() {
|
||||
cb.updateNow();
|
||||
ActionContext context = cb.getProvider().getActionContext(null);
|
||||
|
Loading…
Reference in New Issue
Block a user