Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.8.x, 5.0.0
-
None
-
9e75a4cca (dev)
Description
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.
Attachments
Issue Links
- relates to
-
QTBUG-8158 QDomDocument save reorders attributes
-
- Closed
-
-
QTBUG-76800 Option to sort attributes in QDomDocument::toString()
-
- Closed
-