From f72152381b37740e65f174e175306d21c7616549 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 13 Oct 2015 21:48:08 +0200 Subject: tst_QStringBuilder: add a check for self-assignment Change-Id: I78094146bf534163af12d6e265276d987d5ce994 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp index e3b25c4c81..777fd5392c 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp @@ -93,6 +93,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); -- cgit v1.2.3 From 2b09d371eb7d9f3e903603a94efdafa1e650a85b Mon Sep 17 00:00:00 2001 From: Rolland Dudemaine Date: Thu, 24 Mar 2016 11:02:27 +0100 Subject: Resolve build failure in network stress tests. strncmp() needs 3 arguments, not 2. Change-Id: Ia7077108a533321d5218cc35fd78ada8863f8200 Reviewed-by: Oswald Buddenhagen --- .../manual/network_remote_stresstest/tst_network_remote_stresstest.cpp | 2 +- tests/manual/network_stresstest/tst_network_stresstest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') 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 486c5179b7..6767c8b153 100644 --- a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp +++ b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp @@ -144,7 +144,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 72233bf938..ab9481534e 100644 --- a/tests/manual/network_stresstest/tst_network_stresstest.cpp +++ b/tests/manual/network_stresstest/tst_network_stresstest.cpp @@ -135,7 +135,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 } -- cgit v1.2.3 From 3c08035b7b29e48e749a92cbdf05432a57f4108d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 6 Jan 2016 14:47:00 +0100 Subject: QScreen manual test: add MouseMonitor to test multi-screen scenarios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QMouseEvent::screenPos() should be global desktop position - QDesktopWidget::screenNumber() should tell the correct screen - QGuiApplication::topLevelAt(screenPos) should find the window where the mouse is clicked Change-Id: I9a63ab3ee1944b7246551d0f3d5e37f0d2aa5457 Reviewed-by: Błażej Szczygieł Reviewed-by: Friedemann Kleint --- tests/manual/qscreen/main.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'tests') diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index 298996a59b..13d4145a68 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -45,6 +45,61 @@ #include #include #include +#include +#include +#include + + +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 { @@ -101,6 +156,7 @@ public: protected: bool event(QEvent *event) Q_DECL_OVERRIDE; + void startMouseMonitor(); private: const QString m_annotation; @@ -124,6 +180,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) @@ -159,6 +220,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); -- cgit v1.2.3 From 8e103902def83af0a074b81c9d527d8147def162 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 6 Apr 2016 14:29:15 +0200 Subject: tests: fix tst_QFontComboBox on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After 909d3f5c7, private families will not be shown in user interface. Task-number: QTBUG-41318 Change-Id: I15ae77cacd2a27c9db4b1a8ffbb582416258988c Reviewed-by: Morten Johan Sørvig --- tests/auto/widgets/widgets/qfontcombobox/BLACKLIST | 6 ------ .../widgets/qfontcombobox/tst_qfontcombobox.cpp | 20 +++++++++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 tests/auto/widgets/widgets/qfontcombobox/BLACKLIST (limited to 'tests') 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 5d6fdf2851..10e447c417 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp @@ -113,18 +113,21 @@ void tst_QFontComboBox::qfontcombobox() void tst_QFontComboBox::currentFont_data() { QTest::addColumn("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; } } @@ -201,6 +204,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; @@ -265,7 +270,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()); -- cgit v1.2.3 From f39e542eb859f5f88c65a1b97bdf2f4256c68ec0 Mon Sep 17 00:00:00 2001 From: Alexander Grishkov Date: Tue, 15 Mar 2016 22:54:20 +0300 Subject: Fix parsing of IPv4 addresses with certain symbols Add some extra checks to the parser to make sure that addresses like "300-05" aren't interpreted as valid IPv4 addresses. Change-Id: I12475eebc9452e060779bb05e2b4ad9512a28281 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp index 3e16d3b871..0addd89ebf 100644 --- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp +++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp @@ -186,6 +186,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."; @@ -214,9 +215,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"; @@ -249,6 +256,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"; } -- cgit v1.2.3 From 8c427e5bdfcb54e19d10646d9ff45674077253c9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 23 Feb 2016 16:18:05 -0800 Subject: Autotest: confirm that QHostAddress obeys RFC 5952 recommendations Change-Id: I0c94a5c2846b48c8aea7ffff1435b8a7ccbd4d9e Reviewed-by: Richard J. Moore Reviewed-by: Edward Welbourne --- .../network/kernel/qhostaddress/tst_qhostaddress.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index 8069865d93..4d2d5fc67d 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -159,8 +159,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; @@ -173,10 +181,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; -- cgit v1.2.3 From b6eea89b67e0d3bb4f8f888fff21257eff0b65a5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 3 Apr 2016 18:36:52 +0200 Subject: Fix crash when using QLockFile in a global destructor (for instance any global object which writes out to a config file in the destructor). If the global cache isn't available anymore, don't use it. Change-Id: I851a6e394d0b073aebf3ffd88b1966d424bfb92e Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 21c5696d1d..4884c126d4 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -546,5 +546,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" -- cgit v1.2.3 From 7b4c02d527c448a3c8b3e9fa771e42f8bd7778ff Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 8 Apr 2016 17:21:07 +0200 Subject: Fix finding a helper executable in tst_QLocalSocket Use QFINDTESTDATA to find the socketprocess helper executable. Now tst_QLocalSocket::processConnection() passes when started from Qt Creator without adjusting the working directory. Change-Id: I97ca3334a381b3cd646647487529bcd90b969528 Reviewed-by: Thiago Macieira --- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index a96c88874e..99f40ca215 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -847,7 +847,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); -- cgit v1.2.3 From 0f7171f290f0d137b4034c617d4c1fd169079209 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Mon, 11 Apr 2016 10:55:30 +0200 Subject: Better error message when trying to load an invalid resource Before this change QFile::errorString function was returning an "Unknown error". Now it will return the typical ENOENT string. Task-number: QTBUG-45259 Change-Id: Ib7634f1aa5d91f77151cf92c58d3956e20a4cc6b Reviewed-by: hjk --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 1c695a1113..b1e383dda1 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -543,6 +543,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_WINCE) && !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); -- cgit v1.2.3 From 949aaffb4fda892f39ae488496db2270a65cb1c1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Mar 2016 15:50:37 +0100 Subject: tst_QNetworkReply: fix mis-guided use of QSKIP(). QSKIP() causes the whole test to be skipped, where this work-around for a known quirk of the test server only requires skipping a single Q_COMPARE(); the rest of the test passes fine without it. Change-Id: Ie4612bd428f4cb4b342fad908cc2784fbadf069c Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index ce56dcacba..088b721a89 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6814,9 +6814,9 @@ 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: + if (reply->error() != QNetworkReply::HostNotFoundError) + QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); QCOMPARE(authSpy.count(), 0); QVERIFY(proxyAuthSpy.count() > 0); proxyAuthSpy.clear(); -- cgit v1.2.3 From 541c9d4d2acd045459c3e75eee80c63b36af9ed0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Mar 2016 17:00:29 +0100 Subject: tst_QNetworkReply: Commentary fixes on test server workarounds. Follow-up to commit 6fd205d5: document which version of danted shall make one work-around redundant, document that another work-around is still needed even with that v1.1.19; and remove a comment that referred back to an XFAIL that commit 6fd205d5 removed. Change-Id: I270b662528127c82184bff20b3cecea4f0c41b41 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 088b721a89..02aca3d6c1 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6814,19 +6814,19 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); - // Work round known quirk in the old test server: + // 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 } -- cgit v1.2.3