diff options
Diffstat (limited to 'tests')
11 files changed, 88 insertions, 80 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 9d47bb2884..734b26cd65 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1384,16 +1384,22 @@ void tst_QDir::absoluteFilePath_data() QTest::addColumn<QString>("fileName"); QTest::addColumn<QString>("expectedFilePath"); - QTest::newRow("0") << "/etc" << "/passwd" << "/passwd"; - QTest::newRow("1") << "/etc" << "passwd" << "/etc/passwd"; - QTest::newRow("2") << "/" << "passwd" << "/passwd"; - QTest::newRow("3") << "relative" << "path" << QDir::currentPath() + "/relative/path"; - QTest::newRow("4") << "" << "" << QDir::currentPath(); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) - QTest::newRow("5") << "//machine" << "share" << "//machine/share"; + QTest::newRow("UNC") << "//machine" << "share" << "//machine/share"; + QTest::newRow("Drive") << "c:/side/town" << "/my/way/home" << "c:/my/way/home"; +#define DRIVE "Q:" +#else +#define DRIVE #endif + QTest::newRow("0") << DRIVE "/etc" << "/passwd" << DRIVE "/passwd"; + QTest::newRow("1") << DRIVE "/etc" << "passwd" << DRIVE "/etc/passwd"; + QTest::newRow("2") << DRIVE "/" << "passwd" << DRIVE "/passwd"; + QTest::newRow("3") << "relative" << "path" << QDir::currentPath() + "/relative/path"; + QTest::newRow("4") << "" << "" << QDir::currentPath(); + QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar"; +#undef DRIVE } void tst_QDir::absoluteFilePath() diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 9a338ad55a..fedb88f1a8 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -528,8 +528,16 @@ void tst_QPixmap::fill_transparent() QVERIFY(pixmap.hasAlphaChannel()); } +static bool isPlatformWayland() +{ + return QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive); +} + void tst_QPixmap::mask() { + if (isPlatformWayland()) + QSKIP("Wayland: This fails. See QTBUG-66983."); + QPixmap pm(100, 100); QBitmap bm(100, 100); @@ -792,6 +800,9 @@ void tst_QPixmap::convertFromImageNoDetach() void tst_QPixmap::convertFromImageNoDetach2() { + if (isPlatformWayland()) + QSKIP("Wayland: This fails. See QTBUG-66984."); + QPixmap randomPixmap(10, 10); if (randomPixmap.handle()->classId() != QPlatformPixmap::RasterClass) QSKIP("Test only valid for raster pixmaps"); @@ -1466,6 +1477,9 @@ void tst_QPixmap::fromImageReaderAnimatedGif() void tst_QPixmap::task_246446() { + if (isPlatformWayland()) + QSKIP("Wayland: This fails. See QTBUG-66985."); + // This crashed without the bugfix in 246446 QPixmap pm(10, 10); pm.fill(Qt::transparent); // force 32-bit depth diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 4f27aeb899..b5a69d920a 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -35,9 +35,12 @@ #include <QtGui/QFont> #include <QtGui/QPalette> #include <QtGui/QStyleHints> +#include <qpa/qplatformintegration.h> #include <qpa/qwindowsysteminterface.h> #include <qgenericplugin.h> +#include <private/qguiapplication_p.h> + #if defined(Q_OS_QNX) #include <QOpenGLContext> #endif @@ -203,8 +206,8 @@ void tst_QGuiApplication::focusObject() int argc = 0; QGuiApplication app(argc, 0); - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("QWindow::requestActivate() is not supported."); QObject obj1, obj2, obj3; const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); @@ -374,8 +377,8 @@ void tst_QGuiApplication::changeFocusWindow() int argc = 0; QGuiApplication app(argc, 0); - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("QWindow::requestActivate() is not supported."); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp index 509f8bd45f..15c905f943 100644 --- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp +++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp @@ -186,8 +186,8 @@ void tst_qinputmethod::cursorRectangle() { QCOMPARE(qApp->inputMethod()->cursorRectangle(), QRectF()); - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("QWindow::requestActivate() is not supported."); DummyWindow window; window.show(); @@ -284,8 +284,8 @@ void tst_qinputmethod::inputDirection() void tst_qinputmethod::inputMethodAccepted() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("QWindow::requestActivate() is not supported."); if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) { diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index 706c66ef14..d16d95500b 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -317,9 +317,6 @@ void tst_QTouchEvent::touchDisabledByDefault() void tst_QTouchEvent::touchEventAcceptedByDefault() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - // QWidget { // enabling touch events should automatically accept touch events @@ -606,9 +603,6 @@ QPointF normalized(const QPointF &pos, const QRectF &rect) void tst_QTouchEvent::basicRawEventTranslation() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - tst_QTouchEventWidget touchWidget; touchWidget.setWindowTitle(QTest::currentTestFunction()); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); @@ -733,9 +727,6 @@ void tst_QTouchEvent::basicRawEventTranslation() void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - tst_QTouchEventWidget touchWidget; touchWidget.setWindowTitle(QTest::currentTestFunction()); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); @@ -962,9 +953,6 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - tst_QTouchEventWidget touchWidget; touchWidget.setWindowTitle(QTest::currentTestFunction()); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); @@ -1191,9 +1179,6 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() void tst_QTouchEvent::basicRawEventTranslationOfIds() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - tst_QTouchEventWidget touchWidget; touchWidget.setWindowTitle(QTest::currentTestFunction()); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); @@ -1311,9 +1296,6 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() void tst_QTouchEvent::deleteInEventHandler() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - // QWidget { QWidget window; @@ -1463,9 +1445,6 @@ void tst_QTouchEvent::deleteInEventHandler() void tst_QTouchEvent::deleteInRawEventTranslation() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) - QSKIP("Wayland: This fails. Figure out why."); - tst_QTouchEventWidget touchWidget; touchWidget.setWindowTitle(QTest::currentTestFunction()); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index f77afd2364..1332b369e7 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -4016,12 +4016,12 @@ void tst_QSslSocket::signatureAlgorithm() SslServer server; server.protocol = serverProtocol; server.config.setCiphers({QSslCipher("ECDHE-RSA-AES256-SHA")}); - server.config.setBackendConfigOption(QByteArrayLiteral("SignatureAlgorithms"), serverSigAlgPairs.join(':')); + server.config.setBackendConfigurationOption(QByteArrayLiteral("SignatureAlgorithms"), serverSigAlgPairs.join(':')); QVERIFY(server.listen()); QSslConfiguration clientConfig = QSslConfiguration::defaultConfiguration(); clientConfig.setProtocol(clientProtocol); - clientConfig.setBackendConfigOption(QByteArrayLiteral("SignatureAlgorithms"), clientSigAlgPairs.join(':')); + clientConfig.setBackendConfigurationOption(QByteArrayLiteral("SignatureAlgorithms"), clientSigAlgPairs.join(':')); QSslSocket client; client.setSslConfiguration(clientConfig); socket = &client; diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index a959a71749..c059b83511 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -257,7 +257,7 @@ def main(name, *args): # Avoid interference from any qtlogging.ini files, e.g. in # /etc/xdg/QtProject/, (must match tst_selftests.cpp's # processEnvironment()'s value): - QT_LOGGING_RULES = '*.debug=true;qt.qpa.screen=false') + QT_LOGGING_RULES = '*.debug=true;qt.*=false') herePath = os.getcwd() cleaner = Cleaner(herePath, name) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 8ac2ca7b90..1da1787c1d 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -417,7 +417,6 @@ tst_Selftests::tst_Selftests() void tst_Selftests::initTestCase() { QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString())); - qputenv("QT_LOGGING_RULES", QByteArrayLiteral("*.debug=false")); // Silence any debug output //Detect the location of the sub programs QString subProgram = QLatin1String("float/float"); #if defined(Q_OS_WIN) @@ -657,7 +656,7 @@ static QProcessEnvironment processEnvironment() // Avoid interference from any qtlogging.ini files, e.g. in /etc/xdg/QtProject/: result.insert(QStringLiteral("QT_LOGGING_RULES"), // Must match generate_expected_output.py's main()'s value: - QStringLiteral("*.debug=true;qt.qpa.screen=false")); + QStringLiteral("*.debug=true;qt.*=false")); } return result; } diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index dfe5baba71..a1cb729849 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -52,7 +52,6 @@ private slots: void boundingRect2(); void draw(); void opacity(); - void nestedOpaqueOpacity(); void grayscale(); void colorize(); void drawPixmapItem(); @@ -408,26 +407,6 @@ void tst_QGraphicsEffect::opacity() QCOMPARE(effect->m_opacity, qreal(0.5)); } -void tst_QGraphicsEffect::nestedOpaqueOpacity() -{ - // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with - // QGraphicsOpacityEffect caused crashes due to constructing several - // QPainter instances on a device in the fast path for - // QGraphicsOpacityEffect::opacity=1 - QWidget topLevel; - topLevel.setWindowTitle(QTest::currentTestFunction()); - topLevel.resize(320, 200); - QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect; - opacityEffect->setOpacity(1); - topLevel.setGraphicsEffect(opacityEffect); - QWidget *child = new QWidget(&topLevel); - child->resize(topLevel.size() / 2); - QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect; - child->setGraphicsEffect(childEffect); - topLevel.show(); - QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); -} - void tst_QGraphicsEffect::grayscale() { if (qApp->desktop()->depth() < 24) diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 812ca4b223..74a2f7f2b6 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -544,11 +544,11 @@ void tst_QHeaderView::movable() view->setSectionsMovable(true); QCOMPARE(view->sectionsMovable(), true); - QCOMPARE(view->firstSectionMovable(), true); + QCOMPARE(view->isFirstSectionMovable(), true); view->setFirstSectionMovable(false); - QCOMPARE(view->firstSectionMovable(), false); + QCOMPARE(view->isFirstSectionMovable(), false); view->setFirstSectionMovable(true); - QCOMPARE(view->firstSectionMovable(), true); + QCOMPARE(view->isFirstSectionMovable(), true); } void tst_QHeaderView::clickable() diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp index caf8c70c6f..c0366dea63 100644 --- a/tests/manual/qtabletevent/regular_widgets/main.cpp +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -61,23 +61,38 @@ struct TabletPoint class ProximityEventFilter : public QObject { + Q_OBJECT public: explicit ProximityEventFilter(QObject *parent) : QObject(parent) { } - bool eventFilter(QObject *, QEvent *event) override - { - switch (event->type()) { - case QEvent::TabletEnterProximity: - case QEvent::TabletLeaveProximity: - qDebug() << event; - break; - default: - break; - } - return false; - } + bool eventFilter(QObject *, QEvent *event) override; + + static bool tabletPenProximity() { return m_tabletPenProximity; } + +signals: + void proximityChanged(); + +private: + static bool m_tabletPenProximity; }; +bool ProximityEventFilter::eventFilter(QObject *, QEvent *event) +{ + switch (event->type()) { + case QEvent::TabletEnterProximity: + case QEvent::TabletLeaveProximity: + ProximityEventFilter::m_tabletPenProximity = event->type() == QEvent::TabletEnterProximity; + emit proximityChanged(); + qDebug() << event; + break; + default: + break; + } + return false; +} + +bool ProximityEventFilter::m_tabletPenProximity = false; + class EventReportWidget : public QWidget { Q_OBJECT @@ -111,6 +126,7 @@ private: Qt::MouseButton m_lastButton = Qt::NoButton; QVector<TabletPoint> m_points; QVector<QPointF> m_touchPoints; + QPointF m_tabletPos; int m_tabletMoveCount = 0; int m_paintEventCount = 0; }; @@ -169,6 +185,13 @@ void EventReportWidget::paintEvent(QPaintEvent *) } } } + + // Draw haircross when tablet pen is in proximity + if (ProximityEventFilter::tabletPenProximity() && geom.contains(m_tabletPos)) { + p.setPen(Qt::black); + p.drawLine(QPointF(0, m_tabletPos.y()), QPointF(geom.width(), m_tabletPos.y())); + p.drawLine(QPointF(m_tabletPos.x(), 0), QPointF(m_tabletPos.x(), geom.height())); + } p.setPen(Qt::blue); for (QPointF t : m_touchPoints) { p.drawLine(t.x() - 40, t.y(), t.x() + 40, t.y()); @@ -181,20 +204,21 @@ void EventReportWidget::tabletEvent(QTabletEvent *event) { QWidget::tabletEvent(event); bool isMove = false; + m_tabletPos = event->posF(); switch (event->type()) { case QEvent::TabletMove: - m_points.push_back(TabletPoint(event->pos(), TabletMove, m_lastButton, event->pointerType(), event->pressure(), event->rotation())); + m_points.push_back(TabletPoint(m_tabletPos, TabletMove, m_lastButton, event->pointerType(), event->pressure(), event->rotation())); update(); isMove = true; ++m_tabletMoveCount; break; case QEvent::TabletPress: - m_points.push_back(TabletPoint(event->pos(), TabletButtonPress, event->button(), event->pointerType(), event->rotation())); + m_points.push_back(TabletPoint(m_tabletPos, TabletButtonPress, event->button(), event->pointerType(), event->rotation())); m_lastButton = event->button(); update(); break; case QEvent::TabletRelease: - m_points.push_back(TabletPoint(event->pos(), TabletButtonRelease, event->button(), event->pointerType(), event->rotation())); + m_points.push_back(TabletPoint(m_tabletPos, TabletButtonRelease, event->button(), event->pointerType(), event->rotation())); update(); break; default: @@ -253,10 +277,14 @@ void EventReportWidget::timerEvent(QTimerEvent *) int main(int argc, char *argv[]) { QApplication app(argc, argv); - app.installEventFilter(new ProximityEventFilter(&app)); + + ProximityEventFilter *proximityEventFilter = new ProximityEventFilter(&app); + app.installEventFilter(proximityEventFilter); QMainWindow mainWindow; mainWindow.setWindowTitle(QString::fromLatin1("Tablet Test %1").arg(QT_VERSION_STR)); EventReportWidget *widget = new EventReportWidget; + QObject::connect(proximityEventFilter, &ProximityEventFilter::proximityChanged, + widget, QOverload<void>::of(&QWidget::update)); widget->setMinimumSize(640, 480); QMenu *fileMenu = mainWindow.menuBar()->addMenu("File"); fileMenu->addAction("Clear", widget, &EventReportWidget::clearPoints); |