summaryrefslogtreecommitdiffstats
path: root/tests/auto/xml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/xml')
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index 38d2d76272..aa9e92b0a9 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -126,6 +126,7 @@ private slots:
void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const;
void cloneDTD_QTBUG8398() const;
void DTDNotationDecl();
+ void DTDEntityDecl();
void cleanupTestCase() const;
@@ -1947,5 +1948,29 @@ void tst_QDom::DTDNotationDecl()
QCOMPARE(doctype.namedItem(QString("jpeg")).toNotation().systemId(), QString("image/jpeg"));
}
+void tst_QDom::DTDEntityDecl()
+{
+ QString dtd("<?xml version='1.0' encoding='UTF-8'?>\n"
+ "<!DOCTYPE first [\n"
+ "<!ENTITY secondFile SYSTEM 'second.xml'>\n"
+ "<!ENTITY logo SYSTEM \"http://www.w3c.org/logo.gif\" NDATA gif>"
+ "]>\n"
+ "<first/>\n");
+
+ QDomDocument domDocument;
+ QVERIFY(domDocument.setContent(dtd));
+
+ const QDomDocumentType doctype = domDocument.doctype();
+ QCOMPARE(doctype.entities().count(), 2);
+
+ QVERIFY(doctype.namedItem(QString("secondFile")).isEntity());
+ QCOMPARE(doctype.namedItem(QString("secondFile")).toEntity().systemId(), QString("second.xml"));
+ QCOMPARE(doctype.namedItem(QString("secondFile")).toEntity().notationName(), QString());
+
+ QVERIFY(doctype.namedItem(QString("logo")).isEntity());
+ QCOMPARE(doctype.namedItem(QString("logo")).toEntity().systemId(), QString("http://www.w3c.org/logo.gif"));
+ QCOMPARE(doctype.namedItem(QString("logo")).toEntity().notationName(), QString("gif"));
+}
+
QTEST_MAIN(tst_QDom)
#include "tst_qdom.moc"