summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-24 16:37:58 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-24 18:34:11 +0100
commitd0c360fd88760372f4f67219440ee17a11023d98 (patch)
treee08ad106519090524a526a43d82500c0a0775171 /tests
parent9c6a91d07bae5517a9909ef5b6f4acb1e99ec948 (diff)
parent627d9cbd3c45834fe7aa1f2ee37fdfca07a03976 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp12
-rw-r--r--tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp28
-rw-r--r--tests/auto/other/other.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp57
-rw-r--r--tests/manual/qnetworkreply/main.cpp43
-rw-r--r--tests/manual/qnetworkreply/qnetworkreply.pro2
6 files changed, 139 insertions, 5 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 883d6a0c1d..8cdad67966 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -1653,6 +1653,10 @@ void tst_QLocale::ampm()
QLocale tr("tr_TR");
QCOMPARE(tr.amText(), QString::fromUtf8("\303\226\303\226"));
QCOMPARE(tr.pmText(), QString::fromUtf8("\303\226\123"));
+
+ QLocale id("id_ID");
+ QCOMPARE(id.amText(), QLatin1String("AM"));
+ QCOMPARE(id.pmText(), QLatin1String("PM"));
}
void tst_QLocale::dateFormat()
@@ -1681,6 +1685,14 @@ void tst_QLocale::timeFormat()
QCOMPARE(no.timeFormat(QLocale::NarrowFormat), QLatin1String("HH:mm"));
QCOMPARE(no.timeFormat(QLocale::ShortFormat), QLatin1String("HH:mm"));
QCOMPARE(no.timeFormat(QLocale::LongFormat), QLatin1String("'kl'. HH:mm:ss t"));
+
+ const QLocale id("id_ID");
+ QCOMPARE(id.timeFormat(QLocale::ShortFormat), QLatin1String("HH.mm"));
+ QCOMPARE(id.timeFormat(QLocale::LongFormat), QLatin1String("HH.mm.ss t"));
+
+ const QLocale cat("ca_ES");
+ QCOMPARE(cat.timeFormat(QLocale::ShortFormat), QLatin1String("H.mm"));
+ QCOMPARE(cat.timeFormat(QLocale::LongFormat), QLatin1String("H.mm.ss t"));
}
void tst_QLocale::dateTimeFormat()
diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
index bf6fde896b..eb04be10c8 100644
--- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
+++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
@@ -46,7 +46,10 @@
#include <QNetworkProxy>
#include <QAuthenticator>
+#ifdef QT_BUILD_INTERNAL
#include "private/qhostinfo_p.h"
+#include "private/qsslsocket_p.h"
+#endif
#include "../../../network-settings.h"
@@ -211,12 +214,31 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
socket3->connectToHostEncrypted(host, 443);
QVERIFY(!socket3->waitForEncrypted());
- // setting empty SSL configuration explicitly -> should not work
+ // setting empty SSL configuration explicitly -> depends on on-demand loading
QSslSocketPtr socket4 = newSocket();
this->socket = socket4.data();
- socket4->setSslConfiguration(QSslConfiguration());
+ QSslConfiguration conf;
+ socket4->setSslConfiguration(conf);
socket4->connectToHostEncrypted(host, 443);
- QVERIFY(!socket4->waitForEncrypted());
+#ifdef QT_BUILD_INTERNAL
+ bool rootCertLoadingAllowed = QSslSocketPrivate::rootCertOnDemandLoadingSupported();
+#if defined(Q_OS_LINUX) || defined (Q_OS_BLACKBERRY)
+ QCOMPARE(rootCertLoadingAllowed, true);
+#elif defined(Q_OS_MAC)
+ QCOMPARE(rootCertLoadingAllowed, false);
+#endif // other platforms: undecided (Windows: depends on the version)
+ // when we allow on demand loading, it is enabled by default,
+ // so on Unix it will work without setting any certificates. Otherwise,
+ // the configuration contains an empty set of certificates
+ // and will fail.
+ bool works;
+#if defined (Q_OS_WIN)
+ works = false; // on Windows, this won't work even though we use on demand loading
+#else
+ works = rootCertLoadingAllowed;
+#endif
+ QCOMPARE(socket4->waitForEncrypted(), works);
+#endif // QT_BUILD_INTERNAL
}
#endif // QT_NO_OPENSSL
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index ea6290db42..35aaf4d48f 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -50,7 +50,7 @@ cross_compile: SUBDIRS -= \
wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility
-!contains(QT_CONFIG, accessibility)|!contains(QT_CONFIG, xcb): SUBDIRS -= qaccessibilitylinux
+!contains(QT_CONFIG, accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux
!mac: SUBDIRS -= \
macgui \
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index b62e916a82..56cf27155d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -429,6 +429,7 @@ private slots:
void ensureDirtySceneTransform();
void focusScope();
void focusScope2();
+ void focusScopeItemChangedWhileScopeDoesntHaveFocus();
void stackBefore();
void sceneModality();
void panelModality();
@@ -9405,6 +9406,62 @@ void tst_QGraphicsItem::focusScope2()
QCOMPARE(siblingFocusScope->focusItem(), (QGraphicsItem *)siblingChild2);
}
+class FocusScopeItemPrivate;
+class FocusScopeItem : public QGraphicsItem
+{
+ Q_DECLARE_PRIVATE(FocusScopeItem)
+public:
+ FocusScopeItem(QGraphicsItem *parent = 0);
+ QRectF boundingRect() const { return QRectF(); }
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) { }
+
+ int focusScopeChanged;
+ FocusScopeItemPrivate *d_ptr;
+};
+
+class FocusScopeItemPrivate : QGraphicsItemPrivate
+{
+ Q_DECLARE_PUBLIC(FocusScopeItem)
+public:
+ void focusScopeItemChange(bool)
+ { ++q_func()->focusScopeChanged; }
+};
+
+FocusScopeItem::FocusScopeItem(QGraphicsItem *parent)
+ : QGraphicsItem(*new FocusScopeItemPrivate, parent), focusScopeChanged(0)
+{
+ setFlag(ItemIsFocusable);
+}
+
+void tst_QGraphicsItem::focusScopeItemChangedWhileScopeDoesntHaveFocus()
+{
+ QGraphicsRectItem rect;
+ rect.setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable);
+
+ FocusScopeItem *child1 = new FocusScopeItem(&rect);
+ FocusScopeItem *child2 = new FocusScopeItem(&rect);
+
+ QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)0);
+ QCOMPARE(child1->focusScopeChanged, 0);
+ QCOMPARE(child2->focusScopeChanged, 0);
+ child1->setFocus();
+ QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)child1);
+ QCOMPARE(child1->focusScopeChanged, 1);
+ QCOMPARE(child2->focusScopeChanged, 0);
+ child2->setFocus();
+ QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)child2);
+ QCOMPARE(child1->focusScopeChanged, 2);
+ QCOMPARE(child2->focusScopeChanged, 1);
+ child1->setFocus();
+ QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)child1);
+ QCOMPARE(child1->focusScopeChanged, 3);
+ QCOMPARE(child2->focusScopeChanged, 2);
+ child1->clearFocus();
+ QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)0);
+ QCOMPARE(child1->focusScopeChanged, 4);
+ QCOMPARE(child2->focusScopeChanged, 2);
+}
+
void tst_QGraphicsItem::stackBefore()
{
QGraphicsRectItem parent;
diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp
index b8b20ec4da..feb07b4c7d 100644
--- a/tests/manual/qnetworkreply/main.cpp
+++ b/tests/manual/qnetworkreply/main.cpp
@@ -46,8 +46,13 @@
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkaccessmanager.h>
+#include <QtNetwork/qsslconfiguration.h>
#include "../../auto/network-settings.h"
+#ifdef QT_BUILD_INTERNAL
+#include "private/qsslsocket_p.h"
+#endif
+
#define BANDWIDTH_LIMIT_BYTES (1024*100)
#define TIME_ESTIMATION_SECONDS (97)
@@ -58,6 +63,8 @@ private slots:
void initTestCase();
void limiting_data();
void limiting();
+ void setSslConfiguration_data();
+ void setSslConfiguration();
};
QNetworkReply *reply;
@@ -129,6 +136,42 @@ void tst_qnetworkreply::limiting()
QVERIFY(!QTestEventLoop::instance().timeout());
}
+void tst_qnetworkreply::setSslConfiguration_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<bool>("works");
+
+ QTest::newRow("codereview.qt-project.org") << QUrl("https://codereview.qt-project.org") << true;
+ QTest::newRow("test-server") << QUrl("https://" + QtNetworkSettings::serverName() + "/") << false;
+}
+
+void tst_qnetworkreply::setSslConfiguration()
+{
+ QFETCH(QUrl, url);
+ QNetworkRequest request(url);
+ QSslConfiguration conf = request.sslConfiguration();
+ conf.setProtocol(QSsl::TlsV1_0); // TLS 1.0 will be used anyway, just make sure we change the configuration
+ request.setSslConfiguration(conf);
+ QNetworkAccessManager manager;
+ reply = manager.get(request);
+ QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(15);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+#ifdef QT_BUILD_INTERNAL
+ QFETCH(bool, works);
+ bool rootCertLoadingAllowed = QSslSocketPrivate::rootCertOnDemandLoadingSupported();
+#if defined(Q_OS_LINUX) || defined (Q_OS_BLACKBERRY)
+ QCOMPARE(rootCertLoadingAllowed, true);
+#elif defined(Q_OS_MAC)
+ QCOMPARE(rootCertLoadingAllowed, false);
+#endif // other platforms: undecided (Windows: depends on the version)
+ if (works) {
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ } else {
+ QCOMPARE(reply->error(), QNetworkReply::SslHandshakeFailedError);
+ }
+#endif
+}
QTEST_MAIN(tst_qnetworkreply)
diff --git a/tests/manual/qnetworkreply/qnetworkreply.pro b/tests/manual/qnetworkreply/qnetworkreply.pro
index 3d98ee429f..64666103a0 100644
--- a/tests/manual/qnetworkreply/qnetworkreply.pro
+++ b/tests/manual/qnetworkreply/qnetworkreply.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = tst_qnetworkreply
QT -= gui
-QT += network testlib
+QT += core-private network network-private testlib
SOURCES += main.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0