-
Type:
Bug
-
Status: Closed
-
Priority:
Not Evaluated
-
Resolution: Out of scope
-
Affects Version/s: 4.8.x, 5.0.0
-
Fix Version/s: None
-
Component/s: XML: DOM
-
Labels:None
tst_QDom::cloneDTD_QTBUG8398() is relying on a specific QHash ordering. It's even commented in the source:
QString dtd("<?xml version='1.0' encoding='UTF-8'?>\n" "<!DOCTYPE first [\n" "<!ENTITY secondFile SYSTEM 'second.xml'>\n" "<!ENTITY thirdFile SYSTEM 'third.xml'>\n" "]>\n" "<first/>\n"); QDomDocument domDocument; QVERIFY(domDocument.setContent(dtd)); QDomDocument domDocument2 = domDocument.cloneNode(true).toDocument(); // for some reason, our DOM implementation reverts the order of entities QString expected("<?xml version='1.0' encoding='UTF-8'?>\n" "<!DOCTYPE first [\n" "<!ENTITY thirdFile SYSTEM 'third.xml'>\n" "<!ENTITY secondFile SYSTEM 'second.xml'>\n" "]>\n" "<first/>\n"); QString output; QTextStream stream(&output); domDocument2.save(stream, 0); QCOMPARE(output, expected);
The swap happens because of the QHash usage. Changing QHash / qHash causes the test to fail.
I don't know if QHash usage inside QDom is legitimate (i.e. the ENTITY declarations may appear in any order), or it's just a wrong test.