MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / TestCommandRow

Class TestCommandRow

tests/test_command_row.cpp:48–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48class TestCommandRow : public QObject {
49 Q_OBJECT
50
51private 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);

Callers

nothing calls this directly

Calls 1

buildSourceLabelFunction · 0.85

Tested by

no test coverage detected