Fix tst_qtextmarkdown compilation when textmarkdownwriter not available

Place the calls to QTextDocument::toMarkdown() behind the same feature
flag as toMarkDown() function itself.

Pick-to: 6.9 6.8
Task-number: QTBUG-136101
Change-Id: I7468f6172cab613695504d7c50075169b46c4bc9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Juha Vuolle 2025-04-22 11:36:17 +03:00
parent 262a92244b
commit 3f5023aada

View File

@ -1506,14 +1506,18 @@ void tst_QTextCursor::insertHtml()
qCDebug(lcTests) << "sel text after insertion" << cursor.selectedText();
qCDebug(lcTests) << "text after insertion" << cursor.document()->toPlainText();
qCDebug(lcTests) << "html after insertion" << cursor.document()->toHtml();
#if QT_CONFIG(textmarkdownwriter)
qCDebug(lcTests) << "markdown after insertion" << cursor.document()->toMarkdown();
#endif
QCOMPARE(cursor.selectedText(), expectedSelText);
QCOMPARE(cursor.document()->toPlainText(), expectedText);
if (auto defaultFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont); QFontInfo(defaultFont).fixedPitch()) {
qWarning() << defaultFont << "is QFontDatabase::GeneralFont, and is fixedPitch";
QSKIP("cannot reliably distinguish normal and monospace markdown spans on this system (QTBUG-103484)");
}
#if QT_CONFIG(textmarkdownwriter)
QCOMPARE(cursor.document()->toMarkdown(), expectedMarkdown);
#endif
}
#endif // QT_NO_TEXTHTMLPARSER