summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST2
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp18
-rw-r--r--tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp26
-rw-r--r--tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro2
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp16
-rw-r--r--tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro2
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp8
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp33
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp29
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp5
-rw-r--r--tests/auto/corelib/thread/qsemaphore/BLACKLIST1
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp69
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp1
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp16
-rw-r--r--tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp255
-rw-r--r--tests/auto/network/access/qnetworkreply/test/test.pro2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp20
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp12
-rw-r--r--tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp53
-rw-r--r--tests/auto/network/ssl/qsslsocket/BLACKLIST2
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp18
-rw-r--r--tests/auto/other/macgui/BLACKLIST2
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp15
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h2
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm19
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST1
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp13
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp38
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp4
-rw-r--r--tests/auto/widgets/widgets/qmenu/qmenu.pro2
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp16
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp3
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp1
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp1
-rw-r--r--tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp3
-rw-r--r--tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp1
-rw-r--r--tests/manual/widgets/widgets.pro2
-rw-r--r--tests/manual/widgets/widgets/multiscreen-menus/main.cpp41
-rw-r--r--tests/manual/widgets/widgets/multiscreen-menus/mainwindow.cpp64
-rw-r--r--tests/manual/widgets/widgets/multiscreen-menus/mainwindow.h52
-rw-r--r--tests/manual/widgets/widgets/multiscreen-menus/mainwindow.ui86
-rw-r--r--tests/manual/widgets/widgets/multiscreen-menus/multiscreen-menus.pro9
43 files changed, 860 insertions, 107 deletions
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST
index 36b777de34..391e3f67af 100644
--- a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST
@@ -2,4 +2,4 @@
windows
[finishWithUncontrolledAnimation]
windows
-macos-10.12
+osx-10.12
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index d70b099fe3..7dd1a1be01 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -111,19 +111,19 @@ void tst_QFlags::constExpr()
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<uint((Qt::LeftButton | Qt::RightButton) & Qt::LeftButton)>(Qt::LeftButton));
+ QVERIFY(verifyConstExpr<uint((Qt::LeftButton | Qt::RightButton) & Qt::MiddleButton)>(0));
+ QVERIFY(verifyConstExpr<uint((Qt::LeftButton | Qt::RightButton) | Qt::MiddleButton)>(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton));
+ QVERIFY(verifyConstExpr<uint(~(Qt::LeftButton | Qt::RightButton))>(~(Qt::LeftButton | Qt::RightButton)));
+ QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(Qt::LeftButton) ^ Qt::RightButton)>(Qt::LeftButton ^ Qt::RightButton));
+ QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(0))>(0));
+ QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(Qt::RightButton) & 0xff)>(Qt::RightButton));
+ QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(Qt::RightButton) | 0xff)>(0xff));
QVERIFY(!verifyConstExpr<Qt::RightButton>(!Qt::MouseButtons(Qt::LeftButton)));
#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
- QVERIFY(verifyConstExpr<testRelaxedConstExpr()>(Qt::MiddleButton));
+ QVERIFY(verifyConstExpr<uint(testRelaxedConstExpr())>(Qt::MiddleButton));
#endif
#endif
}
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
index 0a74dc64c0..1643eed3d2 100644
--- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
+++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
@@ -202,18 +202,15 @@ private slots:
QLoggingRegistry registry;
registry.init();
- QCOMPARE(registry.apiRules.size(), 0);
- QCOMPARE(registry.configRules.size(), 0);
- QCOMPARE(registry.envRules.size(), 1);
-
- QCOMPARE(registry.rules.size(), 1);
+ QCOMPARE(registry.ruleSets[QLoggingRegistry::ApiRules].size(), 0);
+ QCOMPARE(registry.ruleSets[QLoggingRegistry::ConfigRules].size(), 0);
+ QCOMPARE(registry.ruleSets[QLoggingRegistry::EnvironmentRules].size(), 1);
// check that QT_LOGGING_RULES take precedence
qputenv("QT_LOGGING_RULES", "Digia.*=true");
registry.init();
- QCOMPARE(registry.envRules.size(), 2);
- QCOMPARE(registry.envRules.at(1).enabled, true);
- QCOMPARE(registry.rules.size(), 2);
+ QCOMPARE(registry.ruleSets[QLoggingRegistry::EnvironmentRules].size(), 2);
+ QCOMPARE(registry.ruleSets[QLoggingRegistry::EnvironmentRules].at(1).enabled, true);
}
void QLoggingRegistry_config()
@@ -238,7 +235,7 @@ private slots:
QLoggingRegistry registry;
registry.init();
- QCOMPARE(registry.configRules.size(), 1);
+ QCOMPARE(registry.ruleSets[QLoggingRegistry::ConfigRules].size(), 1);
// remove file again
QVERIFY(file.remove());
@@ -260,10 +257,9 @@ private slots:
QLoggingRegistry *registry = QLoggingRegistry::instance();
// empty all rules , check default
- registry->rules.clear();
- registry->apiRules.clear();
- registry->configRules.clear();
- registry->envRules.clear();
+ registry->ruleSets[QLoggingRegistry::ApiRules].clear();
+ registry->ruleSets[QLoggingRegistry::ConfigRules].clear();
+ registry->ruleSets[QLoggingRegistry::EnvironmentRules].clear();
registry->updateRules();
QVERIFY(cat.isWarningEnabled());
@@ -271,7 +267,7 @@ private slots:
// set Config rule
QLoggingSettingsParser parser;
parser.setContent("[Rules]\nDigia.*=false");
- registry->configRules=parser.rules();
+ registry->ruleSets[QLoggingRegistry::ConfigRules] = parser.rules();
registry->updateRules();
QVERIFY(!cat.isWarningEnabled());
@@ -283,7 +279,7 @@ private slots:
// set Env rule, should overwrite Config one
parser.setContent("Digia.*=false");
- registry->envRules=parser.rules();
+ registry->ruleSets[QLoggingRegistry::EnvironmentRules] = parser.rules();
registry->updateRules();
QVERIFY(!cat.isWarningEnabled());
diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
index c72d9e4fad..9fd7047405 100644
--- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
+++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
@@ -1,5 +1,7 @@
CONFIG += testcase
TARGET = tst_qstandardpaths
QT = core testlib
+INCLUDEPATH += ../../../../shared/
+HEADERS += ../../../../shared/emulationdetector.h
SOURCES = tst_qstandardpaths.cpp
TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 0a00e00d83..3de777653e 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -46,6 +46,8 @@
#define Q_XDG_PLATFORM
#endif
+#include "emulationdetector.h"
+
// Update this when adding new enum values; update enumNames too
static const int MaxStandardLocation = QStandardPaths::AppConfigLocation;
@@ -485,14 +487,24 @@ void tst_qstandardpaths::testCustomRuntimeDirectory()
EnvVarRestorer restorer;
// When $XDG_RUNTIME_DIR points to a directory with wrong ownership, QStandardPaths should warn
- qputenv("XDG_RUNTIME_DIR", QFile::encodeName("/tmp"));
+ QByteArray rootOwnedFileName = "/tmp";
+ if (EmulationDetector::isRunningArmOnX86()) {
+ // Directory "tmp" under toolchain sysroot is detected by qemu and has same uid as current user.
+ // Try /opt instead, it might not be located in the sysroot.
+ QFileInfo rootOwnedFile = QFileInfo(QString::fromLatin1(rootOwnedFileName));
+ if (rootOwnedFile.ownerId() == ::geteuid()) {
+ rootOwnedFileName = "/opt";
+ }
+ }
+ qputenv("XDG_RUNTIME_DIR", QFile::encodeName(rootOwnedFileName));
+
// It's very unlikely that /tmp is 0600 or that we can chmod it
// The call below outputs
// "QStandardPaths: wrong ownership on runtime directory /tmp, 0 instead of $UID"
// but we can't reliably expect that it's owned by uid 0, I think.
const uid_t uid = geteuid();
QTest::ignoreMessage(QtWarningMsg,
- qPrintable(QString::fromLatin1("QStandardPaths: wrong ownership on runtime directory /tmp, 0 instead of %1").arg(uid)));
+ qPrintable(QString::fromLatin1("QStandardPaths: wrong ownership on runtime directory " + rootOwnedFileName + ", 0 instead of %1").arg(uid)));
const QString runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
QVERIFY2(runtimeDir.isEmpty(), qPrintable(runtimeDir));
diff --git a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro
index 4a69971f78..351e263093 100644
--- a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro
+++ b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro
@@ -1,5 +1,7 @@
CONFIG += testcase
TARGET = tst_qtemporarydir
SOURCES += tst_qtemporarydir.cpp
+INCLUDEPATH += ../../../../shared/
+HEADERS += ../../../../shared/emulationdetector.h
QT = core testlib
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 758bbead84..4bed8d0fd6 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -42,6 +42,7 @@
# include <sys/types.h>
# include <unistd.h>
#endif
+#include "emulationdetector.h"
class tst_QTemporaryDir : public QObject
{
@@ -316,6 +317,13 @@ void tst_QTemporaryDir::nonWritableCurrentDir()
const QFileInfo nonWritableDirFi = QFileInfo(QLatin1String(nonWritableDir));
QVERIFY(nonWritableDirFi.isDir());
+
+ if (EmulationDetector::isRunningArmOnX86()) {
+ if (nonWritableDirFi.ownerId() == ::geteuid()) {
+ QSKIP("Sysroot directories are owned by the current user");
+ }
+ }
+
QVERIFY(!nonWritableDirFi.isWritable());
ChdirOnReturn cor(QDir::currentPath());
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index f5835ec5f4..bcf6d6c32b 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -650,6 +650,31 @@ void tst_QUrlInternal::ace_testsuite_data()
<< "xn--djrptm67aikb.xn--kpry57d"
<< "."
<< taiwaneseIDN;
+
+ // violations / invalids
+ QTest::newRow("invalid-punycode") << "xn--z" << "xn--z" << "xn--z" << "xn--z";
+
+ // U+00A0 NO-BREAK SPACE encodes to Punycode "6a"
+ // but it is prohibited and should have caused encoding failure
+ QTest::newRow("invalid-nameprep-prohibited") << "xn--6a" << "xn--6a" << "xn--6a" << "xn--6a";
+
+ // U+00AD SOFT HYPHEN between "a" and "b" encodes to Punycode "ab-5da"
+ // but it should have been removed in the nameprep stage
+ QTest::newRow("invalid-nameprep-maptonothing") << "xn-ab-5da" << "xn-ab-5da" << "xn-ab-5da" << "xn-ab-5da";
+
+ // U+00C1 LATIN CAPITAL LETTER A WITH ACUTE encodes to Punycode "4ba"
+ // but it should have nameprepped to lowercase first
+ QTest::newRow("invalid-nameprep-uppercase") << "xn--4ba" << "xn--4ba" << "xn--4ba" << "xn--4ba";
+
+ // U+00B5 MICRO SIGN encodes to Punycode "sba"
+ // but is should have nameprepped to NFKC U+03BC GREEK SMALL LETTER MU
+ QTest::newRow("invalid-nameprep-nonnfkc") << "xn--sba" << "xn--sba" << "xn--sba" << "xn--sba";
+
+ // U+04CF CYRILLIC SMALL LETTER PALOCHKA encodes to "s5a"
+ // but it's not in RFC 3454's allowed character list (Unicode 3.2)
+ QTest::newRow("invalid-nameprep-unassigned") << "xn--s5a" << "xn--s5a" << "xn--s5a" << "xn--s5a";
+ // same character, see QTBUG-60364
+ QTest::newRow("invalid-nameprep-unassigned2") << "xn--80ak6aa92e" << "xn--80ak6aa92e" << "xn--80ak6aa92e" << "xn--80ak6aa92e";
}
void tst_QUrlInternal::ace_testsuite()
@@ -670,6 +695,14 @@ void tst_QUrlInternal::ace_testsuite()
QCOMPARE(QUrl::fromAce(domain.toLatin1()), fromace + suffix);
QCOMPARE(QUrl::fromAce(QUrl::toAce(domain)), unicode + suffix);
+ QUrl u;
+ u.setHost(domain);
+ QVERIFY(u.isValid());
+ QCOMPARE(u.host(), unicode + suffix);
+ QCOMPARE(u.host(QUrl::EncodeUnicode), toace + suffix);
+ QCOMPARE(u.toEncoded(), "//" + toace.toLatin1() + suffix);
+ QCOMPARE(u.toDisplayString(), "//" + unicode + suffix);
+
domain = in + (suffix ? ".troll.No" : "");
QCOMPARE(QString::fromLatin1(QUrl::toAce(domain)), toace + suffix);
if (fromace != ".")
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 14c1b29836..c884edde04 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -209,6 +209,7 @@ private slots:
void invokeMetaConstructor();
void invokeTypedefTypes();
void invokeException();
+ void invokeQueuedAutoRegister();
void qtMetaObjectInheritance();
void normalizedSignature_data();
void normalizedSignature();
@@ -380,6 +381,7 @@ class QtTestObject: public QObject
public:
QtTestObject();
+ QtTestObject(const QString &s) : slotResult(s) {}
Q_INVOKABLE QtTestObject(QObject *parent);
public slots:
@@ -419,6 +421,15 @@ public slots:
return s2;
}
+ void slotWithRegistrableArgument(QtTestObject *o1, QPointer<QtTestObject> o2,
+ QSharedPointer<QtTestObject> o3, QWeakPointer<QtTestObject> o4,
+ QVector<QtTestObject *> o5, QList<QtTestObject *> o6)
+ {
+ slotResult = QLatin1String("slotWithRegistrableArgument:") + o1->slotResult + o2->slotResult
+ + o3->slotResult + o4.data()->slotResult + QString::number(o5.size())
+ + QString::number(o6.size());
+ }
+
public:
static void staticFunction0();
static qint64 staticFunction1();
@@ -1114,6 +1125,24 @@ void tst_QMetaObject::invokeException()
#endif
}
+void tst_QMetaObject::invokeQueuedAutoRegister()
+{
+ QtTestObject obj;
+
+ auto shared = QSharedPointer<QtTestObject>::create(QStringLiteral("myShared-"));
+
+ QVERIFY(QMetaObject::invokeMethod(
+ &obj, "slotWithRegistrableArgument", Qt::QueuedConnection,
+ Q_ARG(QtTestObject *, shared.data()), Q_ARG(QPointer<QtTestObject>, shared.data()),
+ Q_ARG(QSharedPointer<QtTestObject>, shared), Q_ARG(QWeakPointer<QtTestObject>, shared),
+ Q_ARG(QVector<QtTestObject *>, QVector<QtTestObject *>()),
+ Q_ARG(QList<QtTestObject *>, QList<QtTestObject *>())));
+ QVERIFY(obj.slotResult.isEmpty());
+ qApp->processEvents(QEventLoop::AllEvents);
+ QCOMPARE(obj.slotResult,
+ QString("slotWithRegistrableArgument:myShared-myShared-myShared-myShared-00"));
+}
+
void tst_QMetaObject::normalizedSignature_data()
{
QTest::addColumn<QString>("signature");
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
index 1598382959..a52b80170f 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -360,11 +360,16 @@ void tst_QSocketNotifier::asyncMultipleDatagram()
QSignalSpy spy(m_asyncReceiver, &QIODevice::readyRead);
connect(m_asyncReceiver, &QIODevice::readyRead, this,
&tst_QSocketNotifier::async_readDatagramSlot);
+
+ // activate socket notifiers
+ QTestEventLoop::instance().enterLoopMSecs(100);
+
m_asyncSender->writeDatagram("1", makeNonAny(m_asyncReceiver->localAddress()), port);
m_asyncSender->writeDatagram("2", makeNonAny(m_asyncReceiver->localAddress()), port);
// wait a little to ensure that the datagrams we've just sent
// will be delivered on receiver side.
QTest::qSleep(100);
+ QVERIFY(m_asyncReceiver->hasPendingDatagrams());
QTimer::singleShot(500, this, &tst_QSocketNotifier::async_writeDatagramSlot);
diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST
index 06ae815f29..c198b90253 100644
--- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST
+++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST
@@ -1,4 +1,5 @@
[tryAcquireWithTimeout:0.2s]
windows
+osx-10.12
[tryAcquireWithTimeout:2s]
windows
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index c34bee64b1..0015efacfa 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -51,7 +51,7 @@ private slots:
void contains(); // copied from tst_QMap
void qhash();
void take(); // copied from tst_QMap
- void operator_eq(); // copied from tst_QMap
+ void operator_eq(); // slightly modified from tst_QMap
void rehash_isnt_quadratic();
void dont_need_default_constructor();
void qmultihash_specific();
@@ -772,7 +772,7 @@ void tst_QHash::take()
QVERIFY(!map.contains(3));
}
-//copied from tst_QMap
+// slightly modified from tst_QMap
void tst_QHash::operator_eq()
{
{
@@ -849,6 +849,71 @@ void tst_QHash::operator_eq()
QVERIFY(a != b);
QVERIFY(!(a == b));
}
+
+ // unlike multi-maps, multi-hashes should be equal iff their contents are equal,
+ // regardless of insertion or iteration order
+
+ {
+ QHash<int, int> a;
+ QHash<int, int> b;
+
+ a.insertMulti(0, 0);
+ a.insertMulti(0, 1);
+
+ b.insertMulti(0, 1);
+ b.insertMulti(0, 0);
+
+ QVERIFY(a == b);
+ QVERIFY(!(a != b));
+ }
+
+ {
+ QHash<int, int> a;
+ QHash<int, int> b;
+
+ enum { Count = 100 };
+
+ for (int key = 0; key < Count; ++key) {
+ for (int value = 0; value < Count; ++value)
+ a.insertMulti(key, value);
+ }
+
+ for (int key = Count - 1; key >= 0; --key) {
+ for (int value = 0; value < Count; ++value)
+ b.insertMulti(key, value);
+ }
+
+ QVERIFY(a == b);
+ QVERIFY(!(a != b));
+ }
+
+ {
+ QHash<int, int> a;
+ QHash<int, int> b;
+
+ enum {
+ Count = 100,
+ KeyStep = 17, // coprime with Count
+ ValueStep = 23, // coprime with Count
+ };
+
+ for (int key = 0; key < Count; ++key) {
+ for (int value = 0; value < Count; ++value)
+ a.insertMulti(key, value);
+ }
+
+ // Generates two permutations of [0, Count) for the keys and values,
+ // so that b will be identical to a, just built in a very different order.
+
+ for (int k = 0; k < Count; ++k) {
+ const int key = (k * KeyStep) % Count;
+ for (int v = 0; v < Count; ++v)
+ b.insertMulti(key, (v * ValueStep) % Count);
+ }
+
+ QVERIFY(a == b);
+ QVERIFY(!(a != b));
+ }
}
void tst_QHash::compare()
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index ecf8c033b5..571a3c6984 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -584,6 +584,7 @@ void tst_QIcon::fromTheme()
QIcon noIcon = QIcon::fromTheme("broken-icon");
QVERIFY(noIcon.isNull());
QVERIFY(!QIcon::hasThemeIcon("broken-icon"));
+ QCOMPARE(noIcon.actualSize(QSize(32, 32), QIcon::Normal, QIcon::On), QSize(0, 0));
// Test non existing icon with fallback
noIcon = QIcon::fromTheme("broken-icon", abIcon);
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 36ec28de8d..0196c7d72c 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -1852,6 +1852,14 @@ void tst_QWindow::modalDialog()
QGuiApplication::sync();
QGuiApplication::processEvents();
+
+ if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
+ QWARN("Focus stays in normalWindow on offscreen/minimal platforms");
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &normalWindow);
+ return;
+ }
+
QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog);
}
@@ -1890,6 +1898,14 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal()
QGuiApplication::sync();
QGuiApplication::processEvents();
+
+ if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
+ QWARN("Focus is lost when closing modal dialog on offscreen/minimal platforms");
+ QTRY_COMPARE(QGuiApplication::focusWindow(), nullptr);
+ return;
+ }
+
QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog);
}
diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp
index e3f8f0fbac..14ba9c5c84 100644
--- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp
+++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp
@@ -84,6 +84,7 @@ private slots:
void task251909();
void qtbug3778();
+ void qtbug60024();
};
Q_DECLARE_METATYPE(QPainterPath)
@@ -1293,6 +1294,260 @@ void tst_QPathClipper::qtbug3778()
QVERIFY(p12.contains(QPointF(100, 100)));
}
+void tst_QPathClipper::qtbug60024()
+{
+ QPolygonF poly1, poly2;
+ poly1 << QPointF(508.331,1010.23) ;
+ poly1 << QPointF(492.798,1023.11) ;
+ poly1 << QPointF(491.431,1024.23) ;
+ poly1 << QPointF(491.928,1022.94) ;
+ poly1 << QPointF(492.054,1022.15) ;
+ poly1 << QPointF(492.136,1020.91) ;
+ poly1 << QPointF(491.638,1019.2) ;
+ poly1 << QPointF(490.436,1017.12) ;
+ poly1 << QPointF(489.856,1016.46) ;
+ poly1 << QPointF(489.276,1016.08) ;
+ poly1 << QPointF(488.16,1015.54) ;
+ poly1 << QPointF(487.33,1014.91) ;
+ poly1 << QPointF(486.914,1014.16) ;
+ poly1 << QPointF(486.875,1013.54) ;
+ poly1 << QPointF(487.204,1012.38) ;
+ poly1 << QPointF(487.412,1011.34) ;
+ poly1 << QPointF(487.373,1009.92) ;
+ poly1 << QPointF(487.702,1007.34) ;
+ poly1 << QPointF(487.909,1006.3) ;
+ poly1 << QPointF(488.242,1005.55) ;
+ poly1 << QPointF(488.74,1004.14) ;
+ poly1 << QPointF(489.445,1003.14) ;
+ poly1 << QPointF(490.107,1001.56) ;
+ poly1 << QPointF(490.064,1000.98) ;
+ poly1 << QPointF(489.566,999.936) ;
+ poly1 << QPointF(488.489,998.194) ;
+ poly1 << QPointF(488.117,997.274) ;
+ poly1 << QPointF(487.909,995.946) ;
+ poly1 << QPointF(487.909,995.027) ;
+ poly1 << QPointF(488.117,993.16) ;
+ poly1 << QPointF(488.658,989.749) ;
+ poly1 << QPointF(488.861,987.002) ;
+ poly1 << QPointF(489.359,976.434) ;
+ poly1 << QPointF(489.484,974.476) ;
+ poly1 << QPointF(489.484,972.859) ;
+ poly1 << QPointF(489.359,971.775) ;
+ poly1 << QPointF(489.151,970.986) ;
+ poly1 << QPointF(488.948,969.323) ;
+ poly1 << QPointF(488.74,966.036) ;
+ poly1 << QPointF(488.74,964.118) ;
+ poly1 << QPointF(489.03,961.292) ;
+ poly1 << QPointF(489.237,960.667) ;
+ poly1 << QPointF(489.648,960.043) ;
+ poly1 << QPointF(490.452,959.229) ;
+ poly1 << QPointF(491.528,958.225) ;
+ poly1 << QPointF(491.731,957.515) ;
+ poly1 << QPointF(491.32,956.812) ;
+ poly1 << QPointF(490.45,955.852) ;
+ poly1 << QPointF(489.412,954.354) ;
+ poly1 << QPointF(488.68,952.934) ;
+ poly1 << QPointF(488.625,951.201) ;
+ poly1 << QPointF(488.954,950.072) ;
+ poly1 << QPointF(489.237,949.225) ;
+ poly1 << QPointF(489.256,948.668) ;
+ poly1 << QPointF(489.402,948.186) ;
+ poly1 << QPointF(489.566,947.437) ;
+ poly1 << QPointF(490.025,945.899) ;
+ poly1 << QPointF(490.687,944.026) ;
+ poly1 << QPointF(491.059,942.073) ;
+ poly1 << QPointF(491.31,941.159) ;
+ poly1 << QPointF(491.846,937.248) ;
+ poly1 << QPointF(492.054,936.374) ;
+ poly1 << QPointF(492.594,935.29) ;
+ poly1 << QPointF(492.594,935.086) ;
+ poly1 << QPointF(492.261,934.416) ;
+ poly1 << QPointF(492.054,933.377) ;
+ poly1 << QPointF(492.054,932.628) ;
+ poly1 << QPointF(492.798,929.217) ;
+ poly1 << QPointF(493.174,928.217) ;
+ poly1 << QPointF(493.005,927.514) ;
+ poly1 << QPointF(492.923,926.719) ;
+ poly1 << QPointF(493.295,921.44) ;
+ poly1 << QPointF(493.421,919.771) ;
+ poly1 << QPointF(493.628,914.492) ;
+ poly1 << QPointF(493.71,913.158) ;
+ poly1 << QPointF(493.961,910.831) ;
+ poly1 << QPointF(494.623,909.247) ;
+ poly1 << QPointF(495.41,906.085) ;
+ poly1 << QPointF(495.203,905.421) ;
+ poly1 << QPointF(494.788,904.632) ;
+ poly1 << QPointF(494.705,904.297) ;
+ poly1 << QPointF(494.788,903.797) ;
+ poly1 << QPointF(495.121,902.844) ;
+ poly1 << QPointF(495.493,902.055) ;
+ poly1 << QPointF(496.033,900.556) ;
+ poly1 << QPointF(496.28,900.096) ;
+ poly1 << QPointF(496.488,899.222) ;
+ poly1 << QPointF(496.28,898.723) ;
+ poly1 << QPointF(495.41,898.098) ;
+ poly1 << QPointF(494.326,898.084) ;
+ poly1 << QPointF(493.993,897.42) ;
+ poly1 << QPointF(493.829,896.67) ;
+ poly1 << QPointF(493.621,894.962) ;
+ poly1 << QPointF(493.565,893.93) ;
+ poly1 << QPointF(494.416,893.358) ;
+ poly1 << QPointF(501.666,887.435) ;
+ poly1 << QPointF(513.305,877.908) ;
+ poly1 << QPointF(523.795,869.356) ;
+ poly1 << QPointF(603.378,804.221) ;
+ poly1 << QPointF(618.764,791.762) ;
+ poly1 << QPointF(618.981,791.584) ;
+ poly1 << QPointF(634.696,778.743) ;
+ poly1 << QPointF(673.531,747.007) ;
+ poly1 << QPointF(726.115,704.031) ;
+ poly1 << QPointF(759.04,677.12) ;
+ poly1 << QPointF(759.672,676.62) ;
+ poly1 << QPointF(778.846,660.773) ;
+ poly1 << QPointF(789.919,651.709) ;
+ poly1 << QPointF(810.528,634.696) ;
+ poly1 << QPointF(810.804,634.468) ;
+ poly1 << QPointF(818.197,628.365) ;
+ poly1 << QPointF(826.44,621.505) ;
+ poly1 << QPointF(832.634,616.351) ;
+ poly1 << QPointF(835.337,614.05) ;
+ poly1 << QPointF(835.492,613.931) ;
+ poly1 << QPointF(852.079,600.176) ;
+ poly1 << QPointF(860.469,593.219) ;
+ poly1 << QPointF(869.883,585.411) ;
+ poly1 << QPointF(896.749,563.131) ;
+ poly1 << QPointF(922.094,542.111) ;
+ poly1 << QPointF(936.469,530.189) ;
+ poly1 << QPointF(990.034,485.759) ;
+ poly1 << QPointF(1001.65,476.123) ;
+ poly1 << QPointF(1010.87,468.472) ;
+ poly1 << QPointF(1028.6,453.769) ;
+ poly1 << QPointF(1095.89,397.341) ;
+ poly1 << QPointF(1130.52,368.297) ;
+ poly1 << QPointF(1135.05,364.497) ;
+ poly1 << QPointF(1123.55,337.582) ;
+ poly1 << QPointF(1103.42,290.476) ;
+ poly1 << QPointF(1095.21,271.259) ;
+ poly1 << QPointF(1068.04,207.66) ;
+ poly1 << QPointF(1051.62,169.118) ;
+ poly1 << QPointF(1038.65,138.708) ;
+ poly1 << QPointF(1027.81,113.269) ;
+ poly1 << QPointF(1020.97,97.2145) ;
+ poly1 << QPointF(1010.84,73.4644) ;
+ poly1 << QPointF(988.424,20.9198) ;
+ poly1 << QPointF(968.442,-25.9307) ;
+ poly1 << QPointF(964.63,-34.8693) ;
+ poly1 << QPointF(961.883,-41.3111) ;
+ poly1 << QPointF(953.157,-61.929) ;
+ poly1 << QPointF(949.712,-70.0717) ;
+ poly1 << QPointF(946.048,-78.7331) ;
+ poly1 << QPointF(945.789,-79.3443) ;
+ poly1 << QPointF(945.548,-79.9146) ;
+ poly1 << QPointF(941.671,-89.0782) ;
+ poly1 << QPointF(940.408,-92.0616) ;
+ poly1 << QPointF(940.095,-92.8021) ;
+ poly1 << QPointF(938.65,-97.1094) ;
+ poly1 << QPointF(934.565,-106.581) ;
+ poly1 << QPointF(928.429,-121.542) ;
+ poly1 << QPointF(928.24,-122.003) ;
+ poly1 << QPointF(920.902,-139.241) ;
+ poly1 << QPointF(910.85,-162.115) ;
+ poly1 << QPointF(910.744,-162.357) ;
+ poly1 << QPointF(900.875,-186.271) ;
+ poly1 << QPointF(889.416,-213.089) ;
+ poly1 << QPointF(883.705,-226.225) ;
+ poly1 << QPointF(882.788,-228.422) ;
+ poly1 << QPointF(881.399,-231.753) ;
+ poly1 << QPointF(880.373,-234.213) ;
+ poly1 << QPointF(875.788,-245.204) ;
+ poly1 << QPointF(872.772,-252.085) ;
+ poly1 << QPointF(869.686,-259.126) ;
+ poly1 << QPointF(865.607,-268.43) ;
+ poly1 << QPointF(868.74,-269.605) ;
+ poly1 << QPointF(869.315,-269.834) ;
+ poly1 << QPointF(879.443,-273.853) ;
+ poly1 << QPointF(880.259,-274.217) ;
+ poly1 << QPointF(888.958,-278.09) ;
+ poly1 << QPointF(894.204,-280.426) ;
+ poly1 << QPointF(902.866,-284.423) ;
+ poly1 << QPointF(913.804,-289.072) ;
+ poly1 << QPointF(917.975,-290.846) ;
+ poly1 << QPointF(921.854,-292.375) ;
+ poly1 << QPointF(930.52,-295.793) ;
+ poly1 << QPointF(939.972,-299.79) ;
+ poly1 << QPointF(940.899,-300.183) ;
+ poly1 << QPointF(943.262,-294.709) ;
+ poly1 << QPointF(946.922,-286.233) ;
+ poly1 << QPointF(952.358,-273.643) ;
+ poly1 << QPointF(959.976,-256) ;
+ poly1 << QPointF(975.219,-220.296) ;
+ poly1 << QPointF(988.991,-188.494) ;
+ poly1 << QPointF(990.089,-185.959) ;
+ poly1 << QPointF(1001.86,-158.88) ;
+ poly1 << QPointF(1003.8,-154.245) ;
+ poly1 << QPointF(1011.55,-135.749) ;
+ poly1 << QPointF(1012.2,-134.199) ;
+ poly1 << QPointF(1012.77,-132.837) ;
+ poly1 << QPointF(1015.9,-125.529) ;
+ poly1 << QPointF(1015.99,-125.305) ;
+ poly1 << QPointF(1016.42,-124.299) ;
+ poly1 << QPointF(1018.02,-120.569) ;
+ poly1 << QPointF(1018.47,-119.395) ;
+ poly1 << QPointF(1028.09,-97.0593) ;
+ poly1 << QPointF(1028.89,-95.1902) ;
+ poly1 << QPointF(1032.85,-85.957) ;
+ poly1 << QPointF(1044.48,-58.8103) ;
+ poly1 << QPointF(1047.23,-52.3933) ;
+ poly1 << QPointF(1076.35,15.5527) ;
+ poly1 << QPointF(1089.43,46.0648) ;
+ poly1 << QPointF(1105.35,83.1913) ;
+ poly1 << QPointF(1120.01,117.391) ;
+ poly1 << QPointF(1131.66,144.66) ;
+ poly1 << QPointF(1142.1,169.072) ;
+ poly1 << QPointF(1183.42,265.698) ;
+ poly1 << QPointF(1200.9,306.583) ;
+ poly1 << QPointF(1208.48,324.306) ;
+ poly1 << QPointF(1231.19,377.389) ;
+ poly1 << QPointF(1241.55,400.064) ;
+ poly1 << QPointF(1139.56,485.759) ;
+ poly1 << QPointF(1104.96,514.822) ;
+ poly1 << QPointF(1044.32,565.761) ;
+ poly1 << QPointF(1020.92,585.411) ;
+ poly1 << QPointF(1013.72,591.462) ;
+ poly1 << QPointF(1012.73,592.285) ;
+ poly1 << QPointF(926.449,663.776) ;
+ poly1 << QPointF(843.981,732.099) ;
+ poly1 << QPointF(826.923,746.23) ;
+ poly1 << QPointF(810.856,759.539) ;
+ poly1 << QPointF(736.788,820.887) ;
+ poly1 << QPointF(709.695,843.348) ;
+ poly1 << QPointF(693.265,856.967) ;
+ poly1 << QPointF(690.228,859.484) ;
+ poly1 << QPointF(673.813,873.091) ;
+ poly1 << QPointF(672.34,874.317) ;
+ poly1 << QPointF(618.453,919.164) ;
+ poly1 << QPointF(607.821,928.011) ;
+ poly1 << QPointF(596.057,937.538) ;
+ poly1 << QPointF(580.774,950.204) ;
+ poly1 << QPointF(573.229,956.457) ;
+ poly1 << QPointF(533.091,989.719) ;
+ poly1 << QPointF(513.657,1005.86) ;
+ poly1 << QPointF(508.331,1010.23) ;
+
+ poly2 << QPointF(941.306,435.236) ;
+ poly2 << QPointF(983.306,435.236) ;
+ poly2 << QPointF(983.306,473.236) ;
+ poly2 << QPointF(941.306,473.236) ;
+ poly2 << QPointF(941.306,435.236) ;
+
+ QPainterPath path1, path2;
+ path1.addPolygon(poly1);
+ path2.addPolygon(poly2);
+
+ QVERIFY(!path1.intersects(path2));
+ QVERIFY(path1.intersected(path2).isEmpty());
+}
+
QTEST_MAIN(tst_QPathClipper)
diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro
index 8aeec88fd2..0dcf5a250c 100644
--- a/tests/auto/network/access/qnetworkreply/test/test.pro
+++ b/tests/auto/network/access/qnetworkreply/test/test.pro
@@ -1,6 +1,8 @@
CONFIG += testcase
testcase.timeout = 600 # this test is slow
CONFIG -= debug_and_release_target
+INCLUDEPATH += ../../../../../shared/
+HEADERS += ../../../../../shared/emulationdetector.h
SOURCES += ../tst_qnetworkreply.cpp
TARGET = ../tst_qnetworkreply
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index fbd8f5a780..855b1f9041 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -96,6 +96,8 @@ Q_DECLARE_METATYPE(QAuthenticator*)
Q_DECLARE_METATYPE(QNetworkProxyQuery)
#endif
+#include "emulationdetector.h"
+
typedef QSharedPointer<QNetworkReply> QNetworkReplyPtr;
class MyCookieJar;
@@ -135,6 +137,7 @@ class tst_QNetworkReply: public QObject
}
static const QByteArray httpEmpty200Response;
+ static const QString filePermissionFileName;
QEventLoop *loop;
enum RunSimpleRequestReturn { Timeout = 0, Success, Failure };
@@ -499,6 +502,8 @@ private:
const QByteArray tst_QNetworkReply::httpEmpty200Response =
"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n";
+const QString tst_QNetworkReply::filePermissionFileName = "/etc/shadow";
+
bool tst_QNetworkReply::seedCreated = false;
#define RUN_REQUEST(call) \
@@ -1915,8 +1920,10 @@ void tst_QNetworkReply::getErrors_data()
QTest::newRow("file-is-wronly") << QUrl::fromLocalFile(wronlyFileName).toString()
<< int(QNetworkReply::ContentAccessDenied) << 0 << true;
#endif
- if (QFile::exists("/etc/shadow"))
- QTest::newRow("file-permissions") << "file:/etc/shadow"
+
+
+ if (QFile::exists(filePermissionFileName))
+ QTest::newRow("file-permissions") << "file:" + filePermissionFileName
<< int(QNetworkReply::ContentAccessDenied) << 0 << true;
// ftp: errors
@@ -1952,6 +1959,15 @@ void tst_QNetworkReply::getErrors()
(qstrcmp(QTest::currentDataTag(), "file-permissions") == 0)) {
if (::getuid() == 0)
QSKIP("Running this test as root doesn't make sense");
+
+ }
+
+ if (EmulationDetector::isRunningArmOnX86()
+ && qstrcmp(QTest::currentDataTag(), "file-permissions") == 0) {
+ QFileInfo filePermissionFile = QFileInfo(filePermissionFileName.toLatin1());
+ if (filePermissionFile.ownerId() == ::geteuid()) {
+ QSKIP("Sysroot directories are owned by the current user");
+ }
}
#endif
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index a74a056d91..60ee4eb471 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -625,6 +625,18 @@ void tst_QLocalSocket::readBufferOverflow()
QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
// no more bytes available
QCOMPARE(client.bytesAvailable(), 0);
+
+#ifdef Q_OS_WIN
+ // Test overflow caused by an asynchronous pipe operation.
+ client.setReadBufferSize(1);
+ serverSocket->write(buffer, 2);
+
+ QVERIFY(client.waitForReadyRead());
+ // socket disconnects, if there any error on pipe
+ QCOMPARE(client.state(), QLocalSocket::ConnectedState);
+ QCOMPARE(client.bytesAvailable(), qint64(2));
+ QCOMPARE(client.read(buffer, 2), qint64(2));
+#endif
}
static qint64 writeCommand(const QVariant &command, QIODevice *device, int commandCounter)
diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
index 3b9ef577bd..cd1de209da 100644
--- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -63,6 +63,13 @@
#include <QNetworkConfigurationManager>
#include "../../../network-settings.h"
+#if defined(Q_OS_LINUX)
+#define SHOULD_CHECK_SYSCALL_SUPPORT
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <errno.h>
+#endif
+
class tst_QTcpServer : public QObject
{
Q_OBJECT
@@ -111,6 +118,11 @@ private slots:
void canAccessPendingConnectionsWhileNotListening();
private:
+ bool shouldSkipIpv6TestsForBrokenGetsockopt();
+#ifdef SHOULD_CHECK_SYSCALL_SUPPORT
+ bool ipv6GetsockoptionMissing(int level, int optname);
+#endif
+
#ifndef QT_NO_BEARERMANAGEMENT
QNetworkSession *networkSession;
#endif
@@ -180,6 +192,42 @@ void tst_QTcpServer::cleanup()
#endif
}
+#ifdef SHOULD_CHECK_SYSCALL_SUPPORT
+bool tst_QTcpServer::ipv6GetsockoptionMissing(int level, int optname)
+{
+ int testSocket;
+
+ testSocket = socket(PF_INET6, SOCK_STREAM, 0);
+
+ // If we can't test here, assume it's not missing
+ if (testSocket == -1)
+ return false;
+
+ bool result = false;
+ if (getsockopt(testSocket, level, optname, nullptr, 0) == -1) {
+ if (errno == EOPNOTSUPP) {
+ result = true;
+ }
+ }
+
+ close(testSocket);
+ return result;
+}
+#endif //SHOULD_CHECK_SYSCALL_SUPPORT
+
+bool tst_QTcpServer::shouldSkipIpv6TestsForBrokenGetsockopt()
+{
+#ifdef SHOULD_CHECK_SYSCALL_SUPPORT
+ // Following parameters for setsockopt are not supported by all QEMU versions:
+ if (ipv6GetsockoptionMissing(SOL_IPV6, IPV6_V6ONLY)) {
+ return true;
+ }
+#endif //SHOULD_CHECK_SYSCALL_SUPPORT
+
+ return false;
+}
+
+
//----------------------------------------------------------------------------------
void tst_QTcpServer::constructing()
@@ -848,6 +896,11 @@ void tst_QTcpServer::serverAddress()
QFETCH(QHostAddress, serverAddress);
QTcpServer server;
+ if (shouldSkipIpv6TestsForBrokenGetsockopt()
+ && listenAddress == QHostAddress(QHostAddress::Any)) {
+ QSKIP("Syscalls needed for ipv6 sockoptions missing functionality");
+ }
+
// TODO: why does this QSKIP?
if (!server.listen(listenAddress))
QSKIP(qPrintable(server.errorString()));
diff --git a/tests/auto/network/ssl/qsslsocket/BLACKLIST b/tests/auto/network/ssl/qsslsocket/BLACKLIST
index cfab0b7eb0..52c023b78f 100644
--- a/tests/auto/network/ssl/qsslsocket/BLACKLIST
+++ b/tests/auto/network/ssl/qsslsocket/BLACKLIST
@@ -5,5 +5,3 @@ windows
rhel-7.2
[protocolServerSide:tls1.0-any]
rhel-7.2
-[protocolServerSide]
-osx-10.11
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 4e2974b4bf..f44e5261dd 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -29,7 +29,6 @@
#include <QtCore/qglobal.h>
#include <QtCore/qthread.h>
-#include <QtCore/qoperatingsystemversion.h>
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qhostinfo.h>
#include <QtNetwork/qnetworkproxy.h>
@@ -1171,19 +1170,6 @@ void tst_QSslSocket::protocolServerSide_data()
QTest::addColumn<QSsl::SslProtocol>("clientProtocol");
QTest::addColumn<bool>("works");
- // On macOS 10.11 with SecureTransport backend some tests are failing for no
- // obvious reason (so no bug in our code): QTBUG-48860 - an error can be
- // errSSLInternal or cipher negotiation failure. This problem does not exist
- // on macOS before 10.11 and after 10.11, so we adjust these tests only for 10.11.
-
-#if defined(QT_SECURETRANSPORT)
- using OSVersion = QOperatingSystemVersion;
- const bool testWorks = OSVersion::current() < OSVersion::OSXElCapitan
- || OSVersion::current() > OSVersion::OSXElCapitan;
-#else
- const bool testWorks = true;
-#endif
-
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2
#endif
@@ -1208,14 +1194,14 @@ void tst_QSslSocket::protocolServerSide_data()
#endif
#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false;
- QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << testWorks;
+ QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true;
QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a
// numerical IP, so OpenSSL will send a SSL 2 handshake
#elif !defined(OPENSSL_NO_SSL3)
- QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << testWorks;
+ QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
diff --git a/tests/auto/other/macgui/BLACKLIST b/tests/auto/other/macgui/BLACKLIST
new file mode 100644
index 0000000000..2b4bcafe80
--- /dev/null
+++ b/tests/auto/other/macgui/BLACKLIST
@@ -0,0 +1,2 @@
+[nonModalOrder]
+osx-10.11
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
index efa724b730..13c933aa14 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
@@ -94,9 +94,6 @@ void tst_QAccessibilityMac::cleanup()
void tst_QAccessibilityMac::singleWidgetTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
delete m_window;
m_window = 0;
@@ -105,9 +102,6 @@ void tst_QAccessibilityMac::singleWidgetTest()
void tst_QAccessibilityMac::lineEditTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QLineEdit *lineEdit = new QLineEdit(m_window);
lineEdit->setText("a11y test QLineEdit");
m_window->addWidget(lineEdit);
@@ -119,9 +113,6 @@ void tst_QAccessibilityMac::lineEditTest()
void tst_QAccessibilityMac::hierarchyTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QWidget *w = new QWidget(m_window);
m_window->addWidget(w);
@@ -141,17 +132,11 @@ void tst_QAccessibilityMac::hierarchyTest()
void tst_QAccessibilityMac::notificationsTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QVERIFY(notifications(m_window));
}
void tst_QAccessibilityMac::checkBoxTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QCheckBox *cb = new QCheckBox(m_window);
cb->setText("Great option");
m_window->addWidget(cb);
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
index 5f10513bb5..75b2d39a00 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
@@ -33,8 +33,6 @@
QT_USE_NAMESPACE
-bool macNativeAccessibilityEnabled();
-bool trusted();
bool testLineEdit();
bool testHierarchy(QWidget *w);
bool singleWidget();
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
index fb030aa4be..e9407fd903 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
@@ -42,19 +42,6 @@
QT_USE_NAMESPACE
-bool macNativeAccessibilityEnabled()
-{
- bool enabled = AXAPIEnabled();
- if (!enabled)
- qWarning() << "Accessibility is disabled (check System Preferences) skipping test.";
- return enabled;
-}
-
-bool trusted()
-{
- return AXIsProcessTrusted();
-}
-
struct AXErrorTag {
AXError err;
explicit AXErrorTag(AXError theErr) : err(theErr) {}
@@ -413,12 +400,6 @@ bool singleWidget()
bool testLineEdit()
{
-// not sure if this is needed. on my machine the calls succeed.
-// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app/Contents/MacOS/tst_qaccessibilitymac";
-// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app";
-// AXError e = AXMakeProcessTrusted((CFStringRef) path);
-// NSLog(@"error: %i", e);
-
TestAXObject *appObject = [TestAXObject getApplicationAXObject];
EXPECT(appObject);
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 1ff7a0c97b..d48ee03a22 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -676,7 +676,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
}
if (!invalid) {
foreach (const QString &check, entryList) {
- if (check.startsWith(entry.left(5)) && check != entry) {
+ if (check.startsWith(entry.left(5), Qt::CaseInsensitive) && check != entry) {
invalid = true;
break;
}
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 9981fd3447..46791ff884 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -5,6 +5,7 @@ ubuntu-16.04
[saveRestoreGeometry]
ubuntu-14.04
ubuntu-16.04
+b2qt
[restoreVersion1Geometry]
ubuntu-14.04
osx
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 5fe0232d90..08f6a8e7e4 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -2181,6 +2181,8 @@ void tst_QWidget::showMinimizedKeepsFocus()
QSKIP("QTBUG-26424");
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
+ if (m_platform == QStringLiteral("offscreen"))
+ QSKIP("Platform offscreen does not support showMinimized()");
//here we test that minimizing a widget and restoring it doesn't change the focus inside of it
{
@@ -3237,6 +3239,9 @@ void tst_QWidget::widgetAt()
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
+ if (m_platform == QStringLiteral("offscreen"))
+ QSKIP("Platform offscreen does not support lower()/raise() or WindowMasks");
+
Q_CHECK_PAINTEVENTS
const QPoint referencePos = m_availableTopLeft + QPoint(100, 100);
@@ -3653,7 +3658,7 @@ void tst_QWidget::optimizedResize_topLevel()
expectedUpdateRegion -= QRect(QPoint(), topLevel.size() - QSize(10, 10));
QTRY_COMPARE(topLevel.gotPaintEvent, true);
- if (m_platform == QStringLiteral("xcb"))
+ if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("offscreen"))
QSKIP("QTBUG-26424");
QCOMPARE(topLevel.partial, true);
QCOMPARE(topLevel.paintedRegion, expectedUpdateRegion);
@@ -6798,6 +6803,9 @@ void tst_QWidget::render_task217815()
// Window Opacity is not supported on Windows CE.
void tst_QWidget::render_windowOpacity()
{
+ if (m_platform == QStringLiteral("offscreen"))
+ QSKIP("Platform offscreen does not support setting opacity");
+
const qreal opacity = 0.5;
{ // Check that the painter opacity effects the widget drawing.
@@ -7388,6 +7396,9 @@ void tst_QWidget::updateWhileMinimized()
{
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
+ if (m_platform == QStringLiteral("offscreen"))
+ QSKIP("Platform offscreen does not support showMinimized()");
+
#if defined(Q_OS_QNX)
QSKIP("Platform does not support showMinimized()");
#endif
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 139aaa7371..a0ba91ba4a 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -325,6 +325,7 @@ private:
// keyClicks(..) is moved to QtTestCase
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
+ bool unselectingWithLeftOrRightChangesCursorPosition();
QLineEdit *ensureTestWidget();
bool validInput;
@@ -1315,9 +1316,10 @@ void tst_QLineEdit::undo_keypressevents_data()
// unselect any current selection
keys.addKeyClick(Qt::Key_Right);
-#if defined Q_OS_WIN || defined Q_OS_QNX //Windows and QNX do not jump to the beginning of the selection
- keys.addKeyClick(Qt::Key_Left);
-#endif
+
+ // If previous right changed cursor position, go back left
+ if (unselectingWithLeftOrRightChangesCursorPosition())
+ keys.addKeyClick(Qt::Key_Left);
// selecting '12'
keys.addKeyClick(Qt::Key_Right, Qt::ShiftModifier);
@@ -3298,14 +3300,11 @@ void tst_QLineEdit::leftKeyOnSelectedText()
QCOMPARE(testWidget->cursorPosition(), 2);
QCOMPARE(testWidget->selectedText(), QString("23"));
QTest::keyClick(testWidget, Qt::Key_Left);
-#if defined Q_OS_WIN || defined Q_OS_QNX
- QCOMPARE(testWidget->cursorPosition(), 1);
-#else
- // Selection is cleared ands cursor remains at position 2.
- // X11 used to behave like window prior to 4.2. Changes caused by QKeySequence
- // resulted in an inadvertant change in behavior
- QCOMPARE(testWidget->cursorPosition(), 2);
-#endif
+
+ if (unselectingWithLeftOrRightChangesCursorPosition())
+ QCOMPARE(testWidget->cursorPosition(), 1);
+ else
+ QCOMPARE(testWidget->cursorPosition(), 2);
}
void tst_QLineEdit::inlineCompletion()
@@ -4639,5 +4638,22 @@ void tst_QLineEdit::QTBUG59957_clearButtonLeftmostAction()
#endif // QT_BUILD_INTERNAL
}
+bool tst_QLineEdit::unselectingWithLeftOrRightChangesCursorPosition()
+{
+#if defined Q_OS_WIN || defined Q_OS_QNX //Windows and QNX do not jump to the beginning of the selection
+ return true;
+#endif
+ // Platforms minimal/offscreen also need left after unselecting with right
+ if (!QGuiApplication::platformName().compare("minimal", Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare("offscreen", Qt::CaseInsensitive)) {
+ return true;
+ }
+
+ // Selection is cleared ands cursor remains at previous position.
+ // X11 used to behave like window prior to 4.2. Changes caused by QKeySequence
+ // resulted in an inadvertant change in behavior
+ return false;
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index ceef88338a..c8a92f3751 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -1507,6 +1507,10 @@ void tst_QMdiArea::setBackground()
void tst_QMdiArea::setViewport()
{
+#ifdef Q_OS_MACOS
+ QSKIP("Sometimes crashes in the CI, see QTBUG-58520");
+#endif
+
QMdiArea workspace;
workspace.show();
diff --git a/tests/auto/widgets/widgets/qmenu/qmenu.pro b/tests/auto/widgets/widgets/qmenu/qmenu.pro
index 7c1315afa8..55fff01138 100644
--- a/tests/auto/widgets/widgets/qmenu/qmenu.pro
+++ b/tests/auto/widgets/widgets/qmenu/qmenu.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qmenu
-QT += widgets testlib
+QT += gui-private widgets testlib
SOURCES += tst_qmenu.cpp
macx:{
OBJECTIVE_SOURCES += tst_qmenu_mac.mm
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 35f75dbeab..da37a9a968 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -46,6 +46,8 @@
#include <QTimer>
#include <qdebug.h>
+#include <qpa/qplatformtheme.h>
+
Q_DECLARE_METATYPE(Qt::Key);
Q_DECLARE_METATYPE(Qt::KeyboardModifiers);
@@ -624,6 +626,7 @@ void tst_QMenu::tearOff()
QScopedPointer<QMenu> menu(new QMenu(&widget));
QVERIFY(!menu->isTearOffEnabled()); //default value
menu->setTearOffEnabled(true);
+ menu->setTitle(QLatin1String("Same &Menu"));
menu->addAction("aaa");
menu->addAction("bbb");
QVERIFY(menu->isTearOffEnabled());
@@ -646,6 +649,19 @@ void tst_QMenu::tearOff()
QVERIFY(torn);
QVERIFY(torn->isVisible());
+ // Check menu title
+ const QString cleanTitle = QPlatformTheme::removeMnemonics(menu->title()).trimmed();
+ QCOMPARE(torn->windowTitle(), cleanTitle);
+
+ // Change menu title and check again
+ menu->setTitle(QLatin1String("Sample &Menu"));
+ const QString newCleanTitle = QPlatformTheme::removeMnemonics(menu->title()).trimmed();
+ QCOMPARE(torn->windowTitle(), newCleanTitle);
+
+ // Clear menu title and check again
+ menu->setTitle(QString());
+ QCOMPARE(torn->windowTitle(), QString());
+
menu->hideTearOffMenu();
QVERIFY(!menu->isTearOffMenuVisible());
QVERIFY(!torn->isVisible());
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 88779e8471..313cc56b0b 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -69,14 +69,13 @@ tst_QGraphicsItem::~tst_QGraphicsItem()
static inline void processEvents()
{
- QApplication::flush();
QApplication::processEvents();
QApplication::processEvents();
}
void tst_QGraphicsItem::initTestCase()
{
- QApplication::flush();
+ processEvents();
QTest::qWait(1500);
processEvents();
}
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 8189388d0f..622df2fb3b 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -62,7 +62,6 @@ tst_QGraphicsScene::~tst_QGraphicsScene()
static inline void processEvents()
{
- QApplication::flush();
QApplication::processEvents();
QApplication::processEvents();
}
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 0064ecbaaf..cdec833f4e 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -44,7 +44,6 @@
static inline void processEvents()
{
QPixmapCache::clear();
- QApplication::flush();
QApplication::processEvents();
QApplication::processEvents();
}
diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
index 19b8e27b63..aeec0624e8 100644
--- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
@@ -33,7 +33,6 @@
static void processEvents()
{
- QApplication::flush();
QApplication::processEvents();
QApplication::processEvents();
}
@@ -174,7 +173,7 @@ void tst_QWidget::update()
}
}
- QApplication::flush();
+ QApplication::processEvents();
}
void tst_QWidget::updatePartial_data()
diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
index b8d5478c03..c1e6d780ba 100644
--- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
@@ -169,7 +169,6 @@ void tst_qstylesheetstyle::grid()
if(show) {
w->show();
QTest::qWaitForWindowExposed(w);
- QApplication::flush();
QApplication::processEvents();
QTest::qWait(30);
QApplication::processEvents();
diff --git a/tests/manual/widgets/widgets.pro b/tests/manual/widgets/widgets.pro
index 3a128581cf..e3942a49e9 100644
--- a/tests/manual/widgets/widgets.pro
+++ b/tests/manual/widgets/widgets.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-SUBDIRS = itemviews qgraphicsview kernel
+SUBDIRS = itemviews qgraphicsview kernel widgets
greaterThan(QT_MAJOR_VERSION, 4): SUBDIRS += styles
diff --git a/tests/manual/widgets/widgets/multiscreen-menus/main.cpp b/tests/manual/widgets/widgets/multiscreen-menus/main.cpp
new file mode 100644
index 0000000000..f63d644320
--- /dev/null
+++ b/tests/manual/widgets/widgets/multiscreen-menus/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ a.setAttribute(Qt::AA_DontUseNativeMenuBar);
+
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.cpp b/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.cpp
new file mode 100644
index 0000000000..a53eda37fa
--- /dev/null
+++ b/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include <QtGui/QtEvents>
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+ setStyleSheet("QMenu { menu-scrollable: 0 }");
+
+ auto *mb = new QMenuBar(this);
+ setMenuBar(mb);
+
+ auto *m = new QMenu(mb);
+ m->setTitle("&Menu");
+ m->setTearOffEnabled(true);
+
+ for (int i = 0; i < 80; ++i)
+ m->addAction("Menu Item #" + QString::number(i));
+
+ mb->addMenu(m);
+
+ ui->menuButton->setMenu(m);
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::contextMenuEvent(QContextMenuEvent *e)
+{
+ const auto *mb = menuBar();
+ mb->actions().first()->menu()->popup(mb->mapToGlobal(e->pos()));
+}
diff --git a/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.h b/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.h
new file mode 100644
index 0000000000..7689062221
--- /dev/null
+++ b/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+ void contextMenuEvent(QContextMenuEvent *e) override;
+
+private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.ui b/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.ui
new file mode 100644
index 0000000000..dbc5c437b4
--- /dev/null
+++ b/tests/manual/widgets/widgets/multiscreen-menus/mainwindow.ui
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>427</width>
+ <height>228</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Move this window to a secondary screen, ideally with a larger size than the primary screen.
+
+Open menu bar, button and context menus. The menu contents should be consistent with the screen it's being displayed on.
+
+Tear-off the menu and move around across screens. The torn-off menu should adapt to the screen size.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="menuButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Menu Button</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Right-click for context menu</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignHCenter|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>427</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/manual/widgets/widgets/multiscreen-menus/multiscreen-menus.pro b/tests/manual/widgets/widgets/multiscreen-menus/multiscreen-menus.pro
new file mode 100644
index 0000000000..a723b3f762
--- /dev/null
+++ b/tests/manual/widgets/widgets/multiscreen-menus/multiscreen-menus.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+QT += core gui widgets
+
+SOURCES += main.cpp\
+ mainwindow.cpp
+
+HEADERS += mainwindow.h
+
+FORMS += mainwindow.ui