mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
fixed bug in organization nodes when inserting into mixed case groups
This commit is contained in:
parent
2fcf0d21bf
commit
aa86f74b98
2 changed files with 32 additions and 1 deletions
|
@ -300,7 +300,7 @@ public class OrganizationNode extends SymbolTreeNode {
|
|||
public int compareTo(GTreeNode node) {
|
||||
if (!(node instanceof OrganizationNode)) {
|
||||
String nodeName = node.getName();
|
||||
if (nodeName.regionMatches(true, 0, baseName, 0, baseName.length())) {
|
||||
if (nodeName.regionMatches(false, 0, baseName, 0, baseName.length())) {
|
||||
// Consider this node equal to the org node, as the symbol node will be a child
|
||||
// of this org node. This allows us to quickly search for the parent of any
|
||||
// given symbol node.
|
||||
|
|
|
@ -84,6 +84,37 @@ public class OrganizationNodeTest extends AbstractDockingTest {
|
|||
assertEquals("CAF", caGroup.getChild(5).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsertNodeMixedCase() {
|
||||
List<GTreeNode> nodeList = nodes("Aaa", "AAa", "Aab", "AAb", "AAc", "Aac", "AAd", "Aad",
|
||||
"AAe", "Aae", "AAf", "Aaf", "Z");
|
||||
List<GTreeNode> result = organize(nodeList, 3);
|
||||
// this in two nodes, the group starting with "A" and the node "Z" (Z) was added so that
|
||||
// an "A" group would be a top level group
|
||||
|
||||
OrganizationNode groupA = (OrganizationNode) result.get(0);
|
||||
assertEquals("A", groupA.getName());
|
||||
|
||||
assertEquals(2, groupA.getChildCount());
|
||||
OrganizationNode groupAa = (OrganizationNode) groupA.getChild(0);
|
||||
OrganizationNode groupAA = (OrganizationNode) groupA.getChild(1);
|
||||
assertEquals("Aa", groupAa.getName());
|
||||
assertEquals("AA", groupAA.getName());
|
||||
assertEquals(6, groupAa.getChildCount());
|
||||
assertEquals(6, groupAA.getChildCount());
|
||||
|
||||
groupA.insertNode(node("AAaz"));
|
||||
// node should be added to AA group
|
||||
assertEquals(6, groupAa.getChildCount());
|
||||
assertEquals(7, groupAA.getChildCount());
|
||||
|
||||
groupA.insertNode(node("Aaaz"));
|
||||
// node should be added to Aa group
|
||||
assertEquals(7, groupAa.getChildCount());
|
||||
assertEquals(7, groupAA.getChildCount());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManySameLabels() {
|
||||
List<GTreeNode> nodeList =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue