summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-03 15:47:55 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:46:43 +1000
commitfd714ec5aa3418b55c7c8bf7d77cbdb2a6798135 (patch)
tree75dd895fd0b3a5dbbeccf84301a6e8d3f0ac6a19 /tests/auto
parentc0372871f8f8493ac1b59b800caed4b55d1c9b6f (diff)
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 (cherry picked from commit a88dd1c5f62b5ded8ea0d76d185127ef28549c72)
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
index 997cd683c5..ffce9a21eb 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()