From b3241c55df9c6a5117aaf4c5d37f7f2791e6253f Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 6 Jul 2011 15:25:02 +0200 Subject: Make qtextlayout autotests to compile Change-Id: I6c3a773da54c0a08da553104bb09840f6489e7d0 Reviewed-on: http://codereview.qt.nokia.com/1238 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang Reviewed-by: Sergio Ahumada --- tests/auto/qtextlayout/qtextlayout.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') 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 { -- cgit v1.2.3 From c0c6dd2b022cfd667f32b8a48bcac86ac07d3880 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 6 Jul 2011 16:37:14 +0200 Subject: Use Q_DECL_CONSTEXPR in QFlags Change-Id: I851e0b1c3f80a7b33a38cb1ab2665dc0f3c73adc Reviewed-on: http://codereview.qt.nokia.com/1248 Reviewed-by: Qt Sanity Bot Reviewed-by: Gabriel de Dietrich --- tests/auto/qflags/tst_qflags.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/auto') 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 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::LeftButton ^ Qt::RightButton)); + QVERIFY(verifyConstExpr(0)); + QVERIFY(verifyConstExpr(Qt::RightButton)); + QVERIFY(verifyConstExpr(0xff)); + + QVERIFY(!verifyConstExpr(!Qt::MouseButtons(Qt::LeftButton))); +#endif +} + + QTEST_MAIN(tst_QFlags) #include "tst_qflags.moc" -- cgit v1.2.3 From 10a79f783bcf2c39ef28f7d75cc6b70bfd09aa93 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 6 Jul 2011 23:06:42 +0200 Subject: Doc: Fixing typo (cherry picked from commit 7f5797a784e237672f291055020ef4bbb6199893) Conflicts: tests/auto/qaccessibility/tst_qaccessibility.cpp tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp Change-Id: I8bab7ee83f6e32bba2574aad82b288fb05b503eb Reviewed-on: http://codereview.qt.nokia.com/1253 Reviewed-by: Casper van Donderen --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 +- tests/auto/qlistwidget/tst_qlistwidget.cpp | 18 +++++++++--------- tests/auto/qmenubar/tst_qmenubar.cpp | 2 +- tests/auto/qmutexlocker/tst_qmutexlocker.cpp | 2 +- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 8 ++++---- .../qnetworksession/test/tst_qnetworksession.cpp | 22 +++++++++++----------- tests/auto/qreadlocker/tst_qreadlocker.cpp | 2 +- tests/auto/qreadwritelock/tst_qreadwritelock.cpp | 6 +++--- .../auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 2 +- tests/auto/qtextcodec/tst_qtextcodec.cpp | 2 +- tests/auto/qtextcursor/tst_qtextcursor.cpp | 2 +- tests/auto/qvector/tst_qvector.cpp | 2 +- tests/auto/qwizard/tst_qwizard.cpp | 2 +- tests/auto/qwritelocker/tst_qwritelocker.cpp | 2 +- tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp | 6 +++--- tests/auto/selftests/subtest/tst_subtest.cpp | 2 +- tests/auto/uiloader/tst_screenshot/main.cpp | 2 +- 17 files changed, 42 insertions(+), 42 deletions(-) (limited to 'tests/auto') 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/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..eb036ea293 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2511,7 +2511,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 +2801,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 +2910,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 +6262,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(); 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 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/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/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 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 -- cgit v1.2.3 From f96a19d1b474292940dab3a20194a88395aca8ed Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 7 Jul 2011 15:31:19 +0200 Subject: Fix a crash when D-Bus library can't be loaded In certain sandboxes, we have libQtDBus, but not D-Bus. QtDBus shouldn't crash in that case, but return non-working QDBusConnection instances instead. Change-Id: Ia4ac78d1197bae50cde0cf07e6fc66fc25b85011 Reviewed-on: http://codereview.qt.nokia.com/1319 Reviewed-by: Qt Sanity Bot Reviewed-by: Robert Griebl --- tests/auto/dbus.pro | 1 + .../qdbusconnection_no_bus.pro | 9 +++ .../tst_qdbusconnection_no_bus.cpp | 84 ++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 tests/auto/qdbusconnection_no_bus/qdbusconnection_no_bus.pro create mode 100644 tests/auto/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp (limited to 'tests/auto') 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/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 +#include + +#include +#include + +#include + +/* 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" + -- cgit v1.2.3 From 948d051fb145ad486e0409cb219bab9616328502 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 7 Jul 2011 17:42:55 +0200 Subject: QNAM: Add support for more KnownHeaders Task-Number: QTBUG-17267 Change-Id: I32b41d26411ee3a7162bb658d69363a5eeb37230 Reviewed-on: http://codereview.qt.nokia.com/1327 Reviewed-by: Qt Sanity Bot Reviewed-by: Martin Petersson --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index eb036ea293..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()); } @@ -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() { -- cgit v1.2.3 From c82af87b5375eacaabc81b8fe7e75f83d27bc6e5 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Mon, 11 Jul 2011 10:47:16 +0200 Subject: QSslSocket: Add accessors for SSL version This commit adds accessors for both the openssl version number and the version string. The intention here is to aid debugging by making it possible for applications to know which version of the openssl library has been found by the runtime linking code. Since the version of openssl in use will depend on the installation of the developer, the test cases merely display the version string and number rather than verifying that any particular version is in use. Change-Id: Ieec44f0941f99887c85c2858bab0481722d739e5 Merge-request: 12 Reviewed-by: Peter Hartmann Reviewed-on: http://codereview.qt.nokia.com/1406 Reviewed-by: Qt Sanity Bot --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto') 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) -- cgit v1.2.3 From 852d4b03f612748fb16f592dda884e9634b468cf Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Mon, 11 Jul 2011 16:15:14 +0200 Subject: SSL: Add methods to access the tags of the subject and issuer of a cert Add methods that return a list of the tags in use in a certificate issuer or subject. This means that unknown elements of these fields can be accessed. Change-Id: I588989e34f541b1d31cc9e97f5a85d1624ece1b1 Merge-request: 18 Reviewed-by: Peter Hartmann Reviewed-on: http://codereview.qt.nokia.com/1451 --- .../more-certificates/natwest-banking.pem | 36 ++++++++++++ .../more-certificates/test-cn-with-drink-cert.pem | 66 ++++++++++++++++++++++ tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 18 ++++++ 3 files changed, 120 insertions(+) create mode 100644 tests/auto/qsslcertificate/more-certificates/natwest-banking.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem (limited to 'tests/auto') 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..c04f315060 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 subjectAndIssuerTags(); // ### 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::subjectAndIssuerTags() +{ + QList 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 tags = certList[0].subjectInfoTags(); + QVERIFY(tags.contains(QByteArray("favouriteDrink"))); + tags.clear(); + + certList = QSslCertificate::fromPath(SRCDIR "more-certificates/natwest-banking.pem"); + QVERIFY2(certList.count() > 0, "Please run this test from the source directory"); + + tags = certList[0].subjectInfoTags(); + QVERIFY(tags.contains(QByteArray("1.3.6.1.4.1.311.60.2.1.3"))); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) -- cgit v1.2.3 From 94e110ca5f70f61bb7f6a99be121e5d78670a22a Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 11 Jul 2011 16:39:14 +0200 Subject: QSslCertificate: rename "tag" to "attribute", as in the RFC RFC 2459 "Internet X.509 Public Key Infrastructure" uses the word "attribute" for fields in a certificate like common name, organization etc. Change-Id: I51e595acbe3e146acf81af21cf48e554fa9490e4 Reviewed-on: http://codereview.qt.nokia.com/1453 Reviewed-by: Qt Sanity Bot Reviewed-by: Martin Petersson --- tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index c04f315060..f12af0275c 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -115,7 +115,7 @@ private slots: void blacklistedCertificates(); void toText(); void multipleCommonNames(); - void subjectAndIssuerTags(); + void subjectAndIssuerAttributes(); // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted @@ -884,21 +884,21 @@ void tst_QSslCertificate::multipleCommonNames() QVERIFY(commonNames.contains(QString("www2.example.com"))); } -void tst_QSslCertificate::subjectAndIssuerTags() +void tst_QSslCertificate::subjectAndIssuerAttributes() { QList 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 tags = certList[0].subjectInfoTags(); - QVERIFY(tags.contains(QByteArray("favouriteDrink"))); - tags.clear(); + QList 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"); - tags = certList[0].subjectInfoTags(); - QVERIFY(tags.contains(QByteArray("1.3.6.1.4.1.311.60.2.1.3"))); + attributes = certList[0].subjectInfoAttributes(); + QVERIFY(attributes.contains(QByteArray("1.3.6.1.4.1.311.60.2.1.3"))); } #endif // QT_NO_OPENSSL -- cgit v1.2.3 From 6054ca2a313d6164874e3e57bd5fb12be66a5c44 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 12 Jul 2011 09:08:05 +0200 Subject: Compile with C++0x enabled Change-Id: Iffee297c6bc3a53a95cd42fe6ad8901d7b791a11 Reviewed-on: http://codereview.qt.nokia.com/1485 Reviewed-by: Qt Sanity Bot Reviewed-by: Olivier Goffart --- tests/auto/qbytearray/tst_qbytearray.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto') 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; -- cgit v1.2.3 From a3ac4f26e1bc699f1e4ef15853d6db32f13d5c7f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 12 Jul 2011 09:08:28 +0200 Subject: Add autotest for QStringLiteral MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia5a82bf3bf489373bc0823065aa9c2990430440c Reviewed-on: http://codereview.qt.nokia.com/1486 Reviewed-by: Qt Sanity Bot Reviewed-by: João Abecasis --- tests/auto/qstring/tst_qstring.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/auto') 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 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) -- cgit v1.2.3