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:
Johan Klokkhammer Helsing 2019-08-23 11:10:36 +02:00 committed by Paul Olav Tvete
parent 43a13f3d97
commit 464f33e5b4
5 changed files with 43 additions and 20 deletions

View File

@ -66,7 +66,7 @@ void tst_datadevicev1::initTestCase()
{
QCOMPOSITOR_TRY_VERIFY(pointer());
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());
@ -104,8 +104,11 @@ void tst_datadevicev1::pasteAscii()
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
pointer()->sendEnter(surface, {32, 32});
pointer()->sendFrame(client);
pointer()->sendButton(client, BTN_LEFT, 1);
pointer()->sendFrame(client);
pointer()->sendButton(client, BTN_LEFT, 0);
pointer()->sendFrame(client);
});
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
pointer()->sendEnter(surface, {32, 32});
pointer()->sendFrame(client);
pointer()->sendButton(client, BTN_LEFT, 1);
pointer()->sendFrame(client);
pointer()->sendButton(client, BTN_LEFT, 0);
pointer()->sendFrame(client);
});
QTRY_COMPARE(window.m_text, "face with tears of joy: 😂");
}

View File

@ -196,8 +196,11 @@ void tst_output::removePrimaryScreen()
exec([&] {
auto *surface = xdgToplevel()->surface();
pointer()->sendEnter(surface, {32, 32});
pointer()->sendFrame(client());
pointer()->sendButton(client(), BTN_LEFT, 1);
pointer()->sendFrame(client());
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

View File

@ -268,7 +268,7 @@ void tst_primaryselectionv1::initTestCase()
{
QCOMPOSITOR_TRY_VERIFY(pointer());
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());
}
@ -329,8 +329,11 @@ void tst_primaryselectionv1::pasteAscii()
device->sendSelection(offer);
pointer()->sendEnter(surface, {32, 32});
pointer()->sendFrame(client());
pointer()->sendButton(client(), BTN_MIDDLE, 1);
pointer()->sendFrame(client());
pointer()->sendButton(client(), BTN_MIDDLE, 0);
pointer()->sendFrame(client());
});
QTRY_COMPARE(window.m_formats, QStringList{"text/plain"});
QTRY_COMPARE(window.m_text, "normal ascii");
@ -372,8 +375,11 @@ void tst_primaryselectionv1::pasteUtf8()
device->sendSelection(offer);
pointer()->sendEnter(surface, {32, 32});
pointer()->sendFrame(client());
pointer()->sendButton(client(), BTN_MIDDLE, 1);
pointer()->sendFrame(client());
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_text, "face with tears of joy: 😂");
@ -428,8 +434,11 @@ void tst_primaryselectionv1::copy()
auto *surface = xdgSurface()->m_surface;
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
pointer()->sendEnter(surface, {32, 32});
pointer()->sendFrame(client());
mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 1);
pointer()->sendFrame(client());
mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 0);
pointer()->sendFrame(client());
});
QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource);
QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial));

View File

@ -236,7 +236,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat
{
Q_OBJECT
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;
void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead
void send_capabilities(uint capabilities) = delete; // Use wrapper instead

View File

@ -214,12 +214,13 @@ void tst_xdgshell::popup()
uint clickSerial = exec([=] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
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);
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
return serial;
// p->sendFrame(); //TODO: uncomment when we support seat v5
p->sendFrame(c);
});
QTRY_VERIFY(window.m_popup);
@ -298,13 +299,14 @@ void tst_xdgshell::tooltipOnPopup()
exec([=] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
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_released);
// p->sendFrame();
p->sendFrame(c);
p->sendLeave(surface);
// p->sendFrame();
p->sendFrame(c);
});
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
@ -315,11 +317,12 @@ void tst_xdgshell::tooltipOnPopup()
exec([=] {
auto *surface = xdgPopup()->surface();
auto *p = pointer();
auto *c = client();
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_released);
// p->sendFrame();
p->sendFrame(c);
});
QCOMPOSITOR_TRY_VERIFY(xdgPopup(1));
@ -380,13 +383,14 @@ void tst_xdgshell::switchPopups()
exec([=] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
p->sendEnter(surface, {100, 100});
// p->sendFrame(); //TODO: uncomment when we support seat v5
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
// p->sendFrame();
p->sendFrame(c);
p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed);
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
p->sendFrame(c);
p->sendLeave(surface);
// p->sendFrame();
p->sendFrame(c);
});
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
@ -399,11 +403,12 @@ void tst_xdgshell::switchPopups()
exec([=] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
p->sendEnter(surface, {100, 100});
// p->sendFrame();
p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
// p->sendFrame();
p->sendFrame(c);
p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed);
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
p->sendFrame(c);
});
// The client will now hide one popup and then show another