From decfb64ada6670984f61b79877897fe27514e9a8 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 28 Oct 2020 13:57:20 +0200 Subject: [PATCH] autotests: Fix TestDragAndDrop Currently, most of tests in TestDragAndDrop should fail because they don't specify accepted mime type. --- src/wayland/autotests/client/test_drag_drop.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wayland/autotests/client/test_drag_drop.cpp b/src/wayland/autotests/client/test_drag_drop.cpp index 384cac7162..ef509f9a5e 100644 --- a/src/wayland/autotests/client/test_drag_drop.cpp +++ b/src/wayland/autotests/client/test_drag_drop.cpp @@ -245,6 +245,7 @@ void TestDragAndDrop::testPointerDragAndDrop() QCOMPARE(m_dataDevice->dragOffer()->offeredMimeTypes().count(), 1); QCOMPARE(m_dataDevice->dragOffer()->offeredMimeTypes().first().name(), QStringLiteral("text/plain")); QTRY_COMPARE(offer->sourceDragAndDropActions(), DataDeviceManager::DnDAction::Copy | DataDeviceManager::DnDAction::Move); + offer->accept(QStringLiteral("text/plain"), dragEnteredSpy.last().at(0).toUInt()); offer->setDragAndDropActions(DataDeviceManager::DnDAction::Copy | DataDeviceManager::DnDAction::Move, DataDeviceManager::DnDAction::Move); QVERIFY(offerActionChangedSpy.wait()); QCOMPARE(offerActionChangedSpy.count(), 1); @@ -344,6 +345,7 @@ void TestDragAndDrop::testTouchDragAndDrop() QCOMPARE(m_dataDevice->dragOffer()->offeredMimeTypes().count(), 1); QCOMPARE(m_dataDevice->dragOffer()->offeredMimeTypes().first().name(), QStringLiteral("text/plain")); QTRY_COMPARE(offer->sourceDragAndDropActions(), DataDeviceManager::DnDAction::Copy | DataDeviceManager::DnDAction::Move); + offer->accept(QStringLiteral("text/plain"), dragEnteredSpy.last().at(0).toUInt()); offer->setDragAndDropActions(DataDeviceManager::DnDAction::Copy | DataDeviceManager::DnDAction::Move, DataDeviceManager::DnDAction::Move); QVERIFY(offerActionChangedSpy.wait()); QCOMPARE(offerActionChangedSpy.count(), 1); @@ -438,6 +440,7 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource() QCOMPARE(m_dataDevice->dragOffer()->offeredMimeTypes().count(), 1); QCOMPARE(m_dataDevice->dragOffer()->offeredMimeTypes().first().name(), QStringLiteral("text/plain")); QTRY_COMPARE(offer->sourceDragAndDropActions(), DataDeviceManager::DnDAction::Copy | DataDeviceManager::DnDAction::Move); + offer->accept(QStringLiteral("text/plain"), dragEnteredSpy.last().at(0).toUInt()); offer->setDragAndDropActions(DataDeviceManager::DnDAction::Copy | DataDeviceManager::DnDAction::Move, DataDeviceManager::DnDAction::Move); QVERIFY(offerActionChangedSpy.wait()); QCOMPARE(offerActionChangedSpy.count(), 1); @@ -541,11 +544,11 @@ void TestDragAndDrop::testPointerEventsIgnored() m_seatInterface->setPointerPos(QPointF(50, 50)); // last but not least, simulate the drop - QSignalSpy droppedSpy(m_dataDevice, &DataDevice::dropped); - QVERIFY(droppedSpy.isValid()); + QSignalSpy cancelledSpy(m_dataSource, &DataSource::cancelled); + QVERIFY(cancelledSpy.isValid()); m_seatInterface->setTimestamp(timestamp++); m_seatInterface->pointerButtonReleased(1); - QVERIFY(droppedSpy.wait()); + QVERIFY(cancelledSpy.wait()); // all the changes should have been ignored QCOMPARE(axisSpy.count(), 1);