From fb20f9c2da369b07fc50857a90b596ae63f943da Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 1 Apr 2012 18:53:55 +0100 Subject: Stop relying on QHash ordering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tst_rcc and tst_qdom rely on specific QHash orderings inside rcc and QDom respectively (see QTBUG-25078 and QTBUG-25071). A workaround is added to make them succeed: QDom checks for all possible orderings, and rcc initializes the hash seed to 0 if the QT_RCC_TEST environment variable is set. Change-Id: I5ed6b50602fceba731c797aec8dffc9cc1d6a1ce Reviewed-by: João Abecasis Reviewed-by: Robin Burchell --- tests/auto/xml/dom/qdom/tst_qdom.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tests/auto/xml/dom/qdom/tst_qdom.cpp') diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index 1533e6a139..1155cd0547 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -1792,8 +1792,15 @@ void tst_QDom::doubleNamespaceDeclarations() const QXmlInputSource source(&file); QVERIFY(doc.setContent(&source, &reader)); - QVERIFY(doc.toString(0) == QString::fromLatin1("\n\n\n") || - doc.toString(0) == QString::fromLatin1("\n\n\n")); + // tst_QDom relies on a specific QHash ordering, see QTBUG-25071 + QString docAsString = doc.toString(0); + QVERIFY(docAsString == QString::fromLatin1("\n\n\n") || + docAsString == QString::fromLatin1("\n\n\n") || + docAsString == QString::fromLatin1("\n\n\n") || + docAsString == QString::fromLatin1("\n\n\n") || + docAsString == QString::fromLatin1("\n\n\n") || + docAsString == QString::fromLatin1("\n\n\n") + ); } void tst_QDom::setContentQXmlReaderOverload() const @@ -1922,7 +1929,7 @@ void tst_QDom::cloneDTD_QTBUG8398() const QVERIFY(domDocument.setContent(dtd)); QDomDocument domDocument2 = domDocument.cloneNode(true).toDocument(); - // for some reason, our DOM implementation reverts the order of entities + // this string is relying on a specific QHash ordering, QTBUG-25071 QString expected("\n" "\n" @@ -1932,7 +1939,8 @@ void tst_QDom::cloneDTD_QTBUG8398() const QString output; QTextStream stream(&output); domDocument2.save(stream, 0); - QCOMPARE(output, expected); + // check against the original string and the expected one, QTBUG-25071 + QVERIFY(output == dtd || output == expected); } void tst_QDom::DTDNotationDecl() -- cgit v1.2.3