/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
#include <QtTest/QtTest>
-#ifdef QTEST_XMLPATTERNS
-
#include <QAbstractMessageHandler>
#include <QFileInfo>
#include <QNetworkReply>
#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
, m_pushTestsCount(0)
, m_testNetwork(true)
{
- Q_SET_DEFAULT_IAP
}
private Q_SLOTS:
+ void initTestCase();
void defaultConstructor() const;
void copyConstructor() const;
void constructorQXmlNamePool() const;
const bool m_testNetwork;
};
+void tst_QXmlQuery::initTestCase()
+{
+ QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
+}
+
void tst_QXmlQuery::checkBaseURI(const QUrl &baseURI, const QString &candidate)
{
/* The use of QFileInfo::canonicalFilePath() takes into account that drive letters
{
QTest::addColumn<QString>("inputQuery");
- const QStringList qs(queries());
-
- for(int i = 0; i < qs.size(); ++i)
+ foreach (QString const& query, queries())
{
/* This outputs a URI specific to the environment, so we can't use it for this
* particular test. */
- if(qs.at(i) != QLatin1String("staticBaseURI.xq"))
- QTest::newRow(qs.at(i).toUtf8().constData()) << qs.at(i);
+ if (query != QLatin1String("staticBaseURI.xq"))
+ QTest::newRow(query.toUtf8().constData()) << query;
}
}
query.setQuery(QLatin1String("1basicSyntaxError"));
- const QRegExp removeFilename(QLatin1String("Location: file:.*\\#"));
+ QRegExp removeFilename(QLatin1String("Location: file:.*\\#"));
QVERIFY(removeFilename.isValid());
QVERIFY(messageValidator.success());
QStringList testsToSkip;
testsToSkip << "http scheme" << "ftp scheme";
if (testsToSkip.contains(QTest::currentDataTag()))
- QSKIP("Network tests are currently unsupported on Windows CE.", SkipSingle);
+ QSKIP("Network tests are currently unsupported on Windows CE.");
#endif
QFETCH(QUrl, uriToOpen);
QStringList testsToSkip;
testsToSkip << "A valid query via the ftp scheme" << "A valid query via the http scheme";
if (testsToSkip.contains(QTest::currentDataTag()))
- QSKIP("Network tests are currently unsupported on Windows CE.", SkipSingle);
+ QSKIP("Network tests are currently unsupported on Windows CE.");
#endif
QFETCH(QUrl, queryURI);
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);
}
};
{
NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")),
QUrl(inputFileAsURI(QLatin1String(XMLPATTERNSDIR "/queries/simpleDocument.xml"))));
+ QVERIFY(networkOverrider.isValid());
QXmlQuery query;
query.setNetworkAccessManager(&networkOverrider);
{
NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")),
QUrl(inputFileAsURI(QLatin1String(XMLPATTERNSDIR "/queries/concat.xq"))));
+ QVERIFY(networkOverrider.isValid());
QXmlQuery query;
query.setNetworkAccessManager(&networkOverrider);
QTEST_MAIN(tst_QXmlQuery)
#include "tst_qxmlquery.moc"
-#else //QTEST_XMLPATTERNS
-QTEST_NOOP_MAIN
-#endif