From 2417faff4da5a00c1ef1446ea1e9e93252cfec1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 15 Jun 2016 09:33:10 +0200 Subject: [PATCH] [autotests] Extend TestDataDevice for unbound check in createDataOffer Extends the test case for checking that the nullptr check is taken when trying to send a selection on an already unbound DataDevice. --- src/wayland/autotests/client/test_datadevice.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wayland/autotests/client/test_datadevice.cpp b/src/wayland/autotests/client/test_datadevice.cpp index e9971b1f33..0fef6f96f9 100644 --- a/src/wayland/autotests/client/test_datadevice.cpp +++ b/src/wayland/autotests/client/test_datadevice.cpp @@ -380,6 +380,17 @@ void TestDataDevice::testSetSelection() QCOMPARE(selectionChangedSpy.count(), 1); QCOMPARE(selectionClearedSpy.count(), 1); QVERIFY(!deviceInterface->selection()); + + // set another selection + dataDevice->setSelection(2, dataSource.data()); + QVERIFY(selectionChangedSpy.wait()); + // now unbind the dataDevice + QSignalSpy unboundSpy(deviceInterface, &DataDeviceInterface::unbound); + QVERIFY(unboundSpy.isValid()); + dataDevice.reset(); + QVERIFY(unboundSpy.wait()); + // send a selection to the unbound data device + deviceInterface->sendSelection(deviceInterface); } void TestDataDevice::testSendSelectionOnSeat()