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

Method testPaddingValueEditIsBlocked

tests/test_controller.cpp:286–324  ·  view source on GitHub ↗

── Test: Padding value edit is effectively blocked at controller level ──

Source from the content-addressed store, hash-verified

284
285 // ── Test: Padding value edit is effectively blocked at controller level ──
286 void testPaddingValueEditIsBlocked() {
287 // Find the padding node
288 int padIdx = -1;
289 for (int i = 0; i < m_doc->tree.nodes.size(); i++) {
290 if (m_doc->tree.nodes[i].kind == NodeKind::Padding) { padIdx = i; break; }
291 }
292 QVERIFY(padIdx >= 0);
293 uint64_t addr = m_doc->tree.computeOffset(padIdx);
294
295 // Read original data at padding offset
296 int padSize = m_doc->tree.nodes[padIdx].byteSize();
297 QByteArray origData = m_doc->provider->readBytes(addr, padSize);
298
299 // The context menu blocks Padding editing, so the controller's setNodeValue
300 // would only be called if the editing UI somehow allows it. But let's verify
301 // the editor correctly blocks it.
302 // Find padding line in composed output
303 ComposeResult result = m_doc->compose();
304 int paddingLine = -1;
305 for (int i = 0; i < result.meta.size(); i++) {
306 if (result.meta[i].nodeKind == NodeKind::Padding &&
307 result.meta[i].lineKind == LineKind::Field) {
308 paddingLine = i;
309 break;
310 }
311 }
312 QVERIFY(paddingLine >= 0);
313
314 m_editor->applyDocument(result);
315 QApplication::processEvents();
316
317 // beginInlineEdit(Value) on Padding line must be rejected
318 QVERIFY(!m_editor->beginInlineEdit(EditTarget::Value, paddingLine));
319 QVERIFY(!m_editor->isEditing());
320
321 // Data must be unchanged
322 QByteArray afterData = m_doc->provider->readBytes(addr, padSize);
323 QCOMPARE(afterData, origData);
324 }
325
326 // ── Test: setNodeValue with Hex32 (space-separated hex bytes) ──
327 void testSetNodeValueHex() {

Callers

nothing calls this directly

Calls 8

computeOffsetMethod · 0.80
byteSizeMethod · 0.80
readBytesMethod · 0.80
composeMethod · 0.80
applyDocumentMethod · 0.80
beginInlineEditMethod · 0.80
isEditingMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected