Client: Add test for starting a drag operation without input focus
This used to crash the client. Task-number: QTBUG-76368 Change-Id: I855f3bda15b4b2bccbdb2aa8239e26c0eecf7cb3 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
0816fda053
commit
3b34e5f86d
@ -30,9 +30,8 @@
|
|||||||
|
|
||||||
#include <QtGui/QRasterWindow>
|
#include <QtGui/QRasterWindow>
|
||||||
#include <QtGui/QOpenGLWindow>
|
#include <QtGui/QOpenGLWindow>
|
||||||
|
|
||||||
//TODO: move?
|
|
||||||
#include <QtGui/QClipboard>
|
#include <QtGui/QClipboard>
|
||||||
|
#include <QtGui/QDrag>
|
||||||
|
|
||||||
using namespace MockCompositor;
|
using namespace MockCompositor;
|
||||||
|
|
||||||
@ -60,6 +59,7 @@ private slots:
|
|||||||
void pasteUtf8();
|
void pasteUtf8();
|
||||||
void destroysPreviousSelection();
|
void destroysPreviousSelection();
|
||||||
void destroysSelectionWithSurface();
|
void destroysSelectionWithSurface();
|
||||||
|
void dragWithoutFocus();
|
||||||
};
|
};
|
||||||
|
|
||||||
void tst_datadevicev1::initTestCase()
|
void tst_datadevicev1::initTestCase()
|
||||||
@ -209,5 +209,22 @@ void tst_datadevicev1::destroysSelectionWithSurface()
|
|||||||
QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0);
|
QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The application should not crash if it attempts to start a drag operation
|
||||||
|
// when it doesn't have input focus (QTBUG-76368)
|
||||||
|
void tst_datadevicev1::dragWithoutFocus()
|
||||||
|
{
|
||||||
|
QRasterWindow window;
|
||||||
|
window.resize(64, 64);
|
||||||
|
window.show();
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
|
||||||
|
|
||||||
|
auto *mimeData = new QMimeData;
|
||||||
|
const QByteArray data("testData");
|
||||||
|
mimeData->setData("text/plain", data);
|
||||||
|
QDrag drag(&window);
|
||||||
|
drag.setMimeData(mimeData);
|
||||||
|
drag.exec();
|
||||||
|
}
|
||||||
|
|
||||||
QCOMPOSITOR_TEST_MAIN(tst_datadevicev1)
|
QCOMPOSITOR_TEST_MAIN(tst_datadevicev1)
|
||||||
#include "tst_datadevicev1.moc"
|
#include "tst_datadevicev1.moc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user