Test fixes

This commit is contained in:
dragonmacher 2025-02-26 12:42:09 -05:00
parent cc1228bdaa
commit b04ff770b3
6 changed files with 24 additions and 14 deletions

View file

@ -372,10 +372,8 @@ public abstract class AbstractDataTreeDialog extends DialogComponentProvider
// data tree panel must be created before the combo box // data tree panel must be created before the combo box
JPanel dataTreePanel = createDataTreePanel(); JPanel dataTreePanel = createDataTreePanel();
if (type == CHOOSE_FOLDER) { // this allows users to press the OK button to choose the root folder
// this allows users to press the OK button to choose the root folder treePanel.selectRootDataFolder();
treePanel.selectRootDataFolder();
}
if (type == OPEN) { if (type == OPEN) {
JPanel comboPanel = createComboBoxPanel(); JPanel comboPanel = createComboBoxPanel();

View file

@ -113,12 +113,13 @@ public class MemoryMapProvider1Test extends AbstractGhidraHeadedIntegrationTest
table.addRowSelectionInterval(0, 0); table.addRowSelectionInterval(0, 0);
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName()); Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
for (DockingActionIf action : actions) { for (DockingActionIf action : actions) {
if (action.getName().equals("Merge Blocks") || action.getName().equals("Local Menu") || String name = action.getName();
action.getName().equals("Rename Overlay Space")) { if (name.equals("Merge Blocks") || name.equals("Local Menu") ||
name.equals("Rename Overlay Space") || name.equals("Close Window")) {
assertFalse(action.isEnabled()); assertFalse(action.isEnabled());
} }
else { else {
assertTrue("Action not enabled when it should be: " + action.getName(), assertTrue("Action not enabled when it should be: " + name,
action.isEnabled()); action.isEnabled());
} }
} }

View file

@ -725,7 +725,7 @@ public class FrontEndPluginActionsTest extends AbstractGhidraHeadedIntegrationTe
f = f.createFolder("A"); f = f.createFolder("A");
f = f.createFolder("B"); f = f.createFolder("B");
f = f.createFolder("C"); f = f.createFolder("C");
waitForSwing(); waitForTree();
setSelectionPath(rootNode.getTreePath()); setSelectionPath(rootNode.getTreePath());
DockingActionIf selectAction = getAction("Select All"); DockingActionIf selectAction = getAction("Select All");

View file

@ -218,7 +218,7 @@ class DockableToolBarManager {
} }
// don't allow the last component in a window to be closed to prevent an empty window // don't allow the last component in a window to be closed to prevent an empty window
return !dwm.isLastComponentInWindow(provider); return dwm != null && !dwm.isLastComponentInWindow(provider);
} }
} }

View file

@ -188,7 +188,9 @@ public class ProjectDataTreePanel extends JPanel {
} }
public void selectDomainFile(DomainFile domainFile) { public void selectDomainFile(DomainFile domainFile) {
selectDomainFiles(Set.of(domainFile)); if (domainFile != null) {
selectDomainFiles(Set.of(domainFile));
}
} }
public void setHelpLocation(HelpLocation helpLocation) { public void setHelpLocation(HelpLocation helpLocation) {

View file

@ -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,6 +22,7 @@ import javax.swing.tree.TreePath;
import docking.action.MenuData; import docking.action.MenuData;
import docking.widgets.tree.GTreeNode; import docking.widgets.tree.GTreeNode;
import docking.widgets.tree.tasks.GTreeExpandAllTask;
import ghidra.framework.main.datatable.ProjectTreeAction; import ghidra.framework.main.datatable.ProjectTreeAction;
import ghidra.framework.main.datatree.DataTree; import ghidra.framework.main.datatree.DataTree;
import ghidra.framework.main.datatree.FrontEndProjectTreeContext; import ghidra.framework.main.datatree.FrontEndProjectTreeContext;
@ -53,8 +54,16 @@ public class ProjectDataSelectAction extends ProjectTreeAction {
*/ */
private void selectAllChildren(DataTree tree, GTreeNode node) { private void selectAllChildren(DataTree tree, GTreeNode node) {
List<TreePath> paths = new ArrayList<TreePath>(); List<TreePath> paths = new ArrayList<TreePath>();
getAllTreePaths(node, paths);
tree.setSelectionPaths(paths.toArray(new TreePath[paths.size()])); tree.runTask(monitor -> {
GTreeExpandAllTask task = new GTreeExpandAllTask(tree, node);
task.run(monitor);
getAllTreePaths(node, paths);
tree.setSelectionPaths(paths);
});
} }
/** /**