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)bb10
parent
c0372871f8
commit
fd714ec5aa
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue