diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2012-02-22 15:31:27 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-23 10:22:54 +0100 |
commit | 9f18ef6613e6babd64183601e75424aeb27e3560 (patch) | |
tree | 2ae0af25e651145657c3c2367f75e5283359735c /tests | |
parent | b09a7971daeea7e42af2f4f5ae3a12b29c1692e2 (diff) | |
download | qtxmlpatterns-9f18ef6613e6babd64183601e75424aeb27e3560.tar.gz |
Windows: Fix local file URLs in two autotests
QUrl has been made more stricter when it comes to local files, so
just giving an absolute path with drive letter as URL is not going to
work anymore, as the drive letter will be interpreted as scheme.
Fixed two failing cases related to this issue to use proper URLs.
Task-number: QTBUG-24446
Change-Id: I63afd6b5fd8531bc347316b5dbfc19e4ad7f8115
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qxmlquery/tst_qxmlquery.cpp | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp b/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp index 3c8a2ec..3d2369d 100644 --- a/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp +++ b/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp @@ -183,7 +183,7 @@ void tst_QAbstractXmlNodeModel::nextFromSimpleAxis() { QXmlQuery openDoc(m_namePool); const QString testFilePath = QDir::currentPath() + QLatin1Char('/') + QLatin1String(testFileName); - openDoc.bindVariable(QLatin1String("docURI"), QVariant(testFilePath)); + openDoc.bindVariable(QLatin1String("docURI"), QVariant(QUrl::fromLocalFile(testFilePath))); openDoc.setQuery(QLatin1String("doc($docURI)")); QXmlResultItems doc; QVERIFY(openDoc.isValid()); diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 27f3964..372bcdb 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -2875,7 +2875,15 @@ void tst_QXmlQuery::useUriResolver() const const QUrl &baseURI) const { Q_UNUSED(relative); - return baseURI.resolved(inputFile(QLatin1String(queriesDirectory) + QLatin1String("simpleDocument.xml"))); + QString fixedInputFile = inputFile(QLatin1String(queriesDirectory) + QLatin1String("simpleDocument.xml")); +#ifdef Q_OS_WIN + // A file path with drive letter is not a valid relative URI, so remove the drive letter. + // Note that can't just use inputFileAsURI() instead of inputFile() as that doesn't + // produce a relative URI either. + if (fixedInputFile.size() > 1 && fixedInputFile.at(1) == QLatin1Char(':')) + fixedInputFile.remove(0, 2); +#endif + return baseURI.resolved(fixedInputFile); } }; |