summaryrefslogtreecommitdiffstats
path: root/tests/auto/qxmlstream
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qxmlstream')
-rw-r--r--tests/auto/qxmlstream/qc14n.h37
-rw-r--r--tests/auto/qxmlstream/tst_qxmlstream.cpp20
2 files changed, 25 insertions, 32 deletions
diff --git a/tests/auto/qxmlstream/qc14n.h b/tests/auto/qxmlstream/qc14n.h
index bf8090888d..661ddeefaa 100644
--- a/tests/auto/qxmlstream/qc14n.h
+++ b/tests/auto/qxmlstream/qc14n.h
@@ -47,17 +47,9 @@ QT_FORWARD_DECLARE_CLASS(QString)
class QC14N
{
public:
- enum Option
- {
- IgnoreProcessingInstruction,
- IgnoreComments
- };
- typedef QFlags<Option> Options;
-
static bool isEqual(QIODevice *const firstDocument,
QIODevice *const secondDocument,
- QString *const message = 0,
- const Options options = Options());
+ QString *const message = 0);
private:
static bool isDifferent(const QXmlStreamReader &r1,
@@ -76,20 +68,17 @@ private:
*/
bool QC14N::isEqual(QIODevice *const firstDocument,
QIODevice *const secondDocument,
- QString *const message,
- const Options options)
+ QString *const message)
{
qDebug() << Q_FUNC_INFO;
- Q_ASSERT_X(firstDocument, Q_FUNC_INFO,
- "A valid QIODevice pointer must be supplied");
- Q_ASSERT_X(secondDocument, Q_FUNC_INFO,
- "A valid QIODevice pointer must be supplied");
- Q_ASSERT_X(firstDocument->isReadable(), Q_FUNC_INFO, "The device must be readable.");
- Q_ASSERT_X(secondDocument->isReadable(), Q_FUNC_INFO, "The device must be readable.");
-
- Q_ASSERT_X(options == Options(), Q_FUNC_INFO,
- "Not yet implemented.");
- Q_UNUSED(options);
+ if (!firstDocument)
+ qFatal("%s: A valid firstDocument QIODevice pointer must be supplied", Q_FUNC_INFO);
+ if (!secondDocument)
+ qFatal("%s: A valid secondDocument QIODevice pointer must be supplied", Q_FUNC_INFO);
+ if (!firstDocument->isReadable())
+ qFatal("%s: The firstDocument device must be readable.", Q_FUNC_INFO);
+ if (!secondDocument->isReadable())
+ qFatal("%s: The secondDocument device must be readable.", Q_FUNC_INFO);
QXmlStreamReader r1(firstDocument);
QXmlStreamReader r2(secondDocument);
@@ -202,9 +191,9 @@ bool QC14N::isDifferent(const QXmlStreamReader &r1,
r2.processingInstructionData() == r2.processingInstructionData();
}
+ default:
+ qFatal("%s: Unknown tokenType: %d", Q_FUNC_INFO, static_cast<int>(r1.tokenType()));
+ return false;
}
-
- Q_ASSERT_X(false, Q_FUNC_INFO, "This line should never be reached");
- return false;
}
diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp
index fd2f90e47f..946a19ad70 100644
--- a/tests/auto/qxmlstream/tst_qxmlstream.cpp
+++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp
@@ -221,8 +221,7 @@ static QString documentElement(const QByteArray &document)
reader.readNext();
}
- Q_ASSERT_X(false, Q_FUNC_INFO,
- qPrintable(QString::fromLatin1("The input %1 didn't contain an element.").arg(QString::fromUtf8(document.constData()))));
+ qFatal("The input %s didn't contain an element", document.constData());
return QString();
}
@@ -265,7 +264,8 @@ public:
expected(aExpected),
output(aOutput)
{
- Q_ASSERT(!aId.isEmpty());
+ if (aId.isEmpty())
+ qFatal("%s: aId must not be an empty string", Q_FUNC_INFO);
}
QString id;
@@ -289,7 +289,8 @@ public:
TestSuiteHandler(const QUrl &baseURI) : runCount(0),
skipCount(0)
{
- Q_ASSERT(baseURI.isValid());
+ if (!baseURI.isValid())
+ qFatal("%s: baseURI must be valid", Q_FUNC_INFO);
m_baseURI.push(baseURI);
}
@@ -461,7 +462,7 @@ public:
}
else
{
- Q_ASSERT_X(false, Q_FUNC_INFO, "The input catalog is invalid.");
+ qFatal("The input catalog is invalid.");
return false;
}
}
@@ -481,9 +482,12 @@ public:
static bool isWellformed(QIODevice *const inputFile, const ParseMode mode)
{
- Q_ASSERT(inputFile);
- Q_ASSERT_X(inputFile->isOpen(), Q_FUNC_INFO, "The caller is responsible for opening the device.");
- Q_ASSERT(mode == ParseIncrementally || mode == ParseSinglePass);
+ if (!inputFile)
+ qFatal("%s: inputFile must be a valid QIODevice pointer", Q_FUNC_INFO);
+ if (!inputFile->isOpen())
+ qFatal("%s: inputFile must be opened by the caller", Q_FUNC_INFO);
+ if (mode != ParseIncrementally && mode != ParseSinglePass)
+ qFatal("%s: mode must be either ParseIncrementally or ParseSinglePass", Q_FUNC_INFO);
if(mode == ParseIncrementally)
{