summaryrefslogtreecommitdiffstats
path: root/tests/auto/xml/dom/qdom/tst_qdom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/xml/dom/qdom/tst_qdom.cpp')
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index 2ce32c7cf2..04cd0b300f 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -119,6 +119,7 @@ private slots:
void cloneDTD_QTBUG8398() const;
void DTDNotationDecl();
void DTDEntityDecl();
+ void QTBUG49113_dontCrashWithNegativeIndex() const;
void cleanupTestCase() const;
@@ -1043,15 +1044,15 @@ void tst_QDom::browseElements()
QVERIFY(!bar.isNull());
QVERIFY(bar.previousSiblingElement("bar").isNull());
QVERIFY(bar.previousSiblingElement().isNull());
- QVERIFY(bar.nextSiblingElement("bar").tagName() == "bar");
+ QCOMPARE(bar.nextSiblingElement("bar").tagName(), QLatin1String("bar"));
QVERIFY(bar.nextSiblingElement("bar").nextSiblingElement("bar").isNull());
QDomElement bop = foo.firstChildElement("bop");
QVERIFY(!bop.isNull());
- QVERIFY(bar.nextSiblingElement() == bop);
- QVERIFY(bop.nextSiblingElement("bop") == foo.lastChildElement("bop"));
- QVERIFY(bop.previousSiblingElement("bar") == foo.firstChildElement("bar"));
- QVERIFY(bop.previousSiblingElement("bar") == foo.firstChildElement());
+ QCOMPARE(bar.nextSiblingElement(), bop);
+ QCOMPARE(bop.nextSiblingElement("bop"), foo.lastChildElement("bop"));
+ QCOMPARE(bop.previousSiblingElement("bar"), foo.firstChildElement("bar"));
+ QCOMPARE(bop.previousSiblingElement("bar"), foo.firstChildElement());
}
void tst_QDom::domNodeMapAndList()
@@ -1979,5 +1980,13 @@ void tst_QDom::DTDEntityDecl()
QCOMPARE(doctype.namedItem(QString("logo")).toEntity().notationName(), QString("gif"));
}
+void tst_QDom::QTBUG49113_dontCrashWithNegativeIndex() const
+{
+ QDomDocument doc;
+ QDomElement elem = doc.appendChild(doc.createElement("root")).toElement();
+ QDomNode node = elem.attributes().item(-1);
+ QVERIFY(node.isNull());
+}
+
QTEST_MAIN(tst_QDom)
#include "tst_qdom.moc"