diff options
Diffstat (limited to 'tests/auto/qxmlstream')
-rw-r--r-- | tests/auto/qxmlstream/qc14n.h | 2 | ||||
-rw-r--r-- | tests/auto/qxmlstream/qxmlstream.pro | 4 | ||||
-rwxr-xr-x | tests/auto/qxmlstream/setupSuite.sh | 2 | ||||
-rw-r--r-- | tests/auto/qxmlstream/tst_qxmlstream.cpp | 24 |
4 files changed, 25 insertions, 7 deletions
diff --git a/tests/auto/qxmlstream/qc14n.h b/tests/auto/qxmlstream/qc14n.h index e62870e..93fa6b4 100644 --- a/tests/auto/qxmlstream/qc14n.h +++ b/tests/auto/qxmlstream/qc14n.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro index ac03d42..89d7bc1 100644 --- a/tests/auto/qxmlstream/qxmlstream.pro +++ b/tests/auto/qxmlstream/qxmlstream.pro @@ -8,4 +8,8 @@ wince*|symbian*: { addFiles.sources = data XML-Test-Suite addFiles.path = . DEPLOYMENT += addFiles + DEFINES += SRCDIR=\\\"\\\" +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" } + diff --git a/tests/auto/qxmlstream/setupSuite.sh b/tests/auto/qxmlstream/setupSuite.sh index c9e6c05..9933f61 100755 --- a/tests/auto/qxmlstream/setupSuite.sh +++ b/tests/auto/qxmlstream/setupSuite.sh @@ -1,7 +1,7 @@ #!/bin/sh ############################################################################# ## -## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index e28d933..6aa9955 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -57,7 +57,7 @@ Q_DECLARE_METATYPE(QXmlStreamReader::ReadElementTextBehaviour) -static const char *const catalogFile = "XML-Test-Suite/xmlconf/finalCatalog.xml"; +static const char *const catalogFile = SRCDIR "XML-Test-Suite/xmlconf/finalCatalog.xml"; static const int expectedRunCount = 1646; static const int expectedSkipCount = 532; @@ -559,6 +559,7 @@ private slots: void hasAttributeSignature() const; void hasAttribute() const; void writeWithCodec() const; + void writeWithUtf8Codec() const; void writeWithStandalone() const; void entitiesAndWhitespace_1() const; void entitiesAndWhitespace_2() const; @@ -803,7 +804,7 @@ void tst_QXmlStream::testReader_data() const QTest::addColumn<QString>("xml"); QTest::addColumn<QString>("ref"); QDir dir; - dir.cd("data/"); + dir.cd(SRCDIR "data/"); foreach(QString filename , dir.entryList(QStringList() << "*.xml")) { QString reference = QFileInfo(filename).baseName() + ".ref"; QTest::newRow(dir.filePath(filename).toLatin1().data()) << dir.filePath(filename) << dir.filePath(reference); @@ -1182,7 +1183,7 @@ void tst_QXmlStream::crashInUTF16Codec() const QEventLoop eventLoop; QNetworkAccessManager networkManager; - QNetworkRequest request(QUrl::fromLocalFile(QLatin1String("data/051reduced.xml"))); + QNetworkRequest request(QUrl::fromLocalFile(QLatin1String(SRCDIR "data/051reduced.xml"))); QNetworkReply *const reply = networkManager.get(request); eventLoop.connect(reply, SIGNAL(finished()), SLOT(quit())); @@ -1303,7 +1304,6 @@ void tst_QXmlStream::hasAttribute() const void tst_QXmlStream::writeWithCodec() const { - QByteArray outarray; QXmlStreamWriter writer(&outarray); writer.setAutoFormatting(true); @@ -1326,6 +1326,20 @@ void tst_QXmlStream::writeWithCodec() const QVERIFY(outarray.contains(codec->name())); } +void tst_QXmlStream::writeWithUtf8Codec() const +{ + QByteArray outarray; + QXmlStreamWriter writer(&outarray); + + QTextCodec *codec = QTextCodec::codecForMib(106); // utf-8 + QVERIFY(codec); + writer.setCodec(codec); + + writer.writeStartDocument("1.0"); + static const char begin[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; + QVERIFY(outarray.startsWith(begin)); +} + void tst_QXmlStream::writeWithStandalone() const { { |