summaryrefslogtreecommitdiffstats
path: root/tests/auto/qxml/tst_qxml.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@nokia.com>2009-07-28 16:16:36 (GMT)
committerVolker Hilsheimer <volker.hilsheimer@nokia.com>2009-07-28 16:16:36 (GMT)
commit5c11a736367a854c3c201c31265f96e8153f20f5 (patch)
treead8b742c3738886e8083d27130b538a7048d6520 /tests/auto/qxml/tst_qxml.cpp
parentb5bcc529f67458c98571d3b726c9d173512aac27 (diff)
downloadQt-5c11a736367a854c3c201c31265f96e8153f20f5.zip
Qt-5c11a736367a854c3c201c31265f96e8153f20f5.tar.gz
Qt-5c11a736367a854c3c201c31265f96e8153f20f5.tar.bz2
Implement a copy constructor for QXmlParseException to avoid crashes when
throwing them. Autotest included. Task: 258081 Reviewed-by: Trustme
Diffstat (limited to 'tests/auto/qxml/tst_qxml.cpp')
-rw-r--r--tests/auto/qxml/tst_qxml.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qxml/tst_qxml.cpp b/tests/auto/qxml/tst_qxml.cpp
index 13de82f..1bc5ef5 100644
--- a/tests/auto/qxml/tst_qxml.cpp
+++ b/tests/auto/qxml/tst_qxml.cpp
@@ -57,6 +57,7 @@ Q_OBJECT
private slots:
void getSetCheck();
void interpretedAs0D() const;
+ void exception();
};
class MyXmlEntityResolver : public QXmlEntityResolver
@@ -213,5 +214,30 @@ void tst_QXml::interpretedAs0D() const
QCOMPARE(myHandler.attrName, QChar(0x010D) + QString::fromLatin1("reated-by"));
}
+void tst_QXml::exception()
+{
+#ifndef QT_NO_EXCEPTIONS
+ QString message = QString::fromLatin1("message");
+ int column = 3;
+ int line = 2;
+ QString publicId = QString::fromLatin1("publicId");
+ QString systemId = QString::fromLatin1("systemId");
+
+ try {
+ QXmlParseException e(message, column, line, publicId, systemId);
+ throw e;
+ }
+ catch (QXmlParseException e) {
+ QCOMPARE(e.message(), message);
+ QCOMPARE(e.columnNumber(), column);
+ QCOMPARE(e.lineNumber(), line);
+ QCOMPARE(e.publicId(), publicId);
+ QCOMPARE(e.systemId(), systemId);
+ }
+#else
+ QSKIP("Exceptions not available", SkipAll);
+#endif
+}
+
QTEST_MAIN(tst_QXml)
#include "tst_qxml.moc"