diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-03 05:47:55 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-04 04:27:40 (GMT) |
commit | a88dd1c5f62b5ded8ea0d76d185127ef28549c72 (patch) | |
tree | c4e4548b3461556c941252596957b9ab4433dbaf /tests/auto/qtextodfwriter | |
parent | f01e2a5024db69913aed016e2854b2589ca85080 (diff) | |
download | Qt-a88dd1c5f62b5ded8ea0d76d185127ef28549c72.zip Qt-a88dd1c5f62b5ded8ea0d76d185127ef28549c72.tar.gz Qt-a88dd1c5f62b5ded8ea0d76d185127ef28549c72.tar.bz2 |
Remove Q_ASSERT from QTextOdfWriter autotest
If the <dummy> tag can't be found in the data, return an empty string
rather than asserting, so that the test fails gracefully.
Change-Id: I536f08c9c3e942817680849d96d035999d4994db
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qtextodfwriter')
-rw-r--r-- | tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp index 997cd68..ffce9a2 100644 --- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp @@ -114,11 +114,14 @@ QString tst_QTextOdfWriter::getContentFromXml() xmlWriter->writeEndDocument(); buffer->close(); QString stringContent = QString::fromUtf8(buffer->data()); + QString ret; int index = stringContent.indexOf("<dummy"); - Q_ASSERT(index); - index = stringContent.indexOf('>', index); - stringContent = stringContent.mid(index+1, stringContent.length() - index - 10); - return stringContent; + if (index > 0) { + index = stringContent.indexOf('>', index); + if (index > 0) + ret = stringContent.mid(index+1, stringContent.length() - index - 10); + } + return ret; } void tst_QTextOdfWriter::testWriteParagraph_data() |