This commit is contained in:
ghidravore 2019-11-21 13:50:20 -05:00
parent 844915e935
commit c15b263b90
2 changed files with 9 additions and 5 deletions

View File

@ -28,13 +28,11 @@ import org.junit.Test;
import docking.DockingWindowManager;
import docking.test.AbstractDockingTest;
import docking.widgets.filter.FilterTextField;
import ghidra.test.DummyTool;
public class GTreeEventTest extends AbstractDockingTest {
private GTree gTree;
private FilterTextField filterField;
private DockingWindowManager winMgr;
@ -46,7 +44,7 @@ public class GTreeEventTest extends AbstractDockingTest {
root = new TestRootNode();
gTree = new GTree(root);
gTree.getModel().addTreeModelListener(new TestTreeModelListener());
filterField = (FilterTextField) gTree.getFilterField();
// filterField = (FilterTextField) gTree.getFilterField();
winMgr = new DockingWindowManager(new DummyTool(), null);
winMgr.addComponent(new TestTreeComponentProvider(gTree));
@ -60,7 +58,7 @@ public class GTreeEventTest extends AbstractDockingTest {
root.addNode(new LeafNode("ABC"));
assertEquals(1, events.size());
TreeEvent treeEvent = events.get(0);
assertEquals(EventType.STRUCTURE_CHANGED, treeEvent.eventType);
assertEquals(EventType.INSERTED, treeEvent.eventType);
}
private void waitForTree() {

View File

@ -543,7 +543,13 @@ public class GTreeTest extends AbstractDockingTest {
List<TreePath> expandedPaths = gTree.getExpandedPaths();
assertEquals(3, expandedPaths.size());
assertEquals(originalNode, expandedPaths.get(0).getLastPathComponent());
// make sure one of the expanded paths contains the originalNode
TreePath path = expandedPaths.parallelStream()
.filter(p -> p.getLastPathComponent().equals(originalNode))
.findAny()
.orElse(null);
assertTrue(path != null);
GTreeState treeState = gTree.getTreeState();