diff options
Diffstat (limited to 'tests/auto/gui/text')
-rw-r--r-- | tests/auto/gui/text/qfont/tst_qfont.cpp | 25 | ||||
-rw-r--r-- | tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 17 | ||||
-rw-r--r-- | tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp | 2 |
3 files changed, 41 insertions, 3 deletions
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 96f3b1c1d7..d722856366 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -66,6 +66,8 @@ private slots: void defaultFamily(); void toAndFromString(); void fromStringWithoutStyleName(); + void fromDegenerateString_data(); + void fromDegenerateString(); void sharing(); void familyNameWithCommaQuote_data(); @@ -539,10 +541,10 @@ void tst_QFont::defaultFamily_data() QTest::addColumn<QStringList>("acceptableFamilies"); QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif").split(",")); - QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(",")); + QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Menlo" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(",")); QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive").split(",")); QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy").split(",")); - QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << "Segoe UI" << getPlatformGenericFont("sans-serif").split(",")); + QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Helvetica" << "Roboto" << "Droid Sans" << "Segoe UI" << getPlatformGenericFont("sans-serif").split(",")); } void tst_QFont::defaultFamily() @@ -604,6 +606,25 @@ void tst_QFont::fromStringWithoutStyleName() QCOMPARE(font2.toString(), str); } +void tst_QFont::fromDegenerateString_data() +{ + QTest::addColumn<QString>("string"); + + QTest::newRow("empty") << QString(); + QTest::newRow("justAComma") << ","; + QTest::newRow("commasAndSpaces") << " , , "; + QTest::newRow("spaces") << " "; + QTest::newRow("spacesTabsAndNewlines") << " \t \n"; +} + +void tst_QFont::fromDegenerateString() +{ + QFETCH(QString, string); + QFont f; + QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*Invalid description.*")); + QCOMPARE(f.fromString(string), false); + QCOMPARE(f, QFont()); +} void tst_QFont::sharing() { diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index aee2f970fe..a474acd790 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -139,6 +139,7 @@ private slots: void superscriptCrash_qtbug53911(); void showLineAndParagraphSeparatorsCrash(); void koreanWordWrap(); + void tooManyDirectionalCharctersCrash_qtbug77819(); private: QFont testFont; @@ -2330,5 +2331,21 @@ void tst_QTextLayout::koreanWordWrap() QCOMPARE(layout.lineAt(1).textLength(), 4); } +void tst_QTextLayout::tooManyDirectionalCharctersCrash_qtbug77819() +{ + QString data; + data += QString::fromUtf8("\xe2\x81\xa8"); // U+2068 FSI character + data += QString::fromUtf8("\xe2\x81\xa7"); // U+2067 RLI character + + // duplicating the text + for (int i = 0; i < 10; i++) + data += data; + + // Nothing to test. It must not crash in beginLayout(). + QTextLayout tl(data); + tl.beginLayout(); + tl.endLayout(); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp index 8d38cbb18a..1e6c354f17 100644 --- a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp +++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp @@ -159,7 +159,7 @@ void tst_QTextMarkdownWriter::testWriteNestedBulletLists() QTextCursor cursor(document); QTextBlockFormat blockFmt = cursor.blockFormat(); if (checkbox) { - blockFmt.setMarker(checked ? QTextBlockFormat::Checked : QTextBlockFormat::Unchecked); + blockFmt.setMarker(checked ? QTextBlockFormat::MarkerType::Checked : QTextBlockFormat::MarkerType::Unchecked); cursor.setBlockFormat(blockFmt); } |