diff options
Diffstat (limited to 'tests')
20 files changed, 139 insertions, 25 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index dd449a37d4..4c9986d50e 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -533,6 +533,10 @@ void tst_QFile::open_data() << false << QFile::OpenError; QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly) << false << QFile::OpenError; + QTest::newRow("resource_file") << QString::fromLatin1(":/does/not/exist") + << int(QIODevice::ReadOnly) + << false + << QFile::OpenError; #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //opening devices requires administrative privileges (and elevation). HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp index 5ecd1723c0..ba5e9eaaa1 100644 --- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp +++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp @@ -181,6 +181,7 @@ void tst_QIpAddress::invalidParseIp4_data() QTest::newRow("..") << ".."; QTest::newRow("...") << "..."; QTest::newRow("....") << "...."; + QTest::newRow(".1.2.3") << ".1.2.3"; QTest::newRow("1.") << "1."; QTest::newRow("1.2.") << "1.2."; QTest::newRow("1.2.3.") << "1.2.3."; @@ -209,9 +210,15 @@ void tst_QIpAddress::invalidParseIp4_data() QTest::newRow("-1.1") << "-1.1"; QTest::newRow("1.-1") << "1.-1"; QTest::newRow("1.1.1.-1") << "1.1.1.-1"; + QTest::newRow("300-05") << "300-05"; + QTest::newRow("127.-1") << "127.-1"; + QTest::newRow("-127-10") << "-127-10"; + QTest::newRow("198.-16") << "198-16"; + QTest::newRow("-127.-0.") << "-127.-0."; // letters QTest::newRow("abc") << "abc"; + QTest::newRow("localhost") << "localhost"; QTest::newRow("1.2.3a.4") << "1.2.3a.4"; QTest::newRow("a.2.3.4") << "a.2.3.4"; QTest::newRow("1.2.3.4a") << "1.2.3.4a"; @@ -244,6 +251,7 @@ void tst_QIpAddress::ip4ToString_data() QTest::newRow("0.0.0.0") << 0u << "0.0.0.0"; QTest::newRow("1.2.3.4") << 0x01020304u << "1.2.3.4"; + QTest::newRow("127.0.0.1") << 0x7f000001u << "127.0.0.1"; QTest::newRow("111.222.33.44") << 0x6fde212cu << "111.222.33.44"; QTest::newRow("255.255.255.255") << 0xffffffffu << "255.255.255.255"; } diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index b7dc3e9ac0..afa3620b1a 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -541,5 +541,15 @@ bool tst_QLockFile::overwritePidInLockFile(const QString &filePath, qint64 pid) return f.write(buf) == buf.size(); } +struct LockFileUsageInGlobalDtor +{ + ~LockFileUsageInGlobalDtor() { + QLockFile lockFile(QDir::currentPath() + "/lastlock"); + QVERIFY(lockFile.lock()); + QVERIFY(lockFile.isLocked()); + } +}; +LockFileUsageInGlobalDtor s_instance; + QTEST_MAIN(tst_QLockFile) #include "tst_qlockfile.moc" diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp index 4ccc903e32..7a361c0693 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp @@ -88,6 +88,11 @@ void runScenario() r = special + string; QCOMPARE(r, QString(special P string)); + // self-assignment: + r = stringref.toString(); + r = achar + r; + QCOMPARE(r, QString(achar P stringref)); + #ifdef Q_COMPILER_UNICODE_STRINGS r = QStringLiteral(UNICODE_LITERAL); r = r Q QStringLiteral(UNICODE_LITERAL); diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 0605677e29..efa9cb61a8 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -9,5 +9,7 @@ ubuntu-14.04 * [authenticationCacheAfterCancel:http+socksauth] rhel-7.1 +rhel-7.2 [authenticationCacheAfterCancel:https+socksauth] rhel-7.1 +rhel-7.2 diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index d710fedfcf..c679d1f108 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6836,19 +6836,19 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); - if (reply->error() == QNetworkReply::HostNotFoundError) - QSKIP("skip because of quirk in the old test server"); - QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); + // Work round known quirk in the old test server (danted -v < v1.1.19): + if (reply->error() != QNetworkReply::HostNotFoundError) + QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); QCOMPARE(authSpy.count(), 0); QVERIFY(proxyAuthSpy.count() > 0); proxyAuthSpy.clear(); - //QTBUG-23136 workaround + // QTBUG-23136 workaround (needed even with danted v1.1.19): if (proxy.port() == 1081) { #ifdef QT_BUILD_INTERNAL QNetworkAccessManagerPrivate::clearCache(&manager); #else - return; //XFAIL result above + return; #endif } diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index 79703dc649..419c781aab 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -138,8 +138,16 @@ void tst_QHostAddress::setAddress_QString_data() QTest::newRow("ip4_06") << QString("123.0.0") << true << QString("123.0.0.0") << 4; // for the format of IPv6 addresses see also RFC 5952 - QTest::newRow("ip6_00") << QString("FEDC:BA98:7654:3210:FEDC:BA98:7654:3210") << true << QString("fedc:ba98:7654:3210:fedc:ba98:7654:3210") << 6; - QTest::newRow("ip6_01") << QString("1080:0000:0000:0000:0008:0800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; + // rule 4.1: Leading zeros MUST be suppressed + // rule 4.2.1: Shorten as Much as Possible + // rule 4.2.2: The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field. + // rule 4.2.3: the longest run of consecutive 16-bit 0 fields MUST be shortened + // When the length of the consecutive 16-bit 0 fields, the first sequence + // of zero bits MUST be shortened + // rule 4.3: The characters "a", "b", "c", "d", "e", and "f" in an IPv6 address + // MUST be represented in lowercase + QTest::newRow("ip6_00") << QString("FEDC:BA98:7654:3210:FEDC:BA98:7654:3210") << true << QString("fedc:ba98:7654:3210:fedc:ba98:7654:3210") << 6; // 4.3 + QTest::newRow("ip6_01") << QString("1080:0000:0000:0000:0008:0800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; // 4.1, 4.2.1 QTest::newRow("ip6_02") << QString("1080:0:0:0:8:800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; QTest::newRow("ip6_03") << QString("1080::8:800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; QTest::newRow("ip6_04") << QString("FF01::43") << true << QString("ff01::43") << 6; @@ -152,10 +160,11 @@ void tst_QHostAddress::setAddress_QString_data() QTest::newRow("ip6_11") << QString("::FFFF:129.144.52.38") << true << QString("::ffff:129.144.52.38") << 6; QTest::newRow("ip6_12") << QString("1::FFFF:129.144.52.38") << true << QString("1::ffff:8190:3426") << 6; QTest::newRow("ip6_13") << QString("A:B::D:E") << true << QString("a:b::d:e") << 6; - QTest::newRow("ip6_14") << QString("1080:0:1:0:8:800:200C:417A") << true << QString("1080:0:1:0:8:800:200c:417a") << 6; + QTest::newRow("ip6_14") << QString("1080:0:1:0:8:800:200C:417A") << true << QString("1080:0:1:0:8:800:200c:417a") << 6; // 4.2.2 QTest::newRow("ip6_15") << QString("1080:0:1:0:8:800:200C:0") << true << QString("1080:0:1:0:8:800:200c:0") << 6; QTest::newRow("ip6_16") << QString("1080:0:1:0:8:800:0:0") << true << QString("1080:0:1:0:8:800::") << 6; - QTest::newRow("ip6_17") << QString("1080:0:0:0:8:800:0:0") << true << QString("1080::8:800:0:0") << 6; + QTest::newRow("ip6_17a") << QString("1080:0:0:8:800:0:0:0") << true << QString("1080:0:0:8:800::") << 6; // 4.2.3a + QTest::newRow("ip6_17b") << QString("1080:0:0:0:8:0:0:0") << true << QString("1080::8:0:0:0") << 6; // 4.2.3b QTest::newRow("ip6_18") << QString("0:1:1:1:8:800:0:0") << true << QString("0:1:1:1:8:800::") << 6; QTest::newRow("ip6_19") << QString("0:1:1:1:8:800:0:1") << true << QString("0:1:1:1:8:800:0:1") << 6; diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 48fa4f7bcc..3112d7d62b 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -837,7 +837,8 @@ void tst_QLocalSocket::processConnection() const QString exeSuffix; #endif - QString socketProcess = QStringLiteral("socketprocess/socketprocess") + exeSuffix; + const QString socketProcess + = QFINDTESTDATA(QStringLiteral("socketprocess/socketprocess") + exeSuffix); QVERIFY(QFile::exists(socketProcess)); QFETCH(int, processes); diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST index 28e4856056..e33d36e201 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -1,4 +1,5 @@ [] rhel-7.1 +rhel-7.2 [customGesture] opensuse-13.1 diff --git a/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro index c4e0257769..a4d20cc0f5 100644 --- a/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro +++ b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro @@ -17,7 +17,7 @@ rcc_test.input = RCCINPUT rcc_test.variable_out = SOURCES rcc_test.name = RCC_TEST rcc_test.CONFIG += no_link -rcc_test.depends = $$QMAKE_RCC +rcc_test.depends = $$QMAKE_RCC_EXE QMAKE_EXTRA_COMPILERS += rcc_test diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index 194ce3f556..07f3a41df3 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -2,3 +2,4 @@ opensuse-13.1 opensuse-42.1 rhel-7.1 +rhel-7.2 diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST index 373343fa22..16f3534921 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST @@ -1,5 +1,6 @@ [hoverEnterLeaveEvent] ubuntu-14.04 rhel-7.1 +rhel-7.2 [QTBUG_6986_sendMouseEventToAlienWidget] rhel-7.1 diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST index c8d93585b2..13ec840eff 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST @@ -1,3 +1,4 @@ [initialShow2] ubuntu-14.04 rhel-7.1 +rhel-7.2 diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 4563da8d48..0a344cd52d 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -11,6 +11,7 @@ osx [updateWhileMinimized] ubuntu-14.04 rhel-7.1 +rhel-7.2 osx [focusProxyAndInputMethods] linux diff --git a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST b/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST deleted file mode 100644 index 8bd4caad31..0000000000 --- a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST +++ /dev/null @@ -1,6 +0,0 @@ -[currentFont] -osx -[fontFilters] -osx -[writingSystem] -osx diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp index cda24a19d3..9e6b16d4ce 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp @@ -80,18 +80,21 @@ void tst_QFontComboBox::qfontcombobox() void tst_QFontComboBox::currentFont_data() { QTest::addColumn<QFont>("currentFont"); + QFontDatabase db; // Normalize the names QFont defaultFont; QFontInfo fi(defaultFont); defaultFont = QFont(fi.family()); // make sure we have a real font name and not something like 'Sans Serif'. - QTest::newRow("default") << defaultFont; + if (!db.isPrivateFamily(defaultFont.family())) + QTest::newRow("default") << defaultFont; defaultFont.setPointSize(defaultFont.pointSize() + 10); - QTest::newRow("default2") << defaultFont; - QFontDatabase db; + if (!db.isPrivateFamily(defaultFont.family())) + QTest::newRow("default2") << defaultFont; QStringList list = db.families(); for (int i = 0; i < list.count(); ++i) { QFont f = QFont(QFontInfo(QFont(list.at(i))).family()); - QTest::newRow(qPrintable(list.at(i))) << f; + if (!db.isPrivateFamily(f.family())) + QTest::newRow(qPrintable(list.at(i))) << f; } } @@ -168,6 +171,8 @@ void tst_QFontComboBox::fontFilters() fontFilters &= ~spacingMask; for (int i = 0; i < list.count(); ++i) { + if (db.isPrivateFamily(list[i])) + continue; if (fontFilters & QFontComboBox::ScalableFonts) { if (!db.isSmoothlyScalable(list[i])) continue; @@ -232,7 +237,12 @@ void tst_QFontComboBox::writingSystem() QFontDatabase db; QStringList list = db.families(writingSystem); - QCOMPARE(box.model()->rowCount(), list.count()); + int c = list.count(); + for (int i = 0; i < list.count(); ++i) { + if (db.isPrivateFamily(list[i])) + c--; + } + QCOMPARE(box.model()->rowCount(), c); if (list.count() == 0) QCOMPARE(box.currentFont(), QFont()); diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro index d9ec5edd7c..af9b7d241d 100644 --- a/tests/benchmarks/corelib/tools/tools.pro +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -10,7 +10,6 @@ SUBDIRS = \ qlocale \ qmap \ qrect \ - qregexp \ qringbuffer \ qstack \ qstring \ diff --git a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp index 0035d47c88..05ede9da99 100644 --- a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp +++ b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp @@ -139,7 +139,7 @@ void tst_NetworkRemoteStressTest::init() { // clear the internal cache #ifndef QT_BUILD_INTERNAL - if (strncmp(QTest::currentTestFunction(), "nam") == 0) + if (strncmp(QTest::currentTestFunction(), "nam", 3) == 0) QSKIP("QNetworkAccessManager tests disabled"); #endif } diff --git a/tests/manual/network_stresstest/tst_network_stresstest.cpp b/tests/manual/network_stresstest/tst_network_stresstest.cpp index 9e04d52c4a..e3c76ea11b 100644 --- a/tests/manual/network_stresstest/tst_network_stresstest.cpp +++ b/tests/manual/network_stresstest/tst_network_stresstest.cpp @@ -130,7 +130,7 @@ void tst_NetworkStressTest::init() { // clear the internal cache #ifndef QT_BUILD_INTERNAL - if (strncmp(QTest::currentTestFunction(), "nam") == 0) + if (strncmp(QTest::currentTestFunction(), "nam", 3) == 0) QSKIP("QNetworkAccessManager tests disabled"); #endif } diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index f9f93fd525..445af82e09 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -40,6 +40,61 @@ #include <QStatusBar> #include <QLineEdit> #include <QDesktopWidget> +#include <QPushButton> +#include <QLabel> +#include <QMouseEvent> + + +class MouseMonitor : public QLabel { + Q_OBJECT +public: + MouseMonitor() : m_grabbed(false) { + setMinimumSize(540, 240); + setAlignment(Qt::AlignCenter); + setMouseTracking(true); + setWindowTitle(QLatin1String("Mouse Monitor")); + updateText(); + } + + void updateText() { + QString txt = m_grabbed ? + QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") : + QLatin1String("Left-click to grab mouse\n"); + if (!m_cursorPos.isNull()) { + txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n")) + .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(QApplication::desktop()->screenNumber(m_cursorPos)); + if (QGuiApplication::mouseButtons() & Qt::LeftButton) { + QWindow *win = QGuiApplication::topLevelAt(m_cursorPos); + txt += QString(QLatin1String("Top-level window found? %1\n")) + .arg(win ? (win->title().isEmpty() ? "no title" : win->title()) : "none"); + } + } + setText(txt); + } + +protected: + void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE { + m_cursorPos = ev->screenPos().toPoint(); + updateText(); + } + + void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE { + m_cursorPos = ev->screenPos().toPoint(); + qDebug() << "top level @" << m_cursorPos << ":" << QGuiApplication::topLevelAt(m_cursorPos); + updateText(); + if (!m_grabbed) { + grabMouse(Qt::CrossCursor); + m_grabbed = true; + } else if (ev->button() == Qt::RightButton) { + setVisible(false); + deleteLater(); + } + } + +private: + QPoint m_cursorPos; + bool m_grabbed; +}; class ScreenPropertyWatcher : public PropertyWatcher { @@ -96,6 +151,7 @@ public: protected: bool event(QEvent *event) Q_DECL_OVERRIDE; + void startMouseMonitor(); private: const QString m_annotation; @@ -119,6 +175,11 @@ ScreenWatcherMainWindow::ScreenWatcherMainWindow(QScreen *screen) a = fileMenu->addAction(QLatin1String("Quit")); a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); connect(a, SIGNAL(triggered()), qApp, SLOT(quit())); + + QMenu *toolsMenu = menuBar()->addMenu(QLatin1String("&Tools")); + a = toolsMenu->addAction(QLatin1String("Mouse Monitor")); + a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + connect(a, &QAction::triggered, this, &ScreenWatcherMainWindow::startMouseMonitor); } static inline QString msgScreenChange(const QWidget *w, const QScreen *oldScreen, const QScreen *newScreen) @@ -154,6 +215,12 @@ bool ScreenWatcherMainWindow::event(QEvent *event) return QMainWindow::event(event); } +void ScreenWatcherMainWindow::startMouseMonitor() +{ + MouseMonitor *mm = new MouseMonitor(); + mm->show(); +} + void screenAdded(QScreen* screen) { screen->setOrientationUpdateMask((Qt::ScreenOrientations)0x0F); |