From 3f5023aada2cc2450592a5434b6d6534468429e8 Mon Sep 17 00:00:00 2001 From: Juha Vuolle Date: Tue, 22 Apr 2025 11:36:17 +0300 Subject: [PATCH] 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 --- tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp index 8f5cacae4a9..aa49e40c586 100644 --- a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp @@ -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