From c593492d1678a2ec08f1bfffcb572459b3bc6c00 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 26 Sep 2018 15:39:35 +0200 Subject: Modernize the "animation" feature Change-Id: Ibc164b3df3cf87db569ef4813de458a9067b7f7d Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 1ea1843abe..34cdcd5bf7 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -112,7 +112,7 @@ private slots: void expandAndCollapse(); void expandAndCollapseAll(); void expandWithNoChildren(); -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) void quickExpandCollapse(); #endif void keyboardNavigation(); @@ -4401,7 +4401,7 @@ void tst_QTreeView::testInitialFocus() QCOMPARE(treeWidget.currentIndex().column(), 2); } -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) void tst_QTreeView::quickExpandCollapse() { //this unit tests makes sure the state after the animation is restored correctly @@ -4433,7 +4433,7 @@ void tst_QTreeView::quickExpandCollapse() QCOMPARE(tree.state(), initialState); } -#endif +#endif // animation void tst_QTreeView::taskQTBUG_37813_crash() { -- cgit v1.2.3 From bbe08d6b686456297ad4ab8c0923c3126e02e2b3 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 3 Oct 2018 09:59:06 +0200 Subject: QCss: properly parse functions which contains additional spaces When there were additional spaces between the function definition and the first parameter, the parser failed to parse it when it contained another function (e.g. 'qlineargradient(... rgb() ...)'). The reason for this was that ::until() needs the function at index-1 so it can correctly count the opening parenthesis. Fixes: QTBUG-61795 Change-Id: I992f556e7f8cd45550f83bc90aa8de2b4e905574 Reviewed-by: Richard Moe Gustavsen --- tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 2a53f5d633..cfd24a8701 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -1509,6 +1509,12 @@ void tst_QCssParser::gradient_data() "spread: repeat, stop:0.2 rgb(1, 2, 3), stop:0.5 rgba(1, 2, 3, 4))" << "conical" << QPointF(4, 2) << QPointF() << 2 << qreal(0.2) << QColor(1, 2, 3) << qreal(0.5) << QColor(1, 2, 3, 4); + // spaces before first function parameter lead to parser errors + QTest::newRow("QTBUG-61795") << + "selection-background-color: qconicalgradient( cx: 4, cy : 2, angle: 23, " + "spread: repeat, stop:0.2 rgb( 1, 2, 3), stop:0.5 rgba( 1, 2, 3, 4))" << "conical" << QPointF(4, 2) << QPointF() + << 2 << qreal(0.2) << QColor(1, 2, 3) << qreal(0.5) << QColor(1, 2, 3, 4); + /* won't pass: stop values are expected to be sorted QTest::newRow("unsorted-stop") << "selection-background: lineargradient(x1:0, y1:0, x2:0, y2:1, " -- cgit v1.2.3 From 0a7aebadfbb3534284546aa3ca8612314c08f136 Mon Sep 17 00:00:00 2001 From: Miguel Costa Date: Tue, 26 Jun 2018 16:56:45 +0200 Subject: Update ANGLE to chromium/3280 Change-Id: I0802c0d7486f772d361f87a544d6c5af937f4ca1 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 228d03350a..ab746dfee8 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -2506,6 +2506,7 @@ void tst_QTableView::columnViewportPosition() view.horizontalScrollBar()->setValue(horizontalScrollValue); #ifdef Q_OS_WINRT + QEXPECT_FAIL("column 1, scroll per item, 1", "Fails on WinRT - QTBUG-68297", Abort); QEXPECT_FAIL("column 5, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); QEXPECT_FAIL("column 9, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); QEXPECT_FAIL("column 1, scroll per pixel 1", "Fails on WinRT - QTBUG-68297", Abort); -- cgit v1.2.3 From 1192c463db34e3f69be4d9ef976246ce265143a3 Mon Sep 17 00:00:00 2001 From: Alexandra Cherdantseva Date: Fri, 7 Sep 2018 13:07:35 +0300 Subject: QImageWriter/QPNGHandler: Quality option should be CompressionRatio Wrong option was used to set zlib compression level for png setCompression with negative value uses default compression setCompression with value between 0-100 converts to zlib compression level 0-9 setCompression with positive value overrides Quality option Change-Id: Ic4b048a1e30d6940019c2a00a6c24d0c11e3f821 Reviewed-by: Alexandra Cherdantseva Reviewed-by: Eirik Aavitsland --- tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 1 + tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index aa9a990fef..c2ec5b8925 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -1603,6 +1603,7 @@ void tst_QImageReader::supportsOption_data() << (QIntList() << QImageIOHandler::Gamma << QImageIOHandler::Description << QImageIOHandler::Quality + << QImageIOHandler::CompressionRatio << QImageIOHandler::Size << QImageIOHandler::ScaledSize); } diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index a53c2ddb5b..77851cd7d0 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -408,6 +408,7 @@ void tst_QImageWriter::supportsOption_data() << (QIntList() << QImageIOHandler::Gamma << QImageIOHandler::Description << QImageIOHandler::Quality + << QImageIOHandler::CompressionRatio << QImageIOHandler::Size << QImageIOHandler::ScaledSize); } -- cgit v1.2.3 From f2f040ae1c4fe48bff68bb45b2e20308fa895c50 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 2 Oct 2018 12:36:04 +0200 Subject: Improve support for QImages in QDataStream read transactions QImage's operator>>(QDataStream&) did not set an error mode on the stream on read failures. That would break QDataStream transactions. Since the current QImage serialization cannot differentiate between truncated and corrupted data, we set the ReadPastEnd error as expected by the transaction system. Also specify the expected file format on decoding QImage from stream, to avoid all the format handlers' canRead() being invoked. This is necessary since some of them may call ungetChar(), which fails when the stream is in a transaction. Also add testing of this feature to the QDataStram transaction autotest. That required a slight rewrite of the fake sequential QIODevice subclass. The previous implementation had incorrect behavior of peek(), which is required by QImage decoders. Task-number: QTBUG-70875 Change-Id: If3f1ca7186ad1e6ca0e6e8ea81d2b2fbece6ea01 Reviewed-by: Alex Trotsenko Reviewed-by: Thiago Macieira --- .../serialization/qdatastream/tst_qdatastream.cpp | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index c6faf8c7d5..011a0e1a85 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -2211,25 +2211,22 @@ void tst_QDataStream::setVersion() } } -class SequentialBuffer : public QBuffer +class SequentialBuffer : public QIODevice { public: - SequentialBuffer(QByteArray *data) : QBuffer(data) { offset = 0; } + SequentialBuffer(QByteArray *data) : QIODevice() { buf.setBuffer(data); } - bool isSequential() const { return true; } - bool seek(qint64 pos) { offset = pos; return QBuffer::seek(pos); } - qint64 pos() const { return qint64(offset); } + bool isSequential() const override { return true; } + bool open(OpenMode mode) override { return buf.open(mode) && QIODevice::open(mode | QIODevice::Unbuffered); } + void close() override { buf.close(); QIODevice::close(); } + qint64 bytesAvailable() const override { return QIODevice::bytesAvailable() + buf.bytesAvailable(); } protected: - qint64 readData(char *data, qint64 maxSize) - { - qint64 ret = QBuffer::readData(data, maxSize); - offset += ret; - return ret; - } + qint64 readData(char *data, qint64 maxSize) override { return buf.read(data, maxSize); } + qint64 writeData(const char *data, qint64 maxSize) override { return buf.write(data, maxSize); } private: - int offset; + QBuffer buf; }; void tst_QDataStream::skipRawData_data() @@ -3329,15 +3326,21 @@ void tst_QDataStream::transaction_data() QTest::addColumn("bData"); QTest::addColumn("fData"); QTest::addColumn("dData"); + QTest::addColumn("imgData"); QTest::addColumn("strData"); QTest::addColumn("rawData"); + QImage img1(open_xpm); + QImage img2; + QImage img3(50, 50, QImage::Format_ARGB32); + img3.fill(qRgba(12, 34, 56, 78)); + QTest::newRow("1") << qint8(1) << qint16(2) << qint32(3) << qint64(4) << true << 5.0f - << double(6.0) << QByteArray("Hello world!") << QByteArray("Qt rocks!"); + << double(6.0) << img1 << QByteArray("Hello world!") << QByteArray("Qt rocks!"); QTest::newRow("2") << qint8(1 << 6) << qint16(1 << 14) << qint32(1 << 30) << qint64Data(3) << false << 123.0f - << double(234.0) << stringData(5).toUtf8() << stringData(6).toUtf8(); + << double(234.0) << img2 << stringData(5).toUtf8() << stringData(6).toUtf8(); QTest::newRow("3") << qint8(-1) << qint16(-2) << qint32(-3) << qint64(-4) << true << -123.0f - << double(-234.0) << stringData(3).toUtf8() << stringData(4).toUtf8(); + << double(-234.0) << img3 << stringData(3).toUtf8() << stringData(4).toUtf8(); } void tst_QDataStream::transaction() @@ -3351,6 +3354,7 @@ void tst_QDataStream::transaction() QFETCH(bool, bData); QFETCH(float, fData); QFETCH(double, dData); + QFETCH(QImage, imgData); QFETCH(QByteArray, strData); QFETCH(QByteArray, rawData); @@ -3358,12 +3362,13 @@ void tst_QDataStream::transaction() QDataStream stream(&testBuffer, QIODevice::WriteOnly); stream << i8Data << i16Data << i32Data << i64Data - << bData << fData << dData << strData.constData(); + << bData << fData << dData << imgData << strData.constData(); stream.writeRawData(rawData.constData(), rawData.size()); } for (int splitPos = 0; splitPos <= testBuffer.size(); ++splitPos) { QByteArray readBuffer(testBuffer.left(splitPos)); + SequentialBuffer dev(&readBuffer); dev.open(QIODevice::ReadOnly); QDataStream stream(&dev); @@ -3375,12 +3380,13 @@ void tst_QDataStream::transaction() bool b; float f; double d; + QImage img; char *str; QByteArray raw(rawData.size(), 0); forever { stream.startTransaction(); - stream >> i8 >> i16 >> i32 >> i64 >> b >> f >> d >> str; + stream >> i8 >> i16 >> i32 >> i64 >> b >> f >> d >> img >> str; stream.readRawData(raw.data(), raw.size()); if (stream.commitTransaction()) @@ -3402,6 +3408,7 @@ void tst_QDataStream::transaction() QCOMPARE(b, bData); QCOMPARE(f, fData); QCOMPARE(d, dData); + QCOMPARE(img, imgData); QVERIFY(strData == str); delete [] str; QCOMPARE(raw, rawData); -- cgit v1.2.3 From 02a214442781bf112c1cc85d2470c6fcec8ed207 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 10 Oct 2018 12:36:17 +0200 Subject: QToolTip: Don't crash if a tool tip is shown outside screen geometry In some cases, a tool tip may be shown outside screen geometry, i.e. if: - QToolTip::showText is invoked manually with a position outside. - In tst_QToolTip::setPalette if there is no screen at (0, 0). This might happen in a multi-monitor setups where one screen is taller than the other. - On Wayland windows are (by design) not allowed to know their position on the screen. This means that global positions can't be trusted. This started crashing when QDesktopWidget::screenGeometry(pos) was replaced with QGuiApplication::screenAt(pos)->geometry() because screenAt will return null if no screen is found, while screenGeometry defaulted to the primary screen. This reverts to the old behavior of falling back to the primary screen. This won't solve the issue completely for the Wayland case, but at least we will stop crashing. Change-Id: I42dd07cc21c2f9f0ea0d69f0c25bd46d8a2615a0 Reviewed-by: Filipe Azevedo Reviewed-by: Christian Ehrlicher Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp index e02573f8e8..3d609d0b9c 100644 --- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp +++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp @@ -46,6 +46,7 @@ private slots: void whatsThis(); void setPalette(); void qtbug64550_stylesheet(); + void dontCrashOutsideScreenGeometry(); }; void tst_QToolTip::init() @@ -218,5 +219,11 @@ void tst_QToolTip::qtbug64550_stylesheet() msgSizeTooSmall(toolTipSize, boundingRect.size()).constData()); } +void tst_QToolTip::dontCrashOutsideScreenGeometry() { + QToolTip::showText(QPoint(-10000, -10000), "tip outside monitor", nullptr); + QTRY_VERIFY(QToolTip::isVisible()); + QToolTip::hideText(); +} + QTEST_MAIN(tst_QToolTip) #include "tst_qtooltip.moc" -- cgit v1.2.3 From 402efef57bb6a04ad778d3139100becc2cba31eb Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 8 Oct 2018 10:10:07 +0200 Subject: Don't drop update requests when closing and reopening windows Before commit 4d15f393a76cfcc4d54f311884fedac5bf0f72ee update requests were handled by a timer on QWindow. Therefore they survived the closing and re-opening of platform windows. Now, as the timer was moved to QPlatformWindow, it gets reset when you close the QWindow, and any pending update requests are lost. However, we do set the updateRequestPending variable on QWindow when requesting an update. Therefore, we can also restore the update timer on the platform window when creating it. Change-Id: I23b00f24a46706beac7d1455edd8a5623db46b22 Fixes: QTBUG-70957 Reviewed-by: Tim Jenssen Reviewed-by: Thomas Hartmann Reviewed-by: Laszlo Agocs --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 7c24bbaadd..9415908383 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,7 @@ private slots: void cleanup(); void testBlockingWindowShownAfterModalDialog(); void generatedMouseMove(); + void keepPendingUpdateRequests(); private: QPoint m_availableTopLeft; @@ -2451,6 +2453,27 @@ void tst_QWindow::generatedMouseMove() QVERIFY(w.mouseMovedCount == 5); } +void tst_QWindow::keepPendingUpdateRequests() +{ + QRect geometry(m_availableTopLeft + QPoint(80, 80), m_testWindowSize); + + Window window; + window.setGeometry(geometry); + window.show(); + QCoreApplication::processEvents(); + QTRY_VERIFY(window.isExposed()); + + window.requestUpdate(); + window.close(); + window.setVisible(true); + + QPlatformWindow *platformWindow = window.handle(); + QVERIFY(platformWindow); + + QVERIFY(platformWindow->hasPendingUpdateRequest()); + QTRY_VERIFY(!platformWindow->hasPendingUpdateRequest()); +} + #include QTEST_MAIN(tst_QWindow) -- cgit v1.2.3 From aa633ff276e593af227d7c4a84db230382185490 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 15 Oct 2018 20:08:47 +0300 Subject: QMetaEnum: fix UB Check ptr before usage. Change-Id: Iac757a2e260b237d837318932cc0b5896c6e04c2 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp index bb111a9137..6ed0a6caa9 100644 --- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp +++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp @@ -46,6 +46,7 @@ private slots: void fromType(); void valuesToKeys_data(); void valuesToKeys(); + void defaultConstructed(); }; void tst_QMetaEnum::fromType() @@ -99,6 +100,15 @@ void tst_QMetaEnum::valuesToKeys() QCOMPARE(me.valueToKeys(windowFlags), expected); } +void tst_QMetaEnum::defaultConstructed() +{ + QMetaEnum e; + QVERIFY(!e.isValid()); + QVERIFY(!e.isScoped()); + QVERIFY(!e.isFlag()); + QCOMPARE(e.name(), QByteArray()); +} + Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper::Value); Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper::Value); Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper::Value); -- cgit v1.2.3 From 16ebc78ef3280bf284da9a49bdd3fc1fabad347f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 16 Oct 2018 12:48:22 +0200 Subject: Fix odd test in tst_qflags This test triggered a compiler warning for good reason, it made no sense, trying to change it to what it was probably meant to be. Change-Id: I01a848272b42dae2aaa58a4f5bed998644d864da Reviewed-by: Friedemann Kleint --- tests/auto/corelib/global/qflags/tst_qflags.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index 6129184738..72b086350e 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -121,7 +121,7 @@ void tst_QFlags::constExpr() QVERIFY(verifyConstExpr(Qt::RightButton)); QVERIFY(verifyConstExpr(0xff)); - QVERIFY(!verifyConstExpr(!Qt::MouseButtons(Qt::LeftButton))); + QVERIFY(!verifyConstExpr(~Qt::MouseButtons(Qt::LeftButton))); #if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 QVERIFY(verifyConstExpr(Qt::MiddleButton)); -- cgit v1.2.3 From c18a91b0dc5e82c0624758a6300f561e36b968fc Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 16 Sep 2018 21:45:55 +0200 Subject: QTableWidget: fix cellChanged signal emitted by takeItem() QTableWidget::takeItem() emitted cellChanged with row and column set to -1. The internal functions searched for item after it was reset to nullptr and therefore it was not found. Since the modified cell is known because it's passed to the takeItem function, the correct row/column can be retrieved from there. Task-number: QTBUG-70478 Change-Id: I5ff5991c49f3200efe95fde4c7d0d28e19be7ebf Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index 208ce27c8f..4155ff1ec6 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -362,11 +362,18 @@ void tst_QTableWidget::takeItem() for (int c = 0; c < testWidget->columnCount(); ++c) QCOMPARE(testWidget->item(r, c)->text(), QString::number(r * c + c)); + QSignalSpy spy(testWidget, &QTableWidget::cellChanged); QTableWidgetItem *item = testWidget->takeItem(row, column); QCOMPARE(!!item, expectItem); if (expectItem) { QCOMPARE(item->text(), QString::number(row * column + column)); delete item; + + QTRY_COMPARE(spy.count(), 1); + const QList arguments = spy.takeFirst(); + QCOMPARE(arguments.size(), 2); + QCOMPARE(arguments.at(0).toInt(), row); + QCOMPARE(arguments.at(1).toInt(), column); } QVERIFY(!testWidget->takeItem(row, column)); } -- cgit v1.2.3 From cea2b5510c28d1057018007d65589fecee62b0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Fri, 19 Oct 2018 12:39:12 +0200 Subject: Fix building tests with -no-gui Change-Id: I37307080e5adc334fcfcdd2fee650d675228a746 Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/itemmodels/itemmodels.pro | 4 ++-- tests/auto/other/other.pro | 4 ++-- tests/auto/testlib/selftests/selftests.pri | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro index bcb6e604f8..cca350ad43 100644 --- a/tests/auto/corelib/itemmodels/itemmodels.pro +++ b/tests/auto/corelib/itemmodels/itemmodels.pro @@ -1,9 +1,9 @@ TEMPLATE=subdirs -SUBDIRS = qabstractitemmodel \ - qstringlistmodel \ +SUBDIRS = qstringlistmodel qtHaveModule(gui): SUBDIRS += \ + qabstractitemmodel \ qabstractproxymodel \ qidentityproxymodel \ qitemselectionmodel \ diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 61a464356c..d70c895dec 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -48,9 +48,9 @@ cross_compile: SUBDIRS -= \ atwrapper \ compiler -winrt|!qtConfig(accessibility): SUBDIRS -= qaccessibility +winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility -!qtConfig(accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux +!qtHaveModule(gui)|!qtConfig(accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux !qtConfig(process): SUBDIRS -= qprocess_and_guieventloop diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri index 498d1653c0..05ed6d9905 100644 --- a/tests/auto/testlib/selftests/selftests.pri +++ b/tests/auto/testlib/selftests/selftests.pri @@ -27,10 +27,8 @@ SUBPROGRAMS = \ findtestdata \ float \ globaldata \ - keyboard \ longstring \ maxwarnings \ - mouse \ multiexec \ pairdiagnostics \ printdatatags \ @@ -52,5 +50,9 @@ SUBPROGRAMS = \ warnings \ xunit +qtHaveModule(gui): SUBPROGRAMS += \ + keyboard \ + mouse + INCLUDEPATH += ../../../../shared/ HEADERS += ../../../../shared/emulationdetector.h -- cgit v1.2.3 From 1c614d07fbb3ec190b7ed3fc5eb24a200f282c0f Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 18 Oct 2018 15:58:24 +0200 Subject: tst_QAccessibilityLinux make state checking more convenient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I96274ab0a0f5d942746de0166df47936e2390c65 Reviewed-by: Jan Arve Sæther --- .../tst_qaccessibilitylinux.cpp | 45 ++++++++++++---------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp index 2575f22309..0472a78729 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -211,6 +211,27 @@ void tst_QAccessibilityLinux::registerDbus() mainWindow = getInterface(window, "org.a11y.atspi.Accessible"); } +quint64 getAtspiState(QDBusInterface *interface) +{ + QDBusMessage msg = interface->call(QDBus::Block, "GetState"); + const QDBusArgument arg = msg.arguments().at(0).value(); + quint32 state1 = 0; + quint64 state2 = 0; + arg.beginArray(); + arg >> state1; + arg >> state2; + arg.endArray(); + + state2 = state2 << 32; + return state2 | state1; +} + +bool hasState(QDBusInterface *interface, AtspiStateType state) +{ + quint64 intState = quint64(1) << state; + return getAtspiState(interface) & intState; +} + #define ROOTPATH "/org/a11y/atspi/accessible" void tst_QAccessibilityLinux::testLabel() @@ -471,21 +492,6 @@ void tst_QAccessibilityLinux::testSlider() m_window->clearChildren(); } -quint64 getAtspiState(QDBusInterface *interface) -{ - QDBusMessage msg = interface->call(QDBus::Block, "GetState"); - const QDBusArgument arg = msg.arguments().at(0).value(); - quint32 state1 = 0; - quint64 state2 = 0; - arg.beginArray(); - arg >> state1; - arg >> state2; - arg.endArray(); - - state2 = state2 << 32; - return state2 | state1; -} - void tst_QAccessibilityLinux::testFocus() { QLineEdit *lineEdit1 = new QLineEdit(m_window); @@ -508,15 +514,14 @@ void tst_QAccessibilityLinux::testFocus() QDBusInterface *componentInterfaceLineEdit2 = getInterface(children.at(1), "org.a11y.atspi.Component"); QVERIFY(componentInterfaceLineEdit2->isValid()); - quint64 focusedState = quint64(1) << ATSPI_STATE_FOCUSED; - QVERIFY(getAtspiState(accessibleInterfaceLineEdit1) & focusedState); - QVERIFY(!(getAtspiState(accessibleInterfaceLineEdit2) & focusedState)); + QVERIFY(hasState(accessibleInterfaceLineEdit1, ATSPI_STATE_FOCUSED)); + QVERIFY(!hasState(accessibleInterfaceLineEdit2, ATSPI_STATE_FOCUSED)); QDBusMessage focusReply = componentInterfaceLineEdit2->call(QDBus::Block, "GrabFocus"); QVERIFY(focusReply.arguments().at(0).toBool()); QVERIFY(lineEdit2->hasFocus()); - QVERIFY(!(getAtspiState(accessibleInterfaceLineEdit1) & focusedState)); - QVERIFY(getAtspiState(accessibleInterfaceLineEdit2) & focusedState); + QVERIFY(!hasState(accessibleInterfaceLineEdit1, ATSPI_STATE_FOCUSED)); + QVERIFY(hasState(accessibleInterfaceLineEdit2, ATSPI_STATE_FOCUSED)); m_window->clearChildren(); delete accessibleInterfaceLineEdit1; delete accessibleInterfaceLineEdit2; -- cgit v1.2.3 From a87f85dbf9bd1ea90936bd9a4609229edb15c264 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 18 Oct 2018 16:02:19 +0200 Subject: Linux Accessibility: Fix expandable state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The state was forgotten from the translation layer, this is important for tree views. Fixes: QTBUG-71223 Change-Id: Ief4004fe455889f9d5a7eb018bf34d37c36a6bd9 Reviewed-by: Jan Arve Sæther --- tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp index 0472a78729..47d24ce171 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -374,13 +374,21 @@ void tst_QAccessibilityLinux::testTreeWidget() QDBusInterface *cell3 = getInterface(tableChildren.at(2), "org.a11y.atspi.Accessible"); QCOMPARE(cell3->property("Name").toString(), QLatin1String("0.0")); + QVERIFY(!hasState(cell3, ATSPI_STATE_EXPANDABLE)); + QVERIFY(!hasState(cell3, ATSPI_STATE_EXPANDED)); QDBusInterface *cell4 = getInterface(tableChildren.at(3), "org.a11y.atspi.Accessible"); QCOMPARE(cell4->property("Name").toString(), QLatin1String("0.1")); + QDBusInterface *dbus_top2 = getInterface(tableChildren.at(4), "org.a11y.atspi.Accessible"); + QCOMPARE(dbus_top2->property("Name").toString(), QLatin1String("1.0")); + QVERIFY(hasState(dbus_top2, ATSPI_STATE_EXPANDABLE)); + QVERIFY(!hasState(dbus_top2, ATSPI_STATE_EXPANDED)); + tree->expandItem(top2); tableChildren = getChildren(treeIface); QCOMPARE(tableChildren.size(), 8); + QVERIFY(hasState(dbus_top2, ATSPI_STATE_EXPANDED)); QDBusInterface *cell5 = getInterface(tableChildren.at(6), "org.a11y.atspi.Accessible"); QCOMPARE(cell5->property("Name").toString(), QLatin1String("1.0 0.0")); -- cgit v1.2.3