| 1978 | } |
| 1979 | |
| 1980 | void testTextIsNonEmpty() { |
| 1981 | // Verify composed text is actually generated (not empty) |
| 1982 | NodeTree tree; |
| 1983 | tree.baseAddress = 0x1000; |
| 1984 | |
| 1985 | Node root; |
| 1986 | root.kind = NodeKind::Struct; |
| 1987 | root.name = "TestStruct"; |
| 1988 | root.parentId = 0; |
| 1989 | int ri = tree.addNode(root); |
| 1990 | uint64_t rootId = tree.nodes[ri].id; |
| 1991 | |
| 1992 | // Mix of types including pointers and arrays |
| 1993 | Node f1; |
| 1994 | f1.kind = NodeKind::UInt64; |
| 1995 | f1.name = "id"; |
| 1996 | f1.parentId = rootId; |
| 1997 | f1.offset = 0; |
| 1998 | tree.addNode(f1); |
| 1999 | |
| 2000 | Node ptr; |
| 2001 | ptr.kind = NodeKind::Pointer64; |
| 2002 | ptr.name = "next"; |
| 2003 | ptr.parentId = rootId; |
| 2004 | ptr.offset = 8; |
| 2005 | tree.addNode(ptr); |
| 2006 | |
| 2007 | Node arr; |
| 2008 | arr.kind = NodeKind::Array; |
| 2009 | arr.name = "buf"; |
| 2010 | arr.parentId = rootId; |
| 2011 | arr.offset = 16; |
| 2012 | arr.elementKind = NodeKind::Hex8; |
| 2013 | arr.arrayLen = 16; |
| 2014 | arr.collapsed = true; |
| 2015 | tree.addNode(arr); |
| 2016 | |
| 2017 | NullProvider prov; |
| 2018 | ComposeResult result = compose(tree, prov); |
| 2019 | |
| 2020 | QVERIFY2(!result.text.isEmpty(), "Composed text must not be empty"); |
| 2021 | QVERIFY2(result.meta.size() >= 5, |
| 2022 | qPrintable(QString("Expected >= 5 lines, got %1").arg(result.meta.size()))); |
| 2023 | |
| 2024 | // Every line should have text content |
| 2025 | QStringList lines = result.text.split('\n'); |
| 2026 | QCOMPARE(lines.size(), result.meta.size()); |
| 2027 | for (int i = 0; i < lines.size(); i++) { |
| 2028 | QVERIFY2(!lines[i].isEmpty(), |
| 2029 | qPrintable(QString("Line %1 is empty").arg(i))); |
| 2030 | } |
| 2031 | } |
| 2032 | |
| 2033 | }; |
| 2034 | |