Client tests: Upgrade tests to wl_seat v5
This means that pointer events need to be followed by frame events. wl_seat version 4 is tested by the "tst_seatv4" autotest. Change-Id: Ifa8e6d6edc998853be7cd901003e619029fc6f68 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
43a13f3d97
commit
464f33e5b4
@ -66,7 +66,7 @@ void tst_datadevicev1::initTestCase()
|
|||||||
{
|
{
|
||||||
QCOMPOSITOR_TRY_VERIFY(pointer());
|
QCOMPOSITOR_TRY_VERIFY(pointer());
|
||||||
QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty());
|
QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty());
|
||||||
QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4);
|
QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5);
|
||||||
|
|
||||||
QCOMPOSITOR_TRY_VERIFY(keyboard());
|
QCOMPOSITOR_TRY_VERIFY(keyboard());
|
||||||
|
|
||||||
@ -104,8 +104,11 @@ void tst_datadevicev1::pasteAscii()
|
|||||||
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
|
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
|
||||||
|
|
||||||
pointer()->sendEnter(surface, {32, 32});
|
pointer()->sendEnter(surface, {32, 32});
|
||||||
|
pointer()->sendFrame(client);
|
||||||
pointer()->sendButton(client, BTN_LEFT, 1);
|
pointer()->sendButton(client, BTN_LEFT, 1);
|
||||||
|
pointer()->sendFrame(client);
|
||||||
pointer()->sendButton(client, BTN_LEFT, 0);
|
pointer()->sendButton(client, BTN_LEFT, 0);
|
||||||
|
pointer()->sendFrame(client);
|
||||||
});
|
});
|
||||||
QTRY_COMPARE(window.m_text, "normal ascii");
|
QTRY_COMPARE(window.m_text, "normal ascii");
|
||||||
}
|
}
|
||||||
@ -139,8 +142,11 @@ void tst_datadevicev1::pasteUtf8()
|
|||||||
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
|
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
|
||||||
|
|
||||||
pointer()->sendEnter(surface, {32, 32});
|
pointer()->sendEnter(surface, {32, 32});
|
||||||
|
pointer()->sendFrame(client);
|
||||||
pointer()->sendButton(client, BTN_LEFT, 1);
|
pointer()->sendButton(client, BTN_LEFT, 1);
|
||||||
|
pointer()->sendFrame(client);
|
||||||
pointer()->sendButton(client, BTN_LEFT, 0);
|
pointer()->sendButton(client, BTN_LEFT, 0);
|
||||||
|
pointer()->sendFrame(client);
|
||||||
});
|
});
|
||||||
QTRY_COMPARE(window.m_text, "face with tears of joy: 😂");
|
QTRY_COMPARE(window.m_text, "face with tears of joy: 😂");
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,11 @@ void tst_output::removePrimaryScreen()
|
|||||||
exec([&] {
|
exec([&] {
|
||||||
auto *surface = xdgToplevel()->surface();
|
auto *surface = xdgToplevel()->surface();
|
||||||
pointer()->sendEnter(surface, {32, 32});
|
pointer()->sendEnter(surface, {32, 32});
|
||||||
|
pointer()->sendFrame(client());
|
||||||
pointer()->sendButton(client(), BTN_LEFT, 1);
|
pointer()->sendButton(client(), BTN_LEFT, 1);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
pointer()->sendButton(client(), BTN_LEFT, 0);
|
pointer()->sendButton(client(), BTN_LEFT, 0);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait to make sure mouse events dont't cause a crash now that the screen has changed
|
// Wait to make sure mouse events dont't cause a crash now that the screen has changed
|
||||||
|
@ -268,7 +268,7 @@ void tst_primaryselectionv1::initTestCase()
|
|||||||
{
|
{
|
||||||
QCOMPOSITOR_TRY_VERIFY(pointer());
|
QCOMPOSITOR_TRY_VERIFY(pointer());
|
||||||
QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty());
|
QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty());
|
||||||
QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4);
|
QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5);
|
||||||
|
|
||||||
QCOMPOSITOR_TRY_VERIFY(keyboard());
|
QCOMPOSITOR_TRY_VERIFY(keyboard());
|
||||||
}
|
}
|
||||||
@ -329,8 +329,11 @@ void tst_primaryselectionv1::pasteAscii()
|
|||||||
device->sendSelection(offer);
|
device->sendSelection(offer);
|
||||||
|
|
||||||
pointer()->sendEnter(surface, {32, 32});
|
pointer()->sendEnter(surface, {32, 32});
|
||||||
|
pointer()->sendFrame(client());
|
||||||
pointer()->sendButton(client(), BTN_MIDDLE, 1);
|
pointer()->sendButton(client(), BTN_MIDDLE, 1);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
pointer()->sendButton(client(), BTN_MIDDLE, 0);
|
pointer()->sendButton(client(), BTN_MIDDLE, 0);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
});
|
});
|
||||||
QTRY_COMPARE(window.m_formats, QStringList{"text/plain"});
|
QTRY_COMPARE(window.m_formats, QStringList{"text/plain"});
|
||||||
QTRY_COMPARE(window.m_text, "normal ascii");
|
QTRY_COMPARE(window.m_text, "normal ascii");
|
||||||
@ -372,8 +375,11 @@ void tst_primaryselectionv1::pasteUtf8()
|
|||||||
device->sendSelection(offer);
|
device->sendSelection(offer);
|
||||||
|
|
||||||
pointer()->sendEnter(surface, {32, 32});
|
pointer()->sendEnter(surface, {32, 32});
|
||||||
|
pointer()->sendFrame(client());
|
||||||
pointer()->sendButton(client(), BTN_MIDDLE, 1);
|
pointer()->sendButton(client(), BTN_MIDDLE, 1);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
pointer()->sendButton(client(), BTN_MIDDLE, 0);
|
pointer()->sendButton(client(), BTN_MIDDLE, 0);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
});
|
});
|
||||||
QTRY_COMPARE(window.m_formats, QStringList({"text/plain", "text/plain;charset=utf-8"}));
|
QTRY_COMPARE(window.m_formats, QStringList({"text/plain", "text/plain;charset=utf-8"}));
|
||||||
QTRY_COMPARE(window.m_text, "face with tears of joy: 😂");
|
QTRY_COMPARE(window.m_text, "face with tears of joy: 😂");
|
||||||
@ -428,8 +434,11 @@ void tst_primaryselectionv1::copy()
|
|||||||
auto *surface = xdgSurface()->m_surface;
|
auto *surface = xdgSurface()->m_surface;
|
||||||
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
|
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
|
||||||
pointer()->sendEnter(surface, {32, 32});
|
pointer()->sendEnter(surface, {32, 32});
|
||||||
|
pointer()->sendFrame(client());
|
||||||
mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 1);
|
mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 1);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 0);
|
mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 0);
|
||||||
|
pointer()->sendFrame(client());
|
||||||
});
|
});
|
||||||
QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource);
|
QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource);
|
||||||
QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial));
|
QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial));
|
||||||
|
@ -236,7 +236,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard, int version = 4);
|
explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard, int version = 5);
|
||||||
~Seat() override;
|
~Seat() override;
|
||||||
void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead
|
void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead
|
||||||
void send_capabilities(uint capabilities) = delete; // Use wrapper instead
|
void send_capabilities(uint capabilities) = delete; // Use wrapper instead
|
||||||
|
@ -214,12 +214,13 @@ void tst_xdgshell::popup()
|
|||||||
uint clickSerial = exec([=] {
|
uint clickSerial = exec([=] {
|
||||||
auto *surface = xdgToplevel()->surface();
|
auto *surface = xdgToplevel()->surface();
|
||||||
auto *p = pointer();
|
auto *p = pointer();
|
||||||
|
auto *c = client();
|
||||||
p->sendEnter(surface, {100, 100});
|
p->sendEnter(surface, {100, 100});
|
||||||
// p->sendFrame(); //TODO: uncomment when we support seat v5
|
p->sendFrame(c);
|
||||||
uint serial = p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
uint serial = p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
|
||||||
return serial;
|
return serial;
|
||||||
// p->sendFrame(); //TODO: uncomment when we support seat v5
|
p->sendFrame(c);
|
||||||
});
|
});
|
||||||
|
|
||||||
QTRY_VERIFY(window.m_popup);
|
QTRY_VERIFY(window.m_popup);
|
||||||
@ -298,13 +299,14 @@ void tst_xdgshell::tooltipOnPopup()
|
|||||||
exec([=] {
|
exec([=] {
|
||||||
auto *surface = xdgToplevel()->surface();
|
auto *surface = xdgToplevel()->surface();
|
||||||
auto *p = pointer();
|
auto *p = pointer();
|
||||||
|
auto *c = client();
|
||||||
p->sendEnter(surface, {100, 100});
|
p->sendEnter(surface, {100, 100});
|
||||||
// p->sendFrame(); //TODO: uncomment when we support seat v5
|
p->sendFrame(c);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
p->sendLeave(surface);
|
p->sendLeave(surface);
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
});
|
});
|
||||||
|
|
||||||
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
|
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
|
||||||
@ -315,11 +317,12 @@ void tst_xdgshell::tooltipOnPopup()
|
|||||||
exec([=] {
|
exec([=] {
|
||||||
auto *surface = xdgPopup()->surface();
|
auto *surface = xdgPopup()->surface();
|
||||||
auto *p = pointer();
|
auto *p = pointer();
|
||||||
|
auto *c = client();
|
||||||
p->sendEnter(surface, {100, 100});
|
p->sendEnter(surface, {100, 100});
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
});
|
});
|
||||||
|
|
||||||
QCOMPOSITOR_TRY_VERIFY(xdgPopup(1));
|
QCOMPOSITOR_TRY_VERIFY(xdgPopup(1));
|
||||||
@ -380,13 +383,14 @@ void tst_xdgshell::switchPopups()
|
|||||||
exec([=] {
|
exec([=] {
|
||||||
auto *surface = xdgToplevel()->surface();
|
auto *surface = xdgToplevel()->surface();
|
||||||
auto *p = pointer();
|
auto *p = pointer();
|
||||||
|
auto *c = client();
|
||||||
p->sendEnter(surface, {100, 100});
|
p->sendEnter(surface, {100, 100});
|
||||||
// p->sendFrame(); //TODO: uncomment when we support seat v5
|
p->sendFrame(c);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
p->sendLeave(surface);
|
p->sendLeave(surface);
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
});
|
});
|
||||||
|
|
||||||
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
|
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
|
||||||
@ -399,11 +403,12 @@ void tst_xdgshell::switchPopups()
|
|||||||
exec([=] {
|
exec([=] {
|
||||||
auto *surface = xdgToplevel()->surface();
|
auto *surface = xdgToplevel()->surface();
|
||||||
auto *p = pointer();
|
auto *p = pointer();
|
||||||
|
auto *c = client();
|
||||||
p->sendEnter(surface, {100, 100});
|
p->sendEnter(surface, {100, 100});
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed);
|
||||||
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
|
||||||
// p->sendFrame();
|
p->sendFrame(c);
|
||||||
});
|
});
|
||||||
|
|
||||||
// The client will now hide one popup and then show another
|
// The client will now hide one popup and then show another
|
||||||
|
Loading…
x
Reference in New Issue
Block a user