Don't use the QRegExp methods that modify the object
[profile/ivi/qtxmlpatterns.git] / tests / auto / qxmlquery / tst_qxmlquery.cpp
index 60bf4bd..1b5d424 100644 (file)
@@ -1,7 +1,6 @@
 /****************************************************************************
 **
 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
 ** Contact: http://www.qt-project.org/
 **
 ** This file is part of the test suite of the Qt Toolkit.
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
 #include "TestFundament.h"
 #include "../network-settings.h"
 
-#if defined(Q_OS_SYMBIAN)
-#define SRCDIR ""
-#define XMLPATTERNSDIR "xmlpatterns"
-#else
 #define XMLPATTERNSDIR SRCDIR "../xmlpatterns"
-#endif
 
 /*!
  \class tst_QXmlQuery
@@ -1733,7 +1728,7 @@ void tst_QXmlQuery::messageXML() const
 
     query.setQuery(QLatin1String("1basicSyntaxError"));
 
-    const QRegExp removeFilename(QLatin1String("Location: file:.*\\#"));
+    QRegExp removeFilename(QLatin1String("Location: file:.*\\#"));
     QVERIFY(removeFilename.isValid());
 
     QVERIFY(messageValidator.success());
@@ -2880,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);
         }
     };