| 598 | } |
| 599 | |
| 600 | void testStructFooterSimple() { |
| 601 | // Root footer is suppressed; test nested struct footer instead |
| 602 | NodeTree tree; |
| 603 | tree.baseAddress = 0; |
| 604 | |
| 605 | Node root; |
| 606 | root.kind = NodeKind::Struct; |
| 607 | root.name = "Root"; |
| 608 | root.parentId = 0; |
| 609 | int ri = tree.addNode(root); |
| 610 | uint64_t rootId = tree.nodes[ri].id; |
| 611 | |
| 612 | Node inner; |
| 613 | inner.kind = NodeKind::Struct; |
| 614 | inner.name = "Inner"; |
| 615 | inner.parentId = rootId; |
| 616 | inner.offset = 0; |
| 617 | int ii = tree.addNode(inner); |
| 618 | uint64_t innerId = tree.nodes[ii].id; |
| 619 | |
| 620 | Node f1; |
| 621 | f1.kind = NodeKind::UInt32; |
| 622 | f1.name = "a"; |
| 623 | f1.parentId = innerId; |
| 624 | f1.offset = 0; |
| 625 | tree.addNode(f1); |
| 626 | |
| 627 | NullProvider prov; |
| 628 | ComposeResult result = compose(tree, prov); |
| 629 | |
| 630 | // Find a footer line (nested struct footer) |
| 631 | int footerLine = -1; |
| 632 | for (int i = 0; i < result.meta.size(); i++) { |
| 633 | if (result.meta[i].lineKind == LineKind::Footer) { |
| 634 | footerLine = i; |
| 635 | break; |
| 636 | } |
| 637 | } |
| 638 | QVERIFY2(footerLine >= 0, "Should have a footer for nested struct"); |
| 639 | |
| 640 | // Footer text should contain "};" (no sizeof) |
| 641 | QStringList lines = result.text.split('\n'); |
| 642 | QVERIFY(lines[footerLine].contains("};")); |
| 643 | QVERIFY(!lines[footerLine].contains("sizeof")); |
| 644 | } |
| 645 | |
| 646 | void testLineMetaHasNodeId() { |
| 647 | using namespace rcx; |