summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-07-17 23:31:36 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2010-07-17 23:31:36 (GMT)
commit8d545a21b6aa89675b404a9d7bf08b7499d26e5e (patch)
tree761c900e05538a337517435d5337392f7fc8931d /tests
parent571b85896ee3663479b4a10d2418e2e19b3639f3 (diff)
parentd61c74faef2ed787aacc53c03b8361fa57bccc8e (diff)
downloadQt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.zip
Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.tar.gz
Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.tar.bz2
Merge remote branch 'origin/4.7' into 4.7-from-4.6
Conflicts: tests/auto/qtexttable/tst_qtexttable.cpp
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp24
-rw-r--r--tests/auto/gui.pro1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp27
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result13
-rw-r--r--tests/auto/mediaobject/tst_mediaobject.cpp3
-rw-r--r--tests/auto/network.pro2
-rw-r--r--tests/auto/qauthenticator/qauthenticator.pro5
-rw-r--r--tests/auto/qauthenticator/tst_qauthenticator.cpp155
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/qmake/testdata/simple_app/build/README1
-rw-r--r--tests/auto/qmake/testdata/simple_app/simple_app.pro1
-rw-r--r--tests/auto/qmake/testdata/simple_app/test.qrc5
-rw-r--r--tests/auto/qmake/tst_qmake.cpp16
-rw-r--r--tests/auto/qmimedata/qmimedata.pro4
-rw-r--r--tests/auto/qmimedata/tst_qmimedata.cpp343
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp29
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp4
-rw-r--r--tests/auto/qscrollbar/tst_qscrollbar.cpp2
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp24
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp4
-rw-r--r--tests/auto/qtexttable/tst_qtexttable.cpp57
-rw-r--r--tests/auto/quuid/quuid.pro9
-rw-r--r--tests/auto/quuid/test/test.pro29
-rw-r--r--tests/auto/quuid/testProcessUniqueness/main.cpp62
-rw-r--r--tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro8
-rw-r--r--tests/auto/quuid/tst_quuid.cpp29
26 files changed, 837 insertions, 22 deletions
diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
index b08da0f..de8d222 100644
--- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
+++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
@@ -152,16 +152,16 @@ void tst_QDeclarativeViewer::loading()
TEST_INITIAL_SIZES(viewer);
- viewer->resize(QSize(400, 500));
+ viewer->resize(QSize(250, 350));
qApp->processEvents();
// window resized
- QTRY_COMPARE(rootItem->width(), 400.0);
- QTRY_COMPARE(rootItem->height(), 500.0 - MENUBAR_HEIGHT(viewer));
- QCOMPARE(viewer->view()->size(), QSize(400, 500 - MENUBAR_HEIGHT(viewer)));
+ QTRY_COMPARE(rootItem->width(), 250.0);
+ QTRY_COMPARE(rootItem->height(), 350.0 - MENUBAR_HEIGHT(viewer));
+ QCOMPARE(viewer->view()->size(), QSize(250, 350 - MENUBAR_HEIGHT(viewer)));
QCOMPARE(viewer->view()->initialSize(), QSize(200, 300));
- QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500 - MENUBAR_HEIGHT(viewer)));
- QCOMPARE(viewer->size(), QSize(400, 500));
+ QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350 - MENUBAR_HEIGHT(viewer)));
+ QCOMPARE(viewer->size(), QSize(250, 350));
QCOMPARE(viewer->size(), viewer->sizeHint());
viewer->reload();
@@ -177,16 +177,16 @@ void tst_QDeclarativeViewer::loading()
QCOMPARE(viewer->size(), QSize(200, 300 + MENUBAR_HEIGHT(viewer)));
QCOMPARE(viewer->size(), viewer->sizeHint());
- viewer->resize(QSize(400, 500));
+ viewer->resize(QSize(250, 350));
qApp->processEvents();
// window resized again
- QTRY_COMPARE(rootItem->width(), 400.0);
- QTRY_COMPARE(rootItem->height(), 500.0 - MENUBAR_HEIGHT(viewer));
- QCOMPARE(viewer->view()->size(), QSize(400, 500 - MENUBAR_HEIGHT(viewer)));
+ QTRY_COMPARE(rootItem->width(), 250.0);
+ QTRY_COMPARE(rootItem->height(), 350.0 - MENUBAR_HEIGHT(viewer));
+ QCOMPARE(viewer->view()->size(), QSize(250, 350 - MENUBAR_HEIGHT(viewer)));
QCOMPARE(viewer->view()->initialSize(), QSize(200, 300));
- QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500 - MENUBAR_HEIGHT(viewer)));
- QCOMPARE(viewer->size(), QSize(400, 500));
+ QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350 - MENUBAR_HEIGHT(viewer)));
+ QCOMPARE(viewer->size(), QSize(250, 350));
QCOMPARE(viewer->size(), viewer->sizeHint());
viewer->open(SRCDIR "/data/orientation.qml");
diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro
index cfaa3fa..2d9ea93 100644
--- a/tests/auto/gui.pro
+++ b/tests/auto/gui.pro
@@ -112,6 +112,7 @@ SUBDIRS=\
qmdisubwindow \
qmessagebox \
qmetaobject \
+ qmimedata \
qmouseevent_modal \
qmovie \
qnetworkaccessmanager_and_qprogressdialog \
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index 0765bfc..f58f932 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -275,3 +275,30 @@ void bogosity()
// no spaces here. test collateral damage from ignoring equal sign
Class::member=QObject::tr("just QObject");
}
+
+
+
+namespace Internal {
+
+class Message : public QObject
+{
+ Q_OBJECT
+public:
+ Message(QObject *parent = 0);
+};
+
+} // The temporary closing of the namespace triggers the problem
+
+namespace Internal {
+
+static inline QString message1()
+{
+ return Message::tr("message1"); // Had no namespace
+}
+
+static inline QString message2()
+{
+ return Message::tr("message2"); // Already had namespace
+}
+
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index 208191d..7ac318e 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -120,6 +120,19 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
+ <name>Internal::Message</name>
+ <message>
+ <location filename="main.cpp" line="296"/>
+ <source>message1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="301"/>
+ <source>message2</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>Kåntekst</name>
<message utf8="true">
<location filename="finddialog.cpp" line="180"/>
diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp
index 994057b..2f98521 100644
--- a/tests/auto/mediaobject/tst_mediaobject.cpp
+++ b/tests/auto/mediaobject/tst_mediaobject.cpp
@@ -204,9 +204,8 @@ void tst_MediaObject::testPlayFromResource()
#ifdef Q_OS_SYMBIAN
QSKIP("Not implemented yet.", SkipAll);
#else
- QFile file(MEDIA_FILEPATH);
MediaObject media;
- media.setCurrentSource(&file);
+ media.setCurrentSource(QString(MEDIA_FILEPATH));
QVERIFY(media.state() != Phonon::ErrorState);
if (media.state() != Phonon::StoppedState)
QTest::waitForSignal(&media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000);
diff --git a/tests/auto/network.pro b/tests/auto/network.pro
index 4f205fe..e1898f1 100644
--- a/tests/auto/network.pro
+++ b/tests/auto/network.pro
@@ -7,6 +7,7 @@ SUBDIRS=\
networkselftest \
qabstractnetworkcache \
qabstractsocket \
+ qauthenticator \
qeventloop \
qftp \
qhostaddress \
@@ -36,6 +37,7 @@ SUBDIRS=\
qsslsocket \
contains(QT_CONFIG, private_tests): SUBDIRS -= \
+ qauthenticator \
qhttpnetworkconnection \
qhttpnetworkreply \
qnativesocketengine \
diff --git a/tests/auto/qauthenticator/qauthenticator.pro b/tests/auto/qauthenticator/qauthenticator.pro
new file mode 100644
index 0000000..05f83bc
--- /dev/null
+++ b/tests/auto/qauthenticator/qauthenticator.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+requires(contains(QT_CONFIG,private_tests))
+QT = core network
+SOURCES += tst_qauthenticator.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/qauthenticator/tst_qauthenticator.cpp b/tests/auto/qauthenticator/tst_qauthenticator.cpp
new file mode 100644
index 0000000..37d6774
--- /dev/null
+++ b/tests/auto/qauthenticator/tst_qauthenticator.cpp
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** 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.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+#include <QtCore/QCoreApplication>
+#include <QtNetwork/QAuthenticator>
+
+#include <private/qauthenticator_p.h>
+
+class tst_QAuthenticator : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QAuthenticator();
+
+private Q_SLOTS:
+ void basicAuth();
+ void basicAuth_data();
+
+ void ntlmAuth_data();
+ void ntlmAuth();
+};
+
+tst_QAuthenticator::tst_QAuthenticator()
+{
+}
+
+void tst_QAuthenticator::basicAuth_data()
+{
+ QTest::addColumn<QString>("data");
+ QTest::addColumn<QString>("realm");
+ QTest::addColumn<QString>("user");
+ QTest::addColumn<QString>("password");
+ QTest::addColumn<QByteArray>("expectedReply");
+
+ QTest::newRow("just-user") << "" << "" << "foo" << "" << QByteArray("foo:").toBase64();
+ QTest::newRow("user-password") << "" << "" << "foo" << "bar" << QByteArray("foo:bar").toBase64();
+ QTest::newRow("user-password-realm") << "realm=\"secure area\"" << "secure area" << "foo" << "bar" << QByteArray("foo:bar").toBase64();
+}
+
+void tst_QAuthenticator::basicAuth()
+{
+ QFETCH(QString, data);
+ QFETCH(QString, realm);
+ QFETCH(QString, user);
+ QFETCH(QString, password);
+ QFETCH(QByteArray, expectedReply);
+
+ QAuthenticator auth;
+ auth.detach();
+ QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(auth);
+ QVERIFY(priv->phase == QAuthenticatorPrivate::Start);
+
+ QList<QPair<QByteArray, QByteArray> > headers;
+ headers << qMakePair(QByteArray("WWW-Authenticate"), "Basic " + data.toUtf8());
+ priv->parseHttpResponse(headers, /*isProxy = */ false);
+
+ QCOMPARE(auth.realm(), realm);
+ QCOMPARE(auth.option("realm").toString(), realm);
+
+ auth.setUser(user);
+ auth.setPassword(password);
+
+ QVERIFY(priv->phase == QAuthenticatorPrivate::Start);
+
+ QCOMPARE(priv->calculateResponse("GET", "/").constData(), ("Basic " + expectedReply).constData());
+}
+
+void tst_QAuthenticator::ntlmAuth_data()
+{
+ QTest::addColumn<QString>("data");
+ QTest::addColumn<QString>("realm");
+
+ QTest::newRow("no-realm") << "TlRMTVNTUAACAAAAHAAcADAAAAAFAoEATFZ3OLRQADIAAAAAAAAAAJYAlgBMAAAAUQBUAC0AVABFAFMAVAAtAEQATwBNAEEASQBOAAIAHABRAFQALQBUAEUAUwBUAC0ARABPAE0AQQBJAE4AAQAcAFEAVAAtAFQARQBTAFQALQBTAEUAUgBWAEUAUgAEABYAcQB0AC0AdABlAHMAdAAtAG4AZQB0AAMANABxAHQALQB0AGUAcwB0AC0AcwBlAHIAdgBlAHIALgBxAHQALQB0AGUAcwB0AC0AbgBlAHQAAAAAAA==" << "";
+ QTest::newRow("with-realm") << "TlRMTVNTUAACAAAADAAMADgAAAAFAoECWCZkccFFAzwAAAAAAAAAAL4AvgBEAAAABQLODgAAAA9NAEcARABOAE8ASwACAAwATQBHAEQATgBPAEsAAQAcAE4ATwBLAC0AQQBNAFMAUwBTAEYARQAtADAAMQAEACAAbQBnAGQAbgBvAGsALgBuAG8AawBpAGEALgBjAG8AbQADAD4AbgBvAGsALQBhAG0AcwBzAHMAZgBlAC0AMAAxAC4AbQBnAGQAbgBvAGsALgBuAG8AawBpAGEALgBjAG8AbQAFACAAbQBnAGQAbgBvAGsALgBuAG8AawBpAGEALgBjAG8AbQAAAAAA" << "NOE";
+}
+
+void tst_QAuthenticator::ntlmAuth()
+{
+ QFETCH(QString, data);
+ QFETCH(QString, realm);
+
+ QAuthenticator auth;
+ auth.detach();
+ QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(auth);
+ QVERIFY(priv->phase == QAuthenticatorPrivate::Start);
+
+ QList<QPair<QByteArray, QByteArray> > headers;
+
+ // NTLM phase 1: negotiate
+ // This phase of NTLM contains no information, other than what we're willing to negotiate
+ // Current implementation uses flags:
+ // NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_REQUEST_TARGET
+ headers << qMakePair<QByteArray, QByteArray>("WWW-Authenticate", "NTLM");
+ priv->parseHttpResponse(headers, /*isProxy = */ false);
+ QCOMPARE(priv->calculateResponse("GET", "/").constData(), "NTLM TlRMTVNTUAABAAAABQIAAAAAAAAAAAAAAAAAAAAAAAA=");
+
+ // NTLM phase 2: challenge
+ headers.clear();
+ headers << qMakePair(QByteArray("WWW-Authenticate"), "NTLM " + data.toUtf8());
+ priv->parseHttpResponse(headers, /*isProxy = */ false);
+
+ QEXPECT_FAIL("with-realm", "NTLM authentication code doesn't extract the realm", Continue);
+ QCOMPARE(auth.realm(), realm);
+
+ auth.setUser("unimportant");
+ auth.setPassword("unimportant");
+
+ QVERIFY(!priv->calculateResponse("GET", "/").isEmpty());
+}
+
+QTEST_MAIN(tst_QAuthenticator);
+
+#include "tst_qauthenticator.moc"
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 4c651bf..93b1891 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -1082,7 +1082,7 @@ void tst_QFileInfo::isHidden_data()
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory"));
- QVERIFY(SetFileAttributesW(QString("./hidden-directory").utf16(),FILE_ATTRIBUTE_HIDDEN));
+ QVERIFY(SetFileAttributesW(reinterpret_cast<LPCWSTR>(QString("./hidden-directory").utf16()),FILE_ATTRIBUTE_HIDDEN));
QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true;
QTest::newRow("C:/path/to/hidden-directory/.") << QDir::currentPath() + QString::fromLatin1("/hidden-directory/.") << true;
#endif
diff --git a/tests/auto/qmake/testdata/simple_app/build/README b/tests/auto/qmake/testdata/simple_app/build/README
new file mode 100644
index 0000000..acfd9d9
--- /dev/null
+++ b/tests/auto/qmake/testdata/simple_app/build/README
@@ -0,0 +1 @@
+Here to ensure build/ exists, used by the simple_app_shadowbuild2 test.
diff --git a/tests/auto/qmake/testdata/simple_app/simple_app.pro b/tests/auto/qmake/testdata/simple_app/simple_app.pro
index f496d5b..a8c4ad6 100644
--- a/tests/auto/qmake/testdata/simple_app/simple_app.pro
+++ b/tests/auto/qmake/testdata/simple_app/simple_app.pro
@@ -3,6 +3,7 @@ CONFIG += qt warn_on
HEADERS = test_file.h
SOURCES = test_file.cpp \
main.cpp
+RESOURCES = test.qrc
TARGET = simple_app
DESTDIR = ./
diff --git a/tests/auto/qmake/testdata/simple_app/test.qrc b/tests/auto/qmake/testdata/simple_app/test.qrc
new file mode 100644
index 0000000..decde3d
--- /dev/null
+++ b/tests/auto/qmake/testdata/simple_app/test.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>test.qrc</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp
index 03054e7..5efe714 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -65,6 +65,7 @@ public slots:
private slots:
void simple_app();
void simple_app_shadowbuild();
+ void simple_app_shadowbuild2();
void simple_lib();
void simple_dll();
void subdirs();
@@ -163,6 +164,21 @@ void tst_qmake::simple_app_shadowbuild()
QVERIFY( test_compiler.removeMakefile( buildDir ) );
}
+void tst_qmake::simple_app_shadowbuild2()
+{
+ QString workDir = base_path + "/testdata/simple_app";
+ QString buildDir = base_path + "/testdata/simple_app/build";
+
+ QVERIFY( test_compiler.qmake( workDir, "simple_app", buildDir ));
+ QVERIFY( test_compiler.make( buildDir ));
+ QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" ));
+ QVERIFY( test_compiler.makeClean( buildDir ));
+ QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should still exist after a make clean
+ QVERIFY( test_compiler.makeDistClean( buildDir ));
+ QVERIFY( !test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should not exist after a make distclean
+ QVERIFY( test_compiler.removeMakefile( buildDir ) );
+}
+
void tst_qmake::simple_dll()
{
QString workDir = base_path + "/testdata/simple_dll";
diff --git a/tests/auto/qmimedata/qmimedata.pro b/tests/auto/qmimedata/qmimedata.pro
new file mode 100644
index 0000000..13fbe65
--- /dev/null
+++ b/tests/auto/qmimedata/qmimedata.pro
@@ -0,0 +1,4 @@
+load(qttest_p4)
+SOURCES += tst_qmimedata.cpp
+
+
diff --git a/tests/auto/qmimedata/tst_qmimedata.cpp b/tests/auto/qmimedata/tst_qmimedata.cpp
new file mode 100644
index 0000000..be7a654
--- /dev/null
+++ b/tests/auto/qmimedata/tst_qmimedata.cpp
@@ -0,0 +1,343 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** 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.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QMimeData>
+
+class tst_QMimeData : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QMimeData()
+ {
+ }
+
+private slots:
+ void clear() const;
+ void colorData() const;
+ void data() const;
+ void formats() const;
+ void hasColor() const;
+ void hasFormat() const;
+ void hasHtml() const;
+ void hasImage() const;
+ // hasText() covered by setText()
+ // hasUrls() covered by setUrls()
+ // html() covered by setHtml()
+ void imageData() const;
+ void removeFormat() const;
+ // setColorData() covered by hasColor()
+ // setData() covered in a few different tests
+ void setHtml() const;
+ // setImageData() covered in a few tests
+ void setText() const;
+ void setUrls() const;
+ // text() covered in setText()
+ // urls() covered by setUrls()
+};
+
+void tst_QMimeData::clear() const
+{
+ QMimeData mimeData;
+
+ // set, clear, verify empty
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasText());
+ mimeData.clear();
+ QVERIFY(mimeData.hasText() == false);
+
+ // repopulate, verify not empty
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasText());
+}
+
+void tst_QMimeData::colorData() const
+{
+ QMimeData mimeData;
+ QColor red = Qt::red;
+ QColor blue = Qt::blue;
+
+ // set, verify
+ mimeData.setColorData(red);
+ QVERIFY(mimeData.hasColor());
+ QCOMPARE(qvariant_cast<QColor>(mimeData.colorData()), red);
+
+ // change, verify
+ mimeData.setColorData(Qt::blue);
+ QVERIFY(mimeData.hasColor());
+ QCOMPARE(qvariant_cast<QColor>(mimeData.colorData()), blue);
+}
+
+void tst_QMimeData::data() const
+{
+ QMimeData mimeData;
+
+ // set text, verify
+ mimeData.setData("text/plain", "pirates");
+ QCOMPARE(mimeData.data("text/plain"), QByteArray("pirates"));
+ QVERIFY(mimeData.data("text/html").length() == 0);
+
+ // html time
+ mimeData.setData("text/html", "ninjas");
+ QCOMPARE(mimeData.data("text/html"), QByteArray("ninjas"));
+ QCOMPARE(mimeData.data("text/plain"), QByteArray("pirates")); // make sure text not damaged
+ QCOMPARE(mimeData.data("text/html"), mimeData.html().toLatin1());
+}
+
+void tst_QMimeData::formats() const
+{
+ QMimeData mimeData;
+
+ // set text, verify
+ mimeData.setData("text/plain", "pirates");
+ QCOMPARE(mimeData.formats(), QStringList() << "text/plain");
+
+ // set html, verify
+ mimeData.setData("text/html", "ninjas");
+ QCOMPARE(mimeData.formats(), QStringList() << "text/plain" << "text/html");
+
+ // clear, verify
+ mimeData.clear();
+ QCOMPARE(mimeData.formats(), QStringList());
+
+ // set an odd format, verify
+ mimeData.setData("foo/bar", "somevalue");
+ QCOMPARE(mimeData.formats(), QStringList() << "foo/bar");
+}
+
+void tst_QMimeData::hasColor() const
+{
+ QMimeData mimeData;
+
+ // initial state
+ QVERIFY(mimeData.hasColor() == false);
+
+ // set, verify
+ mimeData.setColorData(QColor(Qt::red));
+ QVERIFY(mimeData.hasColor());
+
+ // clear, verify
+ mimeData.clear();
+ QVERIFY(mimeData.hasColor() == false);
+
+ // set something else, verify
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasColor() == false);
+}
+
+void tst_QMimeData::hasFormat() const
+{
+ QMimeData mimeData;
+
+ // initial state
+ QVERIFY(mimeData.hasFormat("text/plain") == false);
+
+ // add, verify
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasFormat("text/plain"));
+ QVERIFY(mimeData.hasFormat("text/html") == false);
+
+ // clear, verify
+ mimeData.clear();
+ QVERIFY(mimeData.hasFormat("text/plain") == false);
+ QVERIFY(mimeData.hasFormat("text/html") == false);
+}
+
+void tst_QMimeData::hasHtml() const
+{
+ QMimeData mimeData;
+
+ // initial state
+ QVERIFY(mimeData.hasHtml() == false);
+
+ // add plain, verify false
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasHtml() == false);
+
+ // add html, verify
+ mimeData.setData("text/html", "ninjas");
+ QVERIFY(mimeData.hasHtml());
+
+ // clear, verify
+ mimeData.clear();
+ QVERIFY(mimeData.hasHtml() == false);
+
+ // readd, verify
+ mimeData.setData("text/html", "ninjas");
+ QVERIFY(mimeData.hasHtml());
+}
+
+void tst_QMimeData::hasImage() const
+{
+ QMimeData mimeData;
+
+ // initial state
+ QVERIFY(mimeData.hasImage() == false);
+
+ // add text, verify false
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasImage() == false);
+
+ // add image
+ mimeData.setImageData(QImage());
+ QVERIFY(mimeData.hasImage());
+
+ // clear, verify
+ mimeData.clear();
+ QVERIFY(mimeData.hasImage() == false);
+}
+
+void tst_QMimeData::imageData() const
+{
+ QMimeData mimeData;
+
+ // initial state
+ QCOMPARE(mimeData.imageData(), QVariant());
+
+ // set, test
+ mimeData.setImageData(QImage());
+ QVERIFY(mimeData.hasImage());
+ QCOMPARE(mimeData.imageData(), QVariant(QImage()));
+
+ // clear, verify
+ mimeData.clear();
+ QCOMPARE(mimeData.imageData(), QVariant());
+}
+
+void tst_QMimeData::removeFormat() const
+{
+ QMimeData mimeData;
+
+ // add, verify
+ mimeData.setData("text/plain", "pirates");
+ QVERIFY(mimeData.hasFormat("text/plain"));
+
+ // add another, verify
+ mimeData.setData("text/html", "ninjas");
+ QVERIFY(mimeData.hasFormat("text/html"));
+
+ // remove, verify
+ mimeData.removeFormat("text/plain");
+ QVERIFY(mimeData.hasFormat("text/plain") == false);
+ QVERIFY(mimeData.hasFormat("text/html"));
+
+ // remove, verify
+ mimeData.removeFormat("text/html");
+ QVERIFY(mimeData.hasFormat("text/plain") == false);
+ QVERIFY(mimeData.hasFormat("text/html") == false);
+}
+
+void tst_QMimeData::setHtml() const
+{
+ QMimeData mimeData;
+
+ // initial state
+ QVERIFY(mimeData.hasHtml() == false);
+
+ // add html, verify
+ mimeData.setHtml("ninjas");
+ QVERIFY(mimeData.hasHtml());
+ QCOMPARE(mimeData.html(), QLatin1String("ninjas"));
+
+ // reset html
+ mimeData.setHtml("pirates");
+ QVERIFY(mimeData.hasHtml());
+ QCOMPARE(mimeData.html(), QLatin1String("pirates"));
+}
+
+void tst_QMimeData::setText() const
+{
+ QMimeData mimeData;
+
+ // verify initial state
+ QCOMPARE(mimeData.text(), QLatin1String(""));
+ QVERIFY(mimeData.hasText() == false);
+
+ // set, verify
+ mimeData.setText("pirates");
+ QVERIFY(mimeData.hasText());
+ QCOMPARE(mimeData.text(), QLatin1String("pirates"));
+ QCOMPARE(mimeData.text().toLatin1(), mimeData.data("text/plain"));
+
+ // reset, verify
+ mimeData.setText("ninjas");
+ QVERIFY(mimeData.hasText());
+ QCOMPARE(mimeData.text(), QLatin1String("ninjas"));
+ QCOMPARE(mimeData.text().toLatin1(), mimeData.data("text/plain"));
+
+ // clear, verify
+ mimeData.clear();
+ QCOMPARE(mimeData.text(), QLatin1String(""));
+ QVERIFY(mimeData.hasText() == false);
+}
+
+void tst_QMimeData::setUrls() const
+{
+ QMimeData mimeData;
+ QList<QUrl> shortUrlList;
+ QList<QUrl> longUrlList;
+
+ // set up
+ shortUrlList += QUrl("http://qt.nokia.com");
+ longUrlList = shortUrlList;
+ longUrlList += QUrl("http://www.google.com");
+
+ // verify initial state
+ QVERIFY(mimeData.hasUrls() == false);
+
+ // set a few, verify
+ mimeData.setUrls(shortUrlList);
+ QCOMPARE(mimeData.urls(), shortUrlList);
+
+ // change them, verify
+ mimeData.setUrls(longUrlList);
+ QCOMPARE(mimeData.urls(), longUrlList);
+
+ // clear, verify
+ mimeData.clear();
+ QVERIFY(mimeData.hasUrls() == false);
+}
+
+
+QTEST_MAIN(tst_QMimeData)
+#include "tst_qmimedata.moc"
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 6885adf..7a732cc 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -4265,6 +4265,35 @@ void tst_QScriptEngine::reentrancy()
QScriptEngine eng;
QCOMPARE(eng.evaluate("Array()").toString(), QString());
}
+
+ {
+ QScriptEngine eng1;
+ QScriptEngine eng2;
+ {
+ QScriptValue d1 = eng1.newDate(0);
+ QScriptValue d2 = eng2.newDate(0);
+ QCOMPARE(d1.toDateTime(), d2.toDateTime());
+ QCOMPARE(d2.toDateTime(), d1.toDateTime());
+ }
+ {
+ QScriptValue r1 = eng1.newRegExp("foo", "gim");
+ QScriptValue r2 = eng2.newRegExp("foo", "gim");
+ QCOMPARE(r1.toRegExp(), r2.toRegExp());
+ QCOMPARE(r2.toRegExp(), r1.toRegExp());
+ }
+ {
+ QScriptValue o1 = eng1.newQObject(this);
+ QScriptValue o2 = eng2.newQObject(this);
+ QCOMPARE(o1.toQObject(), o2.toQObject());
+ QCOMPARE(o2.toQObject(), o1.toQObject());
+ }
+ {
+ QScriptValue mo1 = eng1.newQMetaObject(&staticMetaObject);
+ QScriptValue mo2 = eng2.newQMetaObject(&staticMetaObject);
+ QCOMPARE(mo1.toQMetaObject(), mo2.toQMetaObject());
+ QCOMPARE(mo2.toQMetaObject(), mo1.toQMetaObject());
+ }
+ }
}
void tst_QScriptEngine:: incDecNonObjectProperty()
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 8aa4e711..83a3388 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2123,6 +2123,10 @@ void tst_QScriptValue::getSetProperty()
QVERIFY(object.property(foo).strictlyEquals(num));
QVERIFY(object.property("foo").strictlyEquals(num));
QVERIFY(object.propertyFlags(foo) == 0);
+
+ // Setting index property on non-Array
+ object.setProperty(13, num);
+ QVERIFY(object.property(13).equals(num));
}
void tst_QScriptValue::arrayElementGetterSetter()
diff --git a/tests/auto/qscrollbar/tst_qscrollbar.cpp b/tests/auto/qscrollbar/tst_qscrollbar.cpp
index 735b2dd..16d5b42 100644
--- a/tests/auto/qscrollbar/tst_qscrollbar.cpp
+++ b/tests/auto/qscrollbar/tst_qscrollbar.cpp
@@ -130,7 +130,7 @@ void tst_QScrollBar::task_209492()
QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint,
Qt::LeftButton, Qt::LeftButton, 0);
QApplication::sendEvent(verticalScrollBar, &mousePressEvent);
- QTest::qWait(50);
+ QTest::qWait(1);
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint,
Qt::LeftButton, Qt::LeftButton, 0);
QApplication::sendEvent(verticalScrollBar, &mouseReleaseEvent);
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 0cf638b..0c12974 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -55,6 +55,7 @@
#include <QAuthenticator>
#include "private/qhostinfo_p.h"
+#include "private/qsslsocket_openssl_p.h"
#include "../network-settings.h"
@@ -163,6 +164,7 @@ private slots:
void setDefaultCiphers();
void supportedCiphers();
void systemCaCertificates();
+ void wildcardCertificateNames();
void wildcard();
void setEmptyKey();
void spontaneousWrite();
@@ -1063,6 +1065,28 @@ void tst_QSslSocket::systemCaCertificates()
QCOMPARE(certs, QSslSocket::defaultCaCertificates());
}
+void tst_QSslSocket::wildcardCertificateNames()
+{
+ // Passing CN matches
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("www.example.com"), QString("www.example.com")), true );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("www.example.com")), true );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx*.example.com"), QString("xxxwww.example.com")), true );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("foo.example.com")), true );
+
+ // Failing CN matches
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx.example.com"), QString("www.example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www.example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.*.com"), QString("www.example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("baa.foo.example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("baa.example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.com"), QString("example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*fail.com"), QString("example.com")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example.")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString(""), QString("www")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www")), false );
+}
+
void tst_QSslSocket::wildcard()
{
QSKIP("TODO: solve wildcard problem", SkipAll);
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 31cae40..e3b2ca5 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -275,7 +275,7 @@ void tst_QTcpSocket::initTestCase_data()
QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false;
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false;
-// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false;
+ QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false;
#ifndef QT_NO_OPENSSL
QTest::newRow("WithoutProxy SSL") << false << 0 << true;
@@ -284,7 +284,7 @@ void tst_QTcpSocket::initTestCase_data()
QTest::newRow("WithHttpProxy SSL") << true << int(HttpProxy) << true;
QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true;
-// QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true;
+ QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true;
#endif
}
diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp
index c6ead5a..a811b85 100644
--- a/tests/auto/qtexttable/tst_qtexttable.cpp
+++ b/tests/auto/qtexttable/tst_qtexttable.cpp
@@ -48,9 +48,14 @@
#include <qtexttable.h>
#include <qdebug.h>
#include <qtextcursor.h>
+#include <qtextdocument.h>
+#include <qtextedit.h>
//TESTED_FILES=
+typedef QList<int> IntList;
+Q_DECLARE_METATYPE(IntList)
+
QT_FORWARD_DECLARE_CLASS(QTextDocument)
class tst_QTextTable : public QObject
@@ -78,6 +83,7 @@ private slots:
void insertRows();
void deleteInTable();
void mergeCells();
+ void mergeAndInsert();
void splitCells();
void blocksForTableShouldHaveEmptyFormat();
void removeTableByRemoveRows();
@@ -93,7 +99,9 @@ private slots:
void removeColumns3();
void removeColumns4();
void removeColumns5();
- void removeColumnsInTableWithMergedRows();
+ void removeColumnsInTableWithMergedRows();
+ void QTBUG11282_insertBeforeMergedEnding_data();
+ void QTBUG11282_insertBeforeMergedEnding();
private:
QTextTable *create2x2Table();
@@ -587,6 +595,16 @@ void tst_QTextTable::mergeCells()
QVERIFY(table->cellAt(0, 1) == table->cellAt(1, 1));
}
+void tst_QTextTable::mergeAndInsert()
+{
+ QTextTable *table = cursor.insertTable(4,3);
+ table->mergeCells(0,1,3,2);
+ table->mergeCells(3,0,1,3);
+ //Don't crash !
+ table->insertColumns(1,2);
+ QCOMPARE(table->columns(), 5);
+}
+
void tst_QTextTable::splitCells()
{
QTextTable *table = create4x4Table();
@@ -945,5 +963,42 @@ void tst_QTextTable::removeColumnsInTableWithMergedRows()
QCOMPARE(table->columns(), 1);
}
+void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding_data()
+{
+ QTest::addColumn<int>("rows");
+ QTest::addColumn<int>("columns");
+ QTest::addColumn<QList<int> >("merge");
+ QTest::addColumn<QList<int> >("insert");
+
+ QTest::newRow("2x3, merge two, insert one") << 2 << 3 << (QList<int>() << 1 << 2 << 2)
+ << (QList<int>() << 1 << 1) ;
+ QTest::newRow("3x4, merge three, insert one") << 3 << 4 << (QList<int>() << 1 << 3 << 3)
+ << (QList<int>() << 1 << 1) ;
+ QTest::newRow("4x3, merge two, insert two") << 4 << 3 << (QList<int>() << 1 << 4 << 2)
+ << (QList<int>() << 1 << 2) ;
+ QTest::newRow("4x4, merge middle two, insert one") << 4 << 4 << (QList<int>() << 1 << 4 << 2)
+ << (QList<int>() << 1 << 1) ;
+}
+
+void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding()
+{
+ QFETCH(int, rows);
+ QFETCH(int, columns);
+ QFETCH(QList<int>, merge);
+ QFETCH(QList<int>, insert);
+ QTextTable *table = cursor.insertTable(rows, columns);
+ QTextEdit *textEdit = new QTextEdit;
+ textEdit->setDocument(doc);
+ textEdit->show();
+ QTest::qWaitForWindowShown(textEdit);
+ table->mergeCells(0,merge.at(0), merge.at(1), merge.at(2));
+ //Don't crash !
+ table->insertColumns(insert.at(0), insert.at(1));
+ //Check that the final size is what we expected
+ QCOMPARE(table->rows(), rows);
+ QCOMPARE(table->columns(), columns + insert.at(1));
+ delete textEdit;
+}
+
QTEST_MAIN(tst_QTextTable)
#include "tst_qtexttable.moc"
diff --git a/tests/auto/quuid/quuid.pro b/tests/auto/quuid/quuid.pro
index f7608fa..25e2456 100644
--- a/tests/auto/quuid/quuid.pro
+++ b/tests/auto/quuid/quuid.pro
@@ -1,3 +1,6 @@
-load(qttest_p4)
-QT = core
-SOURCES += tst_quuid.cpp
+TEMPLATE = subdirs
+
+SUBDIRS = testProcessUniqueness
+
+SUBDIRS += test
+
diff --git a/tests/auto/quuid/test/test.pro b/tests/auto/quuid/test/test.pro
new file mode 100644
index 0000000..123aa50
--- /dev/null
+++ b/tests/auto/quuid/test/test.pro
@@ -0,0 +1,29 @@
+load(qttest_p4)
+
+QT = core
+SOURCES += ../tst_quuid.cpp
+TARGET = tst_quuid
+
+CONFIG(debug_and_release_target) {
+ CONFIG(debug, debug|release) {
+ DESTDIR = ../debug
+ } else {
+ DESTDIR = ../release
+ }
+} else {
+ DESTDIR = ..
+}
+
+wince* {
+ addFile_processUniqueness.sources = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe
+ addFile_processUniqueness.path = testProcessUniqueness
+
+ DEPLOYMENT += addFile_processUniqueness
+}
+
+symbian {
+ binDep.sources = testProcessUniqueness.exe
+ binDep.path = \\sys\\bin
+
+ DEPLOYMENT += binDep
+}
diff --git a/tests/auto/quuid/testProcessUniqueness/main.cpp b/tests/auto/quuid/testProcessUniqueness/main.cpp
new file mode 100644
index 0000000..4d33c84
--- /dev/null
+++ b/tests/auto/quuid/testProcessUniqueness/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** 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.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdio.h>
+#include <QUuid>
+
+// This is a testcase for QTBUG-11213
+int main(int argc, char **argv)
+{
+ Q_UNUSED(argc)
+ Q_UNUSED(argv)
+
+ // First, break QUuid.
+ qrand();
+
+ // Now print a few uuids.
+ printf("%s", qPrintable(QUuid::createUuid().toString()));
+ printf("%s", qPrintable(QUuid::createUuid().toString()));
+ printf("%s", qPrintable(QUuid::createUuid().toString()));
+
+ // Done
+ return 0;
+}
+
diff --git a/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro
new file mode 100644
index 0000000..88df1a2
--- /dev/null
+++ b/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro
@@ -0,0 +1,8 @@
+SOURCES = main.cpp
+CONFIG += console
+
+DESTDIR = ./
+
+# no install rule for application used by test
+INSTALLS =
+
diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp
index 47f356a..409d8cf 100644
--- a/tests/auto/quuid/tst_quuid.cpp
+++ b/tests/auto/quuid/tst_quuid.cpp
@@ -73,6 +73,7 @@ private slots:
void versions();
void threadUniqueness();
+ void processUniqueness();
public:
// Variables
@@ -196,5 +197,33 @@ void tst_QUuid::threadUniqueness()
qDeleteAll(threads);
}
+void tst_QUuid::processUniqueness()
+{
+ QProcess process;
+ QString processOneOutput;
+ QString processTwoOutput;
+
+ // Start it once
+#ifdef Q_OS_MAC
+ process.start("testProcessUniqueness/testProcessUniqueness.app");
+#else
+ process.start("testProcessUniqueness/testProcessUniqueness");
+#endif
+ QVERIFY(process.waitForFinished());
+ processOneOutput = process.readAllStandardOutput();
+
+ // Start it twice
+#ifdef Q_OS_MAC
+ process.start("testProcessUniqueness/testProcessUniqueness.app");
+#else
+ process.start("testProcessUniqueness/testProcessUniqueness");
+#endif
+ QVERIFY(process.waitForFinished());
+ processTwoOutput = process.readAllStandardOutput();
+
+ // They should be *different*!
+ QVERIFY(processOneOutput != processTwoOutput);
+}
+
QTEST_MAIN(tst_QUuid)
#include "tst_quuid.moc"