diff options
author | Andy Shaw <qt-info@nokia.com> | 2010-06-21 10:07:20 (GMT) |
---|---|---|
committer | Andy Shaw <qt-info@nokia.com> | 2010-06-21 10:07:20 (GMT) |
commit | 1fb24d6852e34bd58f35172dea4bfd4c41236689 (patch) | |
tree | 56833ba529fdd5b30cbf4da8d1287241c337bf36 /tests/auto/qtextdocument | |
parent | e271abb694c232f746b43544334667f4b3ccc1d0 (diff) | |
download | Qt-1fb24d6852e34bd58f35172dea4bfd4c41236689.zip Qt-1fb24d6852e34bd58f35172dea4bfd4c41236689.tar.gz Qt-1fb24d6852e34bd58f35172dea4bfd4c41236689.tar.bz2 |
Make sure that <br/> is seen as a valid tag in Qt::mightBeRichText()
The W3C online markup validation test verifies that <br/> is indeed
valid XHTML and <br /> is also valid so this ensures that this case is
accounted for.
The existing test was expanded to accout for each of these cases.
Task-number: QTBUG-1786
Reviewed-by: Eskil Abrahamsen Blomfeldt
Diffstat (limited to 'tests/auto/qtextdocument')
-rw-r--r-- | tests/auto/qtextdocument/tst_qtextdocument.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 51aee74..808299b 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -98,6 +98,7 @@ private slots: void noundo_isModified2(); void noundo_isModified3(); void mightBeRichText(); + void mightBeRichText_data(); void task240325(); @@ -679,13 +680,32 @@ void tst_QTextDocument::noundo_isModified3() QVERIFY(doc->isModified()); } -void tst_QTextDocument::mightBeRichText() +void tst_QTextDocument::mightBeRichText_data() { const char qtDocuHeader[] = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n" "<!DOCTYPE html\n" " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n" "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">"; QVERIFY(Qt::mightBeRichText(QString::fromLatin1(qtDocuHeader))); + QTest::addColumn<QString>("input"); + QTest::addColumn<bool>("result"); + + QTest::newRow("documentation-header") << QString("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n" + "<!DOCTYPE html\n" + " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">") + << true; + QTest::newRow("br-nospace") << QString("Test <br/> new line") << true; + QTest::newRow("br-space") << QString("Test <br /> new line") << true; + QTest::newRow("br-invalidspace") << QString("Test <br/ > new line") << false; + QTest::newRow("invalid closing tag") << QString("Test <br/ line") << false; +} + +void tst_QTextDocument::mightBeRichText() +{ + QFETCH(QString, input); + QFETCH(bool, result); + QVERIFY(result == Qt::mightBeRichText(input)); } Q_DECLARE_METATYPE(QTextDocumentFragment) |