Fix frontMatter tests: fixed fonts and testdata

When the main font is a fixed-width font, QTextMarkdownWriter generates
backticks around plain text; so QEXPECT_FAIL if we detect that.

tst_QTextMarkdownWriter::frontMatter() Compared values are not the same
   Actual   (output)                  : "---\nfoo\n---\n`bar`\n\n"
   Expected ("---\nfoo\n---\nbar\n\n")

Also, include all test data as resources for platforms that need it
(such as Android).

Task-number: QTBUG-103484
Change-Id: If18ca493c402b128cdc0fb1910b2e822512af6e8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Shawn Rutledge 2024-02-01 15:04:10 -07:00
parent bffddc6a99
commit 9fa471b72d
3 changed files with 12 additions and 7 deletions

View File

@ -12,10 +12,10 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
endif()
# Collect test data
list(APPEND test_data "data/thematicBreaks.md")
list(APPEND test_data "data/headingBulletsContinuations.md")
list(APPEND test_data "data/fuzz20450.md")
list(APPEND test_data "data/fuzz20580.md")
file(GLOB_RECURSE test_data
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
data/*
)
qt_internal_add_test(tst_qtextmarkdownimporter
SOURCES

View File

@ -12,8 +12,10 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
endif()
# Collect test data
list(APPEND test_data "data/example.md")
list(APPEND test_data "data/blockquotes.md")
file(GLOB_RECURSE test_data
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
data/*
)
qt_internal_add_test(tst_qtextmarkdownwriter
SOURCES

View File

@ -533,7 +533,10 @@ void tst_QTextMarkdownWriter::frontMatter()
document->setMetaInformation(QTextDocument::FrontMatter, "foo");
const QString output = documentToUnixMarkdown();
QCOMPARE(output, "---\nfoo\n---\nbar\n\n");
const QString expectedOutput("---\nfoo\n---\nbar\n\n");
if (output != expectedOutput && isMainFontFixed())
QEXPECT_FAIL("", "fixed-pitch main font (QTBUG-103484)", Continue);
QCOMPARE(output, expectedOutput);
}
void tst_QTextMarkdownWriter::rewriteDocument_data()