| 46 | } |
| 47 | |
| 48 | class TestCommandRow : public QObject { |
| 49 | Q_OBJECT |
| 50 | |
| 51 | private slots: |
| 52 | |
| 53 | // --------------------------------------------------------------- |
| 54 | // Source label text |
| 55 | // --------------------------------------------------------------- |
| 56 | |
| 57 | void label_nullProvider_showsSelectSource() { |
| 58 | NullProvider p; |
| 59 | QCOMPARE(buildSourceLabel(p), QStringLiteral("source\u25BE")); |
| 60 | } |
| 61 | |
| 62 | void label_bufferNoName_showsSelectSource() { |
| 63 | // BufferProvider with empty name also triggers source▾ |
| 64 | BufferProvider p(QByteArray(4, '\0')); |
| 65 | QCOMPARE(buildSourceLabel(p), QStringLiteral("source\u25BE")); |
| 66 | } |
| 67 | |
| 68 | void label_bufferWithName_showsFileAndName() { |
| 69 | BufferProvider p(QByteArray(4, '\0'), "dump.bin"); |
| 70 | QCOMPARE(buildSourceLabel(p), QStringLiteral("'dump.bin'\u25BE")); |
| 71 | } |
| 72 | |
| 73 | // --------------------------------------------------------------- |
| 74 | // Full command row text |
| 75 | // --------------------------------------------------------------- |
| 76 | |
| 77 | void row_nullProvider() { |
| 78 | NullProvider p; |
| 79 | QString row = buildCommandRow(p, 0); |
| 80 | QCOMPARE(row, QStringLiteral(" source\u25BE \u00B7 0x0")); |
| 81 | } |
| 82 | |
| 83 | void row_fileProvider() { |
| 84 | BufferProvider p(QByteArray(4, '\0'), "test.bin"); |
| 85 | QString row = buildCommandRow(p, 0x140000000ULL); |
| 86 | QCOMPARE(row, QStringLiteral(" 'test.bin'\u25BE \u00B7 0x140000000")); |
| 87 | } |
| 88 | |
| 89 | // --------------------------------------------------------------- |
| 90 | // Source span parsing |
| 91 | // --------------------------------------------------------------- |
| 92 | |
| 93 | void span_selectSource() { |
| 94 | QString row = buildCommandRow(NullProvider{}, 0); |
| 95 | auto span = commandRowSrcSpan(row); |
| 96 | QVERIFY(span.valid); |
| 97 | QString extracted = row.mid(span.start, span.end - span.start); |
| 98 | QCOMPARE(extracted, QStringLiteral("source")); |
| 99 | } |
| 100 | |
| 101 | void span_fileProvider() { |
| 102 | BufferProvider p(QByteArray(4, '\0'), "dump.bin"); |
| 103 | QString row = buildCommandRow(p, 0x140000000ULL); |
| 104 | auto span = commandRowSrcSpan(row); |
| 105 | QVERIFY(span.valid); |
nothing calls this directly
no test coverage detected