diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-01 15:04:10 -0700 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-02 20:14:45 -0700 |
commit | 9fa471b72d8ac7fb1f5b2020463dac2340e1a963 (patch) | |
tree | d3c0d4979d3924ed9f51b55ddd606955915a6077 /tests/auto/gui | |
parent | bffddc6a993c4b6b64922e8d327bdf32e0d4975a (diff) |
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>
Diffstat (limited to 'tests/auto/gui')
3 files changed, 12 insertions, 7 deletions
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/CMakeLists.txt b/tests/auto/gui/text/qtextmarkdownimporter/CMakeLists.txt index 1b13d23d30..937dd5bd80 100644 --- a/tests/auto/gui/text/qtextmarkdownimporter/CMakeLists.txt +++ b/tests/auto/gui/text/qtextmarkdownimporter/CMakeLists.txt @@ -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 diff --git a/tests/auto/gui/text/qtextmarkdownwriter/CMakeLists.txt b/tests/auto/gui/text/qtextmarkdownwriter/CMakeLists.txt index 1d56f8e530..0cdf1d9225 100644 --- a/tests/auto/gui/text/qtextmarkdownwriter/CMakeLists.txt +++ b/tests/auto/gui/text/qtextmarkdownwriter/CMakeLists.txt @@ -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 diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp index 71c4588a6a..ab913cf41f 100644 --- a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp +++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp @@ -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() |