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

Method testHeaderLineEdit

tests/test_editor.cpp:498–534  ·  view source on GitHub ↗

── Test: edit on header line (Name and Type valid, Value invalid) ──

Source from the content-addressed store, hash-verified

496
497 // ── Test: edit on header line (Name and Type valid, Value invalid) ──
498 void testHeaderLineEdit() {
499 m_editor->applyDocument(m_result);
500
501 // Root header is suppressed; find a nested struct header (e.g. CSDVersion)
502 int headerLine = -1;
503 for (int i = 0; i < m_result.meta.size(); i++) {
504 if (m_result.meta[i].lineKind == LineKind::Header &&
505 m_result.meta[i].foldHead) {
506 headerLine = i;
507 break;
508 }
509 }
510 QVERIFY2(headerLine >= 0, "Should have a nested struct header");
511
512 const LineMeta* lm = m_editor->metaForLine(headerLine);
513 QVERIFY(lm);
514 QCOMPARE(lm->lineKind, LineKind::Header);
515
516 // Scroll to header line to ensure visibility
517 m_editor->scintilla()->SendScintilla(
518 QsciScintillaBase::SCI_ENSUREVISIBLE, (unsigned long)headerLine);
519 m_editor->scintilla()->SendScintilla(
520 QsciScintillaBase::SCI_GOTOLINE, (unsigned long)headerLine);
521 QApplication::processEvents();
522
523 // Type edit on header should succeed (emits popup signal, not inline edit)
524 QSignalSpy typeSpy(m_editor, &RcxEditor::typePickerRequested);
525 bool ok = m_editor->beginInlineEdit(EditTarget::Type, headerLine);
526 QVERIFY(ok);
527 QCOMPARE(typeSpy.count(), 1);
528
529 // Name edit on header should succeed
530 ok = m_editor->beginInlineEdit(EditTarget::Name, headerLine);
531 QVERIFY(ok);
532 QVERIFY(m_editor->isEditing());
533 m_editor->cancelInlineEdit();
534 }
535
536 // ── Test: footer line rejects all edits ──
537 void testFooterLineEdit() {

Callers

nothing calls this directly

Calls 7

applyDocumentMethod · 0.80
metaForLineMethod · 0.80
scintillaMethod · 0.80
beginInlineEditMethod · 0.80
isEditingMethod · 0.80
cancelInlineEditMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected