diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-07-12 12:52:22 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-07-12 12:52:22 +0200 |
commit | 2371147354d4436bb54c588662ac315dd4c2f940 (patch) | |
tree | 5c90b1dd18de394cff2fb4e1bedc628da3c7d341 /tests | |
parent | 54ec6d177e0e8fb04cd01e70461484a80ca1f7a4 (diff) | |
parent | 82454b6014a7ee0b048b4db8d64a21de849d4ab9 (diff) |
Merge remote branch 'gerrit/master' into refactor
Conflicts:
src/gui/image/qicon.cpp
src/gui/image/qicon.h
src/gui/image/qicon_p.h
src/gui/text/qfontdatabase.cpp
src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp
sync.profile
Change-Id: Ie0a23a12177ff51bf562e15b2dd41f071afb19b4
Diffstat (limited to 'tests')
33 files changed, 436 insertions, 49 deletions
diff --git a/tests/auto/dbus.pro b/tests/auto/dbus.pro index 31b46a31f2..6dd8ce325c 100644 --- a/tests/auto/dbus.pro +++ b/tests/auto/dbus.pro @@ -3,6 +3,7 @@ SUBDIRS=\ qdbusabstractadaptor \ qdbusabstractinterface \ qdbusconnection \ + qdbusconnection_no_bus \ qdbuscontext \ qdbusinterface \ qdbuslocalcalls \ diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 03b2d79bba..1ab630d020 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -1130,7 +1130,7 @@ void tst_QAccessibility::buttonTest() // QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 0), QString("Press")); // test->release(); -// // test splitted menu toolbutton +// // test split menu toolbutton // QVERIFY(QAccessible::queryAccessibleInterface(&splitToolButton, &test)); // QCOMPARE(test->childCount(), 2); // QCOMPARE(test->role(0), QAccessible::ButtonDropDown); diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp index 54885591a7..e2f64b84f8 100644 --- a/tests/auto/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/qbytearray/tst_qbytearray.cpp @@ -883,7 +883,7 @@ void tst_QByteArray::indexOf_data() QTest::newRow( "18" ) << QByteArray("aBc") << QByteArray("BC") << 0 << -1; // task 203692 - static const char h19[] = {'x', 0x00, 0xe7, 0x25, 0x1c, 0x0a}; + static const char h19[] = {'x', 0x00, (char)0xe7, 0x25, 0x1c, 0x0a}; static const char n19[] = {0x00, 0x00, 0x01, 0x00}; QTest::newRow( "19" ) << QByteArray(h19, sizeof(h19)) << QByteArray(n19, sizeof(n19)) << 0 << -1; @@ -963,7 +963,7 @@ void tst_QByteArray::lastIndexOf_data() QTest::newRow( "24" ) << QByteArray("aBc") << QByteArray("BC") << 0 << -1; // task 203692 - static const char h25[] = {0x00, 0xbc, 0x03, 0x10, 0x0a }; + static const char h25[] = {0x00, (char)0xbc, 0x03, 0x10, 0x0a }; static const char n25[] = {0x00, 0x00, 0x01, 0x00}; QTest::newRow( "25" ) << QByteArray(h25, sizeof(h25)) << QByteArray(n25, sizeof(n25)) << 0 << -1; diff --git a/tests/auto/qdbusconnection_no_bus/qdbusconnection_no_bus.pro b/tests/auto/qdbusconnection_no_bus/qdbusconnection_no_bus.pro new file mode 100644 index 0000000000..86d08ea0d4 --- /dev/null +++ b/tests/auto/qdbusconnection_no_bus/qdbusconnection_no_bus.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +QT = core + +contains(QT_CONFIG,dbus): { + SOURCES += tst_qdbusconnection_no_bus.cpp + QT += dbus +} else { + SOURCES += ../qdbusmarshall/dummy.cpp +} diff --git a/tests/auto/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp b/tests/auto/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp new file mode 100644 index 0000000000..acd27386f5 --- /dev/null +++ b/tests/auto/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** 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. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <qcoreapplication.h> +#include <qdebug.h> + +#include <QtTest/QtTest> +#include <QtDBus/QtDBus> + +#include <stdlib.h> + +/* This test uses an appless main, to ensure that no D-Bus stuff is implicitly done + It also sets the magic "QT_SIMULATE_DBUS_LIBFAIL" env variable, that is only available + in developer builds. That env variable simulates a D-Bus library load fail. + + In no case should the QDBus module crash because D-Bus libs couldn't be loaded */ + +class tst_QDBusConnectionNoBus : public QObject +{ + Q_OBJECT + +public: + tst_QDBusConnectionNoBus() + { + ::setenv("DBUS_SESSION_BUS_ADDRESS", "unix:abstract=/tmp/does_not_exist", 1); + ::setenv("QT_SIMULATE_DBUS_LIBFAIL", "1", 1); + } + +private slots: + void connectToBus(); +}; + + +void tst_QDBusConnectionNoBus::connectToBus() +{ + int argc = 0; + QCoreApplication app(argc, 0); + + QDBusConnection con = QDBusConnection::sessionBus(); + + QVERIFY(true); // if we didn't crash here, the test passed :) +} + +QTEST_APPLESS_MAIN(tst_QDBusConnectionNoBus) + +#include "tst_qdbusconnection_no_bus.moc" + diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/qflags/tst_qflags.cpp index 87025b6da2..85e64a6d63 100644 --- a/tests/auto/qflags/tst_qflags.cpp +++ b/tests/auto/qflags/tst_qflags.cpp @@ -47,6 +47,7 @@ private slots: void testFlag() const; void testFlagZeroFlag() const; void testFlagMultiBits() const; + void constExpr(); }; void tst_QFlags::testFlag() const @@ -96,5 +97,32 @@ void tst_QFlags::testFlagMultiBits() const } } +template <int N, typename T> bool verifyConstExpr(T n) { return n == N; } + +void tst_QFlags::constExpr() +{ +#ifdef Q_COMPILER_CONSTEXPR + Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton; + switch (btn) { + case Qt::LeftButton: QVERIFY(false); break; + case Qt::RightButton: QVERIFY(false); break; + case Qt::LeftButton | Qt::RightButton: QVERIFY(true); break; + default: QVERIFY(false); + } + + QVERIFY(verifyConstExpr<(Qt::LeftButton | Qt::RightButton) & Qt::LeftButton>(Qt::LeftButton)); + QVERIFY(verifyConstExpr<(Qt::LeftButton | Qt::RightButton) & Qt::MiddleButton>(0)); + QVERIFY(verifyConstExpr<(Qt::LeftButton | Qt::RightButton) | Qt::MiddleButton>(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton)); + QVERIFY(verifyConstExpr<~(Qt::LeftButton | Qt::RightButton)>(~(Qt::LeftButton | Qt::RightButton))); + QVERIFY(verifyConstExpr<Qt::MouseButtons(Qt::LeftButton) ^ Qt::RightButton>(Qt::LeftButton ^ Qt::RightButton)); + QVERIFY(verifyConstExpr<Qt::MouseButtons(0)>(0)); + QVERIFY(verifyConstExpr<Qt::MouseButtons(Qt::RightButton) & 0xff>(Qt::RightButton)); + QVERIFY(verifyConstExpr<Qt::MouseButtons(Qt::RightButton) | 0xff>(0xff)); + + QVERIFY(!verifyConstExpr<Qt::RightButton>(!Qt::MouseButtons(Qt::LeftButton))); +#endif +} + + QTEST_MAIN(tst_QFlags) #include "tst_qflags.moc" diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index 50ad3397ce..c53ded3a97 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -260,7 +260,7 @@ void tst_QListWidget::addItem2() { int count = testWidget->count(); - // Boundry Checking + // Boundary Checking testWidget->addItem(0); QCOMPARE(testWidget->count(), count); @@ -276,7 +276,7 @@ void tst_QListWidget::addItems() { int count = testWidget->count(); - // Boundry Checking + // Boundary Checking testWidget->addItems(QStringList()); QCOMPARE(testWidget->count(), count); @@ -294,7 +294,7 @@ void tst_QListWidget::addItems() void tst_QListWidget::openPersistentEditor() { - // Boundry checking + // Boundary checking testWidget->openPersistentEditor(0); QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); testWidget->openPersistentEditor(item); @@ -312,7 +312,7 @@ void tst_QListWidget::closePersistentEditor() QTest::qWait(1000); #endif - // Boundry checking + // Boundary checking int childCount = testWidget->viewport()->children().count(); testWidget->closePersistentEditor(0); QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); @@ -337,7 +337,7 @@ void tst_QListWidget::closePersistentEditor() void tst_QListWidget::setItemHidden() { - // Boundry checking + // Boundary checking testWidget->setItemHidden(0, true); testWidget->setItemHidden(0, false); @@ -394,7 +394,7 @@ void tst_QListWidget::setCurrentItem() for (int i = 0; i < fill; ++i) testWidget->addItem(QString("%1").arg(i)); - // Boundry checking + // Boundary checking testWidget->setCurrentItem((QListWidgetItem *)0); QCOMPARE((QListWidgetItem *)0, testWidget->currentItem()); QListWidgetItem item; @@ -426,7 +426,7 @@ void tst_QListWidget::setCurrentRow() for (int i = 0; i < fill; ++i) testWidget->addItem(QString("%1").arg(i)); - // Boundry checking + // Boundary checking testWidget->setCurrentRow(-1); QCOMPARE(-1, testWidget->currentRow()); testWidget->setCurrentRow(testWidget->count()); @@ -483,7 +483,7 @@ void tst_QListWidget::editItem_data() void tst_QListWidget::editItem() { - // Boundry checking + // Boundary checking testWidget->editItem(0); QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); testWidget->editItem(item); @@ -517,7 +517,7 @@ void tst_QListWidget::findItems() { // This really just tests that the items that are returned are converted from index's to items correctly. - // Boundry checking + // Boundary checking QCOMPARE(testWidget->findItems("GirlsCanWearJeansAndCutTheirHairShort", Qt::MatchExactly).count(), 0); populate(); diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 6b3252009b..51bb43716e 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -200,7 +200,7 @@ const int RESET = 0; /*! Test plan: - insertItem (all flavours and combinations) + insertItem (all flavors and combinations) removing menu items clearing the menu diff --git a/tests/auto/qmutexlocker/tst_qmutexlocker.cpp b/tests/auto/qmutexlocker/tst_qmutexlocker.cpp index c9821f58c2..a663b60be7 100644 --- a/tests/auto/qmutexlocker/tst_qmutexlocker.cpp +++ b/tests/auto/qmutexlocker/tst_qmutexlocker.cpp @@ -182,7 +182,7 @@ void tst_QMutexLocker::unlockAndRelockTest() releaseThread(); waitForThread(); - // mutex has been explicity relocked via QMutexLocker + // mutex has been explicitly relocked via QMutexLocker QVERIFY(!thread->mutex.tryLock()); releaseThread(); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 782d533bbf..a456d15472 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -378,6 +378,8 @@ private Q_SLOTS: void dontInsertPartialContentIntoTheCache(); + void httpUserAgent(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -1601,6 +1603,11 @@ void tst_QNetworkReply::getFromHttp() // only compare when the header is set. if (reply->header(QNetworkRequest::ContentLengthHeader).isValid()) QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size()); + + // We know our internal server is apache.. + if (qstrcmp(QTest::currentDataTag(), "success-internal") == 0) + QVERIFY(reply->header(QNetworkRequest::ServerHeader).toString().contains("Apache")); + QCOMPARE(reply->readAll(), reference.readAll()); } @@ -2511,7 +2518,7 @@ void tst_QNetworkReply::ioGetFromFile() QNetworkRequest request(QUrl::fromLocalFile(file.fileName())); QNetworkReplyPtr reply = manager.get(request); - QVERIFY(reply->isFinished()); // a file should immediatly be done + QVERIFY(reply->isFinished()); // a file should immediately be done DataReader reader(reply); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); @@ -2801,7 +2808,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() void tst_QNetworkReply::ioGetFromHttpWithAuthSynchronous() { // verify that we do not enter an endless loop with synchronous calls and wrong credentials - // the case when we succed with the login is tested in ioGetFromHttpWithAuth() + // the case when we succeed with the login is tested in ioGetFromHttpWithAuth() QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt")); request.setAttribute( @@ -2910,7 +2917,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() void tst_QNetworkReply::ioGetFromHttpWithProxyAuthSynchronous() { // verify that we do not enter an endless loop with synchronous calls and wrong credentials - // the case when we succed with the login is tested in ioGetFromHttpWithAuth() + // the case when we succeed with the login is tested in ioGetFromHttpWithAuth() QNetworkProxy proxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129); QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt")); @@ -6262,7 +6269,7 @@ void tst_QNetworkReply::httpAbort() QCOMPARE(reply->error(), QNetworkReply::OperationCanceledError); QVERIFY(reply->isFinished()); - // Abort immediatly after the get() + // Abort immediately after the get() QNetworkReplyPtr reply2 = manager.get(request); connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); reply2->abort(); @@ -6312,6 +6319,25 @@ void tst_QNetworkReply::dontInsertPartialContentIntoTheCache() QCOMPARE(memoryCache->m_insertedUrls.count(), 0); } +void tst_QNetworkReply::httpUserAgent() +{ + QByteArray response("HTTP/1.0 200 OK\r\n\r\n"); + MiniHttpServer server(response); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + request.setHeader(QNetworkRequest::UserAgentHeader, "abcDEFghi"); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(reply->isFinished()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(server.receivedData.contains("\r\nUser-Agent: abcDEFghi\r\n")); +} + + // NOTE: This test must be last testcase in tst_qnetworkreply! void tst_QNetworkReply::parentingRepliesToTheApp() { diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index f01a9dcca7..0c35a552f6 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -1413,15 +1413,15 @@ void tst_QNetworkSession::outOfProcessSession() } } -// A convinience / helper function for testcases. Return the first matching configuration. +// A convenience / helper function for testcases. Return the first matching configuration. // Ignores configurations in other than 'discovered' -state. Returns invalid (QNetworkConfiguration()) // if none found. QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfiguration::Type configType) { - + // Refresh configurations and derive configurations matching given parameters. QNetworkConfigurationManager mgr; QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted())); - + mgr.updateConfigurations(); QTRY_NOOP(updateSpy.count() == 1); if (updateSpy.count() != 1) { @@ -1430,13 +1430,13 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur } QList<QNetworkConfiguration> discoveredConfigs = mgr.allConfigurations(QNetworkConfiguration::Discovered); foreach(QNetworkConfiguration config, discoveredConfigs) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { discoveredConfigs.removeOne(config); } else if (config.type() != configType) { // qDebug() << "Dumping config because type (IAP/SNAP) mismatches: " << config.name(); discoveredConfigs.removeOne(config); } else if ((config.type() == QNetworkConfiguration::InternetAccessPoint) && - bearerType == "cellular") { // 'cellular' bearertype is for convinience + bearerType == "cellular") { // 'cellular' bearertype is for convenience if (config.bearerName() != "2G" && config.bearerName() != "CDMA2000" && config.bearerName() != "WCDMA" && @@ -1458,8 +1458,8 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur } } -// A convinience-function: updates configurations and waits that they are updated. -void updateConfigurations() +// A convenience-function: updates configurations and waits that they are updated. +void updateConfigurations() { QNetworkConfigurationManager mgr; QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted())); @@ -1467,7 +1467,7 @@ void updateConfigurations() QTRY_NOOP(updateSpy.count() == 1); } -// A convinience-function: updates and prints all available confiurations and their states +// A convenience-function: updates and prints all available confiurations and their states void printConfigurations() { QNetworkConfigurationManager manager; @@ -1480,7 +1480,7 @@ void printConfigurations() } } -// A convinience function for test-cases: opens the given configuration and return +// A convenience function for test-cases: opens the given configuration and return // true if it was done gracefully. bool openSession(QNetworkSession *session) { bool result = true; @@ -1546,10 +1546,10 @@ bool openSession(QNetworkSession *session) { return result; } -// Helper function for closing opened session. Performs checks that +// Helper function for closing opened session. Performs checks that // session is closed gradefully (e.g. signals). Function does not delete // the session. The lastSessionOnConfiguration (true by default) is used to -// tell if there are more sessions open, basing on same configration. This +// tell if there are more sessions open, basing on same configuration. This // impacts the checks made. bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration) { if (!session) { diff --git a/tests/auto/qreadlocker/tst_qreadlocker.cpp b/tests/auto/qreadlocker/tst_qreadlocker.cpp index 7e9700fe5d..3ec9f1cb25 100644 --- a/tests/auto/qreadlocker/tst_qreadlocker.cpp +++ b/tests/auto/qreadlocker/tst_qreadlocker.cpp @@ -177,7 +177,7 @@ void tst_QReadLocker::unlockAndRelockTest() releaseThread(); waitForThread(); - // lock has been explicity relocked via QReadLocker + // lock has been explicitly relocked via QReadLocker QVERIFY(!thread->lock.tryLockForWrite()); releaseThread(); diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp index 720f2b0d67..1b995e8d19 100644 --- a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp +++ b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp @@ -665,7 +665,7 @@ public: /* - A writer aquires a read-lock, a reader locks + A writer acquires a read-lock, a reader locks the writer releases the lock, the reader gets the lock */ void tst_QReadWriteLock::readLockBlockRelease() @@ -682,7 +682,7 @@ void tst_QReadWriteLock::readLockBlockRelease() } /* - writer1 aquires a read-lock, writer2 blocks, + writer1 acquires a read-lock, writer2 blocks, writer1 releases the lock, writer2 gets the lock */ void tst_QReadWriteLock::writeLockBlockRelease() @@ -698,7 +698,7 @@ void tst_QReadWriteLock::writeLockBlockRelease() QVERIFY(threadDone); } /* - Two readers aquire a read-lock, one writer attempts a write block, + Two readers acquire a read-lock, one writer attempts a write block, the readers release their locks, the writer gets the lock. */ void tst_QReadWriteLock::multipleReadersBlockRelease() diff --git a/tests/auto/qsslcertificate/more-certificates/natwest-banking.pem b/tests/auto/qsslcertificate/more-certificates/natwest-banking.pem new file mode 100644 index 0000000000..c3e303c770 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/natwest-banking.pem @@ -0,0 +1,36 @@ +-----BEGIN CERTIFICATE----- +MIIGTTCCBTWgAwIBAgIQEdaGfQ9bnSLsmQJm4rWlBjANBgkqhkiG9w0BAQUFADCB +vjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL +ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2Ug +YXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYSAoYykwNjE4MDYGA1UEAxMv +VmVyaVNpZ24gQ2xhc3MgMyBFeHRlbmRlZCBWYWxpZGF0aW9uIFNTTCBTR0MgQ0Ew +HhcNMDkwOTE1MDAwMDAwWhcNMTExMTA5MjM1OTU5WjCCAQAxEzARBgsrBgEEAYI3 +PAIBAxMCR0IxGzAZBgNVBA8TElYxLjAsIENsYXVzZSA1LihiKTERMA8GA1UEBRMI +U0MwNDU1NTExCzAJBgNVBAYTAkdCMRAwDgYDVQQRFAdFSDMgNlVZMRAwDgYDVQQI +EwdMb3RoaWFuMRIwEAYDVQQHFAlFZGluYnVyZ2gxFjAUBgNVBAkUDTM0IEZldHRl +cyBSb3cxLTArBgNVBAoUJFRoZSBSb3lhbCBCYW5rIG9mIFNjb3RsYW5kIEdyb3Vw +IFBsYzEVMBMGA1UECxQMV2ViIFNlcnZpY2VzMRYwFAYDVQQDFA13d3cubndvbGIu +Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw4bRz9mxrbicnYun +uYoobkfDBjmmJKpSDBbcZCsZDWyLsLvoZh2Ez6Ux9GAbf4m5pLoIQnzQORy40NAt +bNDFhMJV0Iq65ju8qdYaUaWUdrxkLiwrIsiZwUMgcDOwdOvgO4qTev2OjkQg6syj +J+3HTaRrqekfrV5RvBNZ8vPVXK3cWERykzxwqXHwr9QL/n3wqDn4hCOb11Ic2rUf +H9TcPvxv7eFFnGL4ZJ3EU83tE/CmOYgz086BUDBKSvOHqHt2QWiPN/tHAgwfHYKj +eYCMWM21G0rDugeN+urZN+p364kO+VygBxnNIPSr/ZY+4DCdjaKGe8sOJdvI6ip5 +4a1q3QIDAQABo4ICADCCAfwwCQYDVR0TBAIwADAdBgNVHQ4EFgQUX5AjzSTKUsk2 +KfB+nbH+CODuafAwCwYDVR0PBAQDAgWgMD4GA1UdHwQ3MDUwM6AxoC+GLWh0dHA6 +Ly9FVkludGwtY3JsLnZlcmlzaWduLmNvbS9FVkludGwyMDA2LmNybDBEBgNVHSAE +PTA7MDkGC2CGSAGG+EUBBxcGMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LnZl +cmlzaWduLmNvbS9ycGEwNAYDVR0lBC0wKwYIKwYBBQUHAwEGCCsGAQUFBwMCBglg +hkgBhvhCBAEGCisGAQQBgjcKAwMwHwYDVR0jBBgwFoAUTkPIHXbvN1N6T/JYb5Tz +OOLVvd8wdgYIKwYBBQUHAQEEajBoMCsGCCsGAQUFBzABhh9odHRwOi8vRVZJbnRs +LW9jc3AudmVyaXNpZ24uY29tMDkGCCsGAQUFBzAChi1odHRwOi8vRVZJbnRsLWFp +YS52ZXJpc2lnbi5jb20vRVZJbnRsMjAwNi5jZXIwbgYIKwYBBQUHAQwEYjBgoV6g +XDBaMFgwVhYJaW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUS2u5KJYGDLvQUjibKaxL +B4shBRgwJhYkaHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nbzEuZ2lmMA0G +CSqGSIb3DQEBBQUAA4IBAQCT64k2YepUu257B3pA4pjbKr/dmlOztUYS/IAtlJpo +As+R+T9dohGP+4liqHtlMMSKPRnwmSCj/KucJJ9UnIC89D3bVAP1Drvk5+gTwGZ5 +JkqPQqZsfEaeihmf8iu9stkYSQxMJcr24S4VEiGt2rdHhESq0OUel4SkMhlmSp5P +sZxqX1HByBJnsF4bcvIY3C4eTrso5awqNgomGhxizJWmK8/sdEcys82SHgSjG4Bp +05gUpXQrLTqWXDDOg5Uy745Gc8TpgqW1ZfpGg7EkjJX7EhBSKF0/2cNKVYUE9bnO +VGd7vK10NOhK7Uk9CkDALK+MvIIkxmRBmAFuQ4D+eqNF +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem b/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem new file mode 100644 index 0000000000..952b711aa2 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem @@ -0,0 +1,66 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 11 (0xb) + Signature Algorithm: sha1WithRSAEncryption + Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority + Validity + Not Before: Jun 26 19:36:40 2011 GMT + Not After : Jun 23 19:36:40 2021 GMT + Subject: CN=example.com/emailAddress=test@example.com/favouriteDrink=tequila + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:a5:88:9c:fd:1b:8d:26:90:7d:ed:b2:66:14:09: + 88:9f:c5:96:87:97:84:33:db:fd:a9:32:20:d0:4d: + 03:ce:34:a6:b3:e2:db:33:27:e5:5b:09:3b:6f:49: + 36:c8:99:63:88:4c:33:f2:55:bc:04:02:07:50:59: + 6a:34:52:4c:83:74:cb:d5:54:b5:a9:41:91:07:0e: + cf:50:3b:87:09:a5:5f:d8:71:f3:ee:d8:10:6d:5c: + 5d:69:ab:dc:98:d7:1a:38:63:c6:15:4e:d7:31:19: + 96:4c:db:be:d3:32:9d:ad:8b:1d:85:1b:aa:cf:d1: + b1:a4:ce:bf:5a:0f:30:a0:63 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Authority Information Access: + OCSP - URI:http://ocsp.example.com:8888/ + + Signature Algorithm: sha1WithRSAEncryption + 21:55:2f:82:17:e6:8c:2c:39:af:2a:ce:b7:83:7f:cf:76:ce: + 25:39:b5:08:3c:9b:33:a2:9b:f7:3f:df:7d:67:7b:11:c7:e3: + ac:6f:59:c0:4f:25:3b:6d:3c:ec:3e:c2:0d:4c:a4:43:dd:4f: + c4:4c:5a:67:9d:a9:7a:91:c3:48:ed:40:5e:4d:6f:18:46:38: + 9c:e2:9a:7f:c9:d8:26:0c:35:fa:60:87:67:45:56:42:81:ba: + 4b:b6:03:6f:6c:7d:d1:f9:78:a1:08:9e:4a:f1:00:07:4b:ca: + ec:a4:1d:26:ad:63:46:63:5f:b2:64:2e:d3:cd:80:35:87:4f: + c4:16:1a:91:97:50:95:16:31:c5:97:49:70:19:68:a9:a8:6c: + 0f:c3:5b:8f:6a:1f:3f:e7:3b:ba:48:76:2c:b0:8d:b3:de:ce: + 7b:c7:bf:0f:80:34:7c:73:d5:d6:45:63:83:02:c5:4d:73:9b: + 66:8a:3a:66:dc:0c:9f:75:1a:a7:15:d1:1d:7f:12:af:f4:5d: + 9c:80:99:55:9b:26:69:ec:76:11:fe:4e:65:f7:57:7d:32:bb: + 9a:25:51:76:f5:68:99:2a:d2:a5:53:17:87:b6:ad:08:f1:24: + db:6f:45:07:d2:f1:60:50:ac:a0:d0:b7:0b:45:aa:e2:27:38: + 1f:4c:41:a3 +-----BEGIN CERTIFICATE----- +MIIDOzCCAiOgAwIBAgIBCzANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz +dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx +CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G +A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eTAeFw0xMTA2MjYxOTM2NDBaFw0yMTA2MjMxOTM2NDBaMFAx +FDASBgNVBAMTC2V4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkBFhB0ZXN0QGV4YW1w +bGUuY29tMRcwFQYKCZImiZPyLGQBBRMHdGVxdWlsYTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEApYic/RuNJpB97bJmFAmIn8WWh5eEM9v9qTIg0E0DzjSms+Lb +MyflWwk7b0k2yJljiEwz8lW8BAIHUFlqNFJMg3TL1VS1qUGRBw7PUDuHCaVf2HHz +7tgQbVxdaavcmNcaOGPGFU7XMRmWTNu+0zKdrYsdhRuqz9GxpM6/Wg8woGMCAwEA +AaNIMEYwCQYDVR0TBAIwADA5BggrBgEFBQcBAQQtMCswKQYIKwYBBQUHMAGGHWh0 +dHA6Ly9vY3NwLmV4YW1wbGUuY29tOjg4ODgvMA0GCSqGSIb3DQEBBQUAA4IBAQAh +VS+CF+aMLDmvKs63g3/Pds4lObUIPJszopv3P999Z3sRx+Osb1nATyU7bTzsPsIN +TKRD3U/ETFpnnal6kcNI7UBeTW8YRjic4pp/ydgmDDX6YIdnRVZCgbpLtgNvbH3R ++XihCJ5K8QAHS8rspB0mrWNGY1+yZC7TzYA1h0/EFhqRl1CVFjHFl0lwGWipqGwP +w1uPah8/5zu6SHYssI2z3s57x78PgDR8c9XWRWODAsVNc5tmijpm3AyfdRqnFdEd +fxKv9F2cgJlVmyZp7HYR/k5l91d9MruaJVF29WiZKtKlUxeHtq0I8STbb0UH0vFg +UKyg0LcLRariJzgfTEGj +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index e95af1e97c..f12af0275c 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -115,6 +115,7 @@ private slots: void blacklistedCertificates(); void toText(); void multipleCommonNames(); + void subjectAndIssuerAttributes(); // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted @@ -883,6 +884,23 @@ void tst_QSslCertificate::multipleCommonNames() QVERIFY(commonNames.contains(QString("www2.example.com"))); } +void tst_QSslCertificate::subjectAndIssuerAttributes() +{ + QList<QSslCertificate> certList = + QSslCertificate::fromPath(SRCDIR "more-certificates/test-cn-with-drink-cert.pem"); + QVERIFY2(certList.count() > 0, "Please run this test from the source directory"); + + QList<QByteArray> attributes = certList[0].subjectInfoAttributes(); + QVERIFY(attributes.contains(QByteArray("favouriteDrink"))); + attributes.clear(); + + certList = QSslCertificate::fromPath(SRCDIR "more-certificates/natwest-banking.pem"); + QVERIFY2(certList.count() > 0, "Please run this test from the source directory"); + + attributes = certList[0].subjectInfoAttributes(); + QVERIFY(attributes.contains(QByteArray("1.3.6.1.4.1.311.60.2.1.3"))); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 5070d4b043..8b3ec3d31e 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -191,6 +191,7 @@ private slots: void writeBigChunk(); void blacklistedCertificates(); void setEmptyDefaultConfiguration(); + void versionAccessors(); static void exitLoop() { @@ -2049,6 +2050,15 @@ void tst_QSslSocket::setEmptyDefaultConfiguration() QVERIFY2(!socket->waitForEncrypted(4000), qPrintable(socket->errorString())); } +void tst_QSslSocket::versionAccessors() +{ + if (!QSslSocket::supportsSsl()) + return; + + qDebug() << QSslSocket::sslLibraryVersionString(); + qDebug() << QString::number(QSslSocket::sslLibraryVersionNumber(), 16); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslSocket) diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index abec5102b5..8c725fa109 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -223,6 +223,7 @@ private slots: void QTBUG9281_arg_locale(); void toUpperLower_icu(); + void literals(); }; typedef QList<int> IntList; @@ -5107,6 +5108,31 @@ void tst_QString::toUpperLower_icu() // the cleanup function will restore the default locale } +void tst_QString::literals() +{ +#if defined(QT_QSTRING_UNICODE_MARKER) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)) + QString str(QStringLiteral("abcd")); + + QVERIFY(str.length() == 4); + QVERIFY(str == QLatin1String("abcd")); + QVERIFY(str.data_ptr()->ref == -1); + QVERIFY(str.data_ptr()->offset == 0); + + const QChar *s = str.constData(); + QString str2 = str; + QVERIFY(str2.constData() == s); + + // detach on non const access + QVERIFY(str.data() != s); + + QVERIFY(str2.constData() == s); + QVERIFY(str2.data() != s); + +#else + QSKIP("Only tested on c++0x compliant compiler or gcc", SkipAll); +#endif +} + QTEST_APPLESS_MAIN(tst_QString) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 86361af046..11d297cdac 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -448,7 +448,7 @@ void tst_QStyleSheetStyle::widgetStyle() window2->setStyleSheet(""); qApp->setStyle(0); - qApp->setStyleSheet("may_insanity_prevail { }"); // app has styleshet + qApp->setStyleSheet("may_insanity_prevail { }"); // app has stylesheet QCOMPARE(window1->style(), qApp->style()); QCOMPARE(window1->style()->metaObject()->className(), "QStyleSheetStyle"); QCOMPARE(widget1->style()->metaObject()->className(), "QStyleSheetStyle"); // check the child diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index 049af796d9..4813f90652 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -496,7 +496,7 @@ void tst_QTextCodec::flagEFBFBF() const start.append("?>"); } - /* When 0xEFBFBF is preceeded by what seems to be an arbitrary character, + /* When 0xEFBFBF is preceded by what seems to be an arbitrary character, * QTextCodec fails to flag it. */ { QByteArray start("B"); diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index bb5a212567..2b0ba422e0 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -1302,7 +1302,7 @@ void tst_QTextCursor::selectVisually() cursor.setPosition(6); // somewhere in the long paragraph. cursor.select(QTextCursor::LineUnderCursor); - // since we are not yet layed-out, we expect the whole paragraph to be selected. + // since we are not yet laid-out, we expect the whole paragraph to be selected. QCOMPARE(cursor.position(), 77); QCOMPARE(cursor.anchor(), 4); } diff --git a/tests/auto/qtextlayout/qtextlayout.pro b/tests/auto/qtextlayout/qtextlayout.pro index 2a180d7937..222e69b804 100644 --- a/tests/auto/qtextlayout/qtextlayout.pro +++ b/tests/auto/qtextlayout/qtextlayout.pro @@ -2,6 +2,7 @@ load(qttest_p4) QT += core-private gui-private HEADERS += SOURCES += tst_qtextlayout.cpp +DEFINES += QT_COMPILES_IN_HARFBUZZ INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src symbian { diff --git a/tests/auto/qvector/tst_qvector.cpp b/tests/auto/qvector/tst_qvector.cpp index 414bf91b41..4cc2bc481a 100644 --- a/tests/auto/qvector/tst_qvector.cpp +++ b/tests/auto/qvector/tst_qvector.cpp @@ -157,7 +157,7 @@ void tst_QVector::capacity() const { QVector<QString> myvec; - // TODO: is this guarenteed? seems a safe assumption, but I suppose preallocation of a + // TODO: is this guaranteed? seems a safe assumption, but I suppose preallocation of a // few items isn't an entirely unforseeable possibility. QVERIFY(myvec.capacity() == 0); diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index b2656db005..d4b0c795d4 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -923,7 +923,7 @@ void tst_QWizard::setOption_IndependentPages() CHECK_PAGE_INIT(11, 10, 11, 10, 10, 10); // Now, turn on the option and check that they're called at the - // appropiate times (which aren't the same). + // appropriate times (which aren't the same). wizard.setOption(QWizard::IndependentPages, true); CHECK_PAGE_INIT(11, 10, 11, 10, 10, 10); diff --git a/tests/auto/qwritelocker/tst_qwritelocker.cpp b/tests/auto/qwritelocker/tst_qwritelocker.cpp index c49e29fe51..a06431a5e1 100644 --- a/tests/auto/qwritelocker/tst_qwritelocker.cpp +++ b/tests/auto/qwritelocker/tst_qwritelocker.cpp @@ -177,7 +177,7 @@ void tst_QWriteLocker::unlockAndRelockTest() releaseThread(); waitForThread(); - // lock has been explicity relocked via QWriteLocker + // lock has been explicitly relocked via QWriteLocker QVERIFY(!thread->lock.tryLockForWrite()); releaseThread(); diff --git a/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp b/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp index 72fd41a6cd..80de6e96ad 100644 --- a/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp +++ b/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp @@ -536,12 +536,12 @@ void tst_QWSWindowSystem::dontFlushUnitializedWindowSurfaces() // At this point w has a windowsurface but it's completely covered by // the directpainter so nothing will be painted here and the - // windowsurface contains unitialized data. + // windowsurface contains uninitialized data. QApplication::processEvents(); QCOMPARE(p.allocatedRegion(), QRegion(r)); QCOMPARE(w.visibleRegion(), QRegion()); - fillWindowSurface(&w, Qt::black); // fill with "unitialized" data + fillWindowSurface(&w, Qt::black); // fill with "uninitialized" data p.setRegion(QRegion()); @@ -569,7 +569,7 @@ void tst_QWSWindowSystem::dontFlushUnitializedWindowSurfaces() QApplication::processEvents(); QCOMPARE(p.allocatedRegion(), QRegion(r)); QCOMPARE(w.visibleRegion(), QRegion()); - fillWindowSurface(&w, Qt::black); // fill with "unitialized" data + fillWindowSurface(&w, Qt::black); // fill with "uninitialized" data p.setRegion(QRegion()); diff --git a/tests/auto/selftests/subtest/tst_subtest.cpp b/tests/auto/selftests/subtest/tst_subtest.cpp index 2301fa6c51..4404a5103f 100644 --- a/tests/auto/selftests/subtest/tst_subtest.cpp +++ b/tests/auto/selftests/subtest/tst_subtest.cpp @@ -153,7 +153,7 @@ void tst_Subtest::test3() QFETCH(QString, str); - // second and third time we call this it shoud FAIL + // second and third time we call this it should FAIL QCOMPARE(str, QString("hello0")); printf("test2 end\n"); diff --git a/tests/auto/uiloader/tst_screenshot/main.cpp b/tests/auto/uiloader/tst_screenshot/main.cpp index 3a33994bb2..707a540091 100644 --- a/tests/auto/uiloader/tst_screenshot/main.cpp +++ b/tests/auto/uiloader/tst_screenshot/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ /* - * This programm takes a *.ui file and an output dir as argument in order to + * This program takes a *.ui file and an output dir as argument in order to * create a screenshot of the widget defined in the ui file. * * The screenshot is saved in the output dir (default current dir), ".png" is diff --git a/tests/benchmarks/corelib/io/qurl/main.cpp b/tests/benchmarks/corelib/io/qurl/main.cpp index ca6ec882f4..7e5035f250 100644 --- a/tests/benchmarks/corelib/io/qurl/main.cpp +++ b/tests/benchmarks/corelib/io/qurl/main.cpp @@ -229,7 +229,7 @@ void tst_qurl::equality() void tst_qurl::qmlPropertyWriteUseCase() { - QUrl base("file:///home/user/qt/demos/declarative/samegame/SamegameCore/"); + QUrl base("file:///home/user/qt/examples/declarative/samegame/SamegameCore/"); QString str("pics/redStar.png"); QBENCHMARK { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro index 53fa23b981..0135a24f94 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro @@ -12,8 +12,8 @@ build_all:!build_pass { } # install -target.path = $$[QT_INSTALL_DEMOS]/chip +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/chip sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.html *.doc images -sources.path = $$[QT_INSTALL_DEMOS]/chip +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/chip INSTALLS += target sources diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp index e7969d2bee..4c6289ea95 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp @@ -56,7 +56,7 @@ MainWindow::MainWindow(QWidget *parent) layout->addWidget(view); setLayout(layout); - setWindowTitle(tr("Chip Demo")); + setWindowTitle(tr("Chip Example")); } void MainWindow::populateScene() diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp index 994b53e382..c6167e50cb 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp @@ -60,7 +60,7 @@ ChipTester::ChipTester(QWidget *parent) populateScene(); setScene(scene); - setWindowTitle(tr("Chip Demo")); + setWindowTitle(tr("Chip Example")); } void ChipTester::setAntialias(bool enabled) diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index dc06e420fd..d96b110d54 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -469,6 +469,7 @@ private slots: void httpDownloadPerformance(); void httpDownloadPerformanceDownloadBuffer_data(); void httpDownloadPerformanceDownloadBuffer(); + void httpsRequestChain(); }; void tst_qnetworkreply::httpLatency() @@ -739,6 +740,87 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer() } } + +class HttpsRequestChainHelper : public QObject { + Q_OBJECT +public: + QList<QNetworkRequest> requestList; + + QElapsedTimer timeOneRequest; + QList<qint64> timeList; + + QElapsedTimer globalTime; + + QNetworkAccessManager manager; + + HttpsRequestChainHelper() { + } +public slots: + void doNextRequest() { + // all requests done + if (requestList.isEmpty()) { + QTestEventLoop::instance().exitLoop(); + return; + } + + if (qobject_cast<QNetworkReply*>(sender()) == 0) { + // first start after DNS lookup, start timer + globalTime.start(); + } + QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); + if (reply) { + QVERIFY(reply->error() == QNetworkReply::NoError); + qDebug() << "time =" << timeOneRequest.elapsed() << "ms"; + timeList.append(timeOneRequest.elapsed()); + } + + QNetworkRequest request = requestList.takeFirst(); + timeOneRequest.restart(); + reply = manager.get(request); + QObject::connect(reply, SIGNAL(sslErrors( const QList<QSslError> &)), reply, SLOT(ignoreSslErrors())); + QObject::connect(reply, SIGNAL(finished()), this, SLOT(doNextRequest())); + } + +}; + +void tst_qnetworkreply::httpsRequestChain() +{ + int count = 10; + + QNetworkRequest request(QUrl("https://" + QtNetworkSettings::serverName() + "/fluke.gif")); + //QNetworkRequest request(QUrl("https://www.nokia.com/robots.txt")); + // Disable keep-alive so we have the full re-connecting of TCP. + request.setRawHeader("Connection", "close"); + + HttpsRequestChainHelper helper; + for (int i = 0; i < count; i++) + helper.requestList.append(request); + + // Warm up DNS cache and then immediatly start HTTP + QHostInfo::lookupHost(QtNetworkSettings::serverName(), &helper, SLOT(doNextRequest())); + //QHostInfo::lookupHost("www.nokia.com", &helper, SLOT(doNextRequest())); + + // we can use QBENCHMARK_ONCE when we find out how to make it really run once. + // there is still a warmup-run :( + + //QBENCHMARK_ONCE { + QTestEventLoop::instance().enterLoop(40); + QVERIFY(!QTestEventLoop::instance().timeout()); + //} + + qint64 elapsed = helper.globalTime.elapsed(); + + qint64 average = (elapsed / count); + + qSort(helper.timeList); + qint64 median = helper.timeList.at(5); + + qDebug() << "Total:" << elapsed << " Average:" << average << " Median:" << median; + +} + + + QTEST_MAIN(tst_qnetworkreply) #include "tst_qnetworkreply.moc" |