diff options
Diffstat (limited to 'tests/auto/other')
9 files changed, 117 insertions, 37 deletions
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index 9abe9a77c0..c1d39d8b72 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -106,7 +106,7 @@ public: QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { - QGestureRecognizer::Result result = 0; + QGestureRecognizer::Result result; if (CustomGestureRecognizer::ConsumeEvents) result |= QGestureRecognizer::ConsumeEventHint; CustomGesture *g = static_cast<CustomGesture*>(state); @@ -2200,41 +2200,41 @@ void tst_Gestures::testReuseCanceledGestures() targetPos = gv->viewport()->mapFromParent(targetPos); // "Tap" starts on child widget - QTest::mousePress(gv->viewport(), Qt::LeftButton, 0, targetPos); + QTest::mousePress(gv->viewport(), Qt::LeftButton, { }, targetPos); QCOMPARE(target->started(), 1); QCOMPARE(target->updated(), 0); QCOMPARE(target->finished(), 0); QCOMPARE(target->canceled(), 0); // Canceling gesture starts on parent - QTest::mousePress(gv->viewport(), Qt::RightButton, 0, targetPos); + QTest::mousePress(gv->viewport(), Qt::RightButton, { }, targetPos); QCOMPARE(target->started(), 1); QCOMPARE(target->updated(), 0); QCOMPARE(target->finished(), 0); QCOMPARE(target->canceled(), 1); // <- child canceled // Canceling gesture ends - QTest::mouseRelease(gv->viewport(), Qt::RightButton, 0, targetPos); + QTest::mouseRelease(gv->viewport(), Qt::RightButton, { }, targetPos); QCOMPARE(target->started(), 1); QCOMPARE(target->updated(), 0); QCOMPARE(target->finished(), 0); QCOMPARE(target->canceled(), 1); // Tap would end if not canceled - QTest::mouseRelease(gv->viewport(), Qt::LeftButton, 0, targetPos); + QTest::mouseRelease(gv->viewport(), Qt::LeftButton, { }, targetPos); QCOMPARE(target->started(), 1); QCOMPARE(target->updated(), 0); QCOMPARE(target->finished(), 0); QCOMPARE(target->canceled(), 1); // New "Tap" starts - QTest::mousePress(gv->viewport(), Qt::LeftButton, 0, targetPos); + QTest::mousePress(gv->viewport(), Qt::LeftButton, { }, targetPos); QCOMPARE(target->started(), 2); QCOMPARE(target->updated(), 0); QCOMPARE(target->finished(), 0); QCOMPARE(target->canceled(), 1); - QTest::mouseRelease(gv->viewport(), Qt::LeftButton, 0, targetPos); + QTest::mouseRelease(gv->viewport(), Qt::LeftButton, { }, targetPos); QCOMPARE(target->started(), 2); QCOMPARE(target->updated(), 0); QCOMPARE(target->finished(), 1); diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 215a4c2a29..7430c93a8e 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -230,9 +230,9 @@ void PaintCommands::staticInit() "begin_block <blockName>", "begin_block blockName"); DECL_PAINTCOMMAND("end_block", command_end_block, - "^end_block$", - "end_block", - "end_block"); + "^end_block\\s*(\\w*)$", + "end_block [blockName]", + "end_block blockName"); DECL_PAINTCOMMAND("repeat_block", command_repeat_block, "^repeat_block\\s+(\\w*)$", "repeat_block <blockName>", @@ -744,6 +744,13 @@ void PaintCommands::runCommands() if (height <= 0) height = 800; + m_pathMap.clear(); + m_imageMap.clear(); + m_pixmapMap.clear(); + m_regionMap.clear(); + m_gradientStops.clear(); + m_blockMap.clear(); + // paint background if (m_checkers_background) { QPixmap pm(20, 20); @@ -901,6 +908,8 @@ void PaintCommands::command_begin_block(QRegularExpressionMatch re) const QString &blockName = re.captured(1); if (m_verboseMode) printf(" -(lance) begin_block (%s)\n", qPrintable(blockName)); + if (m_blockMap.contains(blockName)) + qFatal("Two blocks named (%s)", qPrintable(blockName)); m_commands[m_currentCommandIndex] = QLatin1String("# begin block (") + blockName + QLatin1Char(')'); QStringList newBlock; diff --git a/tests/auto/other/lancelot/scripts/filltest.qps b/tests/auto/other/lancelot/scripts/filltest.qps index 2eeba2ecf6..112ffc85be 100644 --- a/tests/auto/other/lancelot/scripts/filltest.qps +++ b/tests/auto/other/lancelot/scripts/filltest.qps @@ -133,7 +133,7 @@ setPen nopen translate 50 0 -begin_block rects +begin_block rects2 drawPath rect drawRect 0 20 10 10 drawImage img 0 40 @@ -154,59 +154,59 @@ translate 10 20 rotate 90 drawRect 0 0 10 10 restore -end_block rects +end_block rects2 setPen red drawText -5 -10 "0.0" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.1" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.2" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.3" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.4" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.5" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.6" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.7" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.8" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.9" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "1.0" setPen nopen @@ -410,4 +410,4 @@ drawText 0 0 "outline/fill consistency" setPen red setBrush green translate 80 -30 -drawPolygon [13.6965 -99.1837 -71.4767 13.823 32.4596 -33.1847]
\ No newline at end of file +drawPolygon [13.6965 -99.1837 -71.4767 13.823 32.4596 -33.1847] diff --git a/tests/auto/other/lancelot/scripts/perspectives2.qps b/tests/auto/other/lancelot/scripts/perspectives2.qps index 2f6d1d653c..6762e21af4 100644 --- a/tests/auto/other/lancelot/scripts/perspectives2.qps +++ b/tests/auto/other/lancelot/scripts/perspectives2.qps @@ -8,7 +8,7 @@ image_convertToFormat zebra_png zebra ARGB32_Premultiplied translate 75 100 # standard draw -begin_block row +begin_block row1 drawImage zebra -50 -50 translate 90 0 @@ -136,12 +136,12 @@ save rotate_y 180 drawImage zebra -50 -50 restore -end_block +end_block row1 resetMatrix translate 75 280 setRenderHint SmoothPixmapTransform -repeat_block row +repeat_block row1 resetMatrix setPen black @@ -162,7 +162,7 @@ setRenderHint SmoothPixmapTransform false translate 75 100 # standard draw -begin_block row +begin_block row2 drawImage dome -50 -50 translate 90 0 @@ -290,13 +290,13 @@ save rotate_y 180 drawImage dome -50 -50 restore -end_block +end_block row2 resetMatrix translate 0 400 translate 75 280 setRenderHint SmoothPixmapTransform -repeat_block row +repeat_block row2 resetMatrix setPen black @@ -306,4 +306,4 @@ drawText 0 0 "Fast Pixmap Transform" resetMatrix translate 0 400 translate 300 210 -drawText 0 0 "Smooth Pixmap Transform"
\ No newline at end of file +drawText 0 0 "Smooth Pixmap Transform" diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 1b125d8825..0f50718328 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -302,7 +302,7 @@ static void netChat(int port, const QList<Chat> &chat) if (it + 1 != chat.constEnd()) break; - // fall through: + Q_FALLTHROUGH(); case Chat::RemoteDisconnect: case Chat::DiscardUntilDisconnect: qDebug() << i << "Waiting for remote disconnect"; @@ -428,7 +428,7 @@ void tst_NetworkSelfTest::serverReachability() QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); - QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, + QVERIFY2(socket.socketError() == QAbstractSocket::ConnectionRefusedError, QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); } @@ -458,7 +458,7 @@ void tst_NetworkSelfTest::remotePortsOpen() socket.connectToHost(QtNetworkSettings::serverName(), portNumber); if (!socket.waitForConnected(10000)) { - if (socket.error() == QAbstractSocket::SocketTimeoutError) + if (socket.socketError() == QAbstractSocket::SocketTimeoutError) QFAIL(QString("Network timeout connecting to the server on port %1").arg(portNumber).toLocal8Bit()); else QFAIL(QString("Error connecting to server on port %1: %2").arg(portNumber).arg(socket.errorString()).toLocal8Bit()); diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index cc6b1887a3..743de1e188 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -11,7 +11,7 @@ SUBDIRS=\ macplist \ networkselftest \ qaccessibility \ - # qaccessibilitylinux \ # QTBUG-44434 + # qaccessibilitylinux # QTBUG-44434 \ qaccessibilitymac \ qcomplextext \ qfocusevent \ diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index f4f8bcc667..0e61647e76 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -311,7 +311,7 @@ void tst_QAccessibility::eventTest() QVERIFY(QTestAccessibility::containsEvent(&showEvent)); button->setFocus(Qt::MouseFocusReason); QTestAccessibility::clearEvents(); - QTest::mouseClick(button, Qt::LeftButton, 0); + QTest::mouseClick(button, Qt::LeftButton, { }); button->setAccessibleName("Olaf the second"); QAccessibleEvent nameEvent(button, QAccessible::NameChanged); @@ -2830,14 +2830,14 @@ void tst_QAccessibility::listTest() QTestAccessibility::clearEvents(); // Check for events - QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center()); + QTest::mouseClick(listView->viewport(), Qt::LeftButton, { }, listView->visualItemRect(listView->item(1)).center()); QAccessibleEvent selectionEvent(listView, QAccessible::SelectionAdd); selectionEvent.setChild(1); QAccessibleEvent focusEvent(listView, QAccessible::Focus); focusEvent.setChild(1); QVERIFY(QTestAccessibility::containsEvent(&selectionEvent)); QVERIFY(QTestAccessibility::containsEvent(&focusEvent)); - QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center()); + QTest::mouseClick(listView->viewport(), Qt::LeftButton, { }, listView->visualItemRect(listView->item(2)).center()); QAccessibleEvent selectionEvent2(listView, QAccessible::SelectionAdd); selectionEvent2.setChild(2); diff --git a/tests/auto/other/sessionmanagement_macos/sessionmanagement_macos.pro b/tests/auto/other/sessionmanagement_macos/sessionmanagement_macos.pro new file mode 100644 index 0000000000..cef53bdf28 --- /dev/null +++ b/tests/auto/other/sessionmanagement_macos/sessionmanagement_macos.pro @@ -0,0 +1,10 @@ +CONFIG += testcase +TARGET = tst_sessionmanagement_macos + +OBJECTIVE_SOURCES += tst_sessionmanagement_macos.mm + +QT = testlib gui core +LIBS += -framework AppKit + +requires(mac) +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm b/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm new file mode 100644 index 0000000000..934b15ca44 --- /dev/null +++ b/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Samuel Gaist <samuel.gaist@idiap.ch> +** 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 <QtTest/QtTest> +#include <QSignalSpy> +#include <QSessionManager> +#include <AppKit/AppKit.h> + +// Q_DECLARE_METATYPE(QSessionManager) + +class tst_SessionManagement_macOS : public QObject +{ + Q_OBJECT + +private slots: + void stopApplication(); +}; + +/* + Test that session handling code is properly called +*/ +void tst_SessionManagement_macOS::stopApplication() +{ + int argc = 0; + QGuiApplication app(argc, nullptr); + QSignalSpy spy(&app, &QGuiApplication::commitDataRequest); + QTimer::singleShot(1000, []() { + [NSApp terminate:nil]; + }); + app.exec(); + QCOMPARE(spy.count(), 1); +} + +QTEST_APPLESS_MAIN(tst_SessionManagement_macOS) +#include "tst_sessionmanagement_macos.moc" |