add requestToggleKeepAbove/below
Summary: client requests to toggle those states, to be used by libtaskmanager Test Plan: setting keep above from the taskbar works Reviewers: #plasma, hein, graesslin, #plasma_on_wayland Reviewed By: #plasma, hein Subscribers: graesslin, hein, plasma-devel, #frameworks Tags: #frameworks, #plasma Differential Revision: https://phabricator.kde.org/D5757
This commit is contained in:
parent
e182a2cc24
commit
7d10af91b1
2 changed files with 92 additions and 0 deletions
|
@ -592,6 +592,10 @@ void PlasmaWindowModelTest::testRequests()
|
|||
QVERIFY(resizeRequestedSpy.isValid());
|
||||
QSignalSpy virtualDesktopRequestedSpy(w, &PlasmaWindowInterface::virtualDesktopRequested);
|
||||
QVERIFY(virtualDesktopRequestedSpy.isValid());
|
||||
QSignalSpy keepAboveRequestedSpy(w, &PlasmaWindowInterface::keepAboveRequested);
|
||||
QVERIFY(keepAboveRequestedSpy.isValid());
|
||||
QSignalSpy keepBelowRequestedSpy(w, &PlasmaWindowInterface::keepBelowRequested);
|
||||
QVERIFY(keepBelowRequestedSpy.isValid());
|
||||
QSignalSpy minimizedRequestedSpy(w, &PlasmaWindowInterface::minimizedRequested);
|
||||
QVERIFY(minimizedRequestedSpy.isValid());
|
||||
QSignalSpy maximizeRequestedSpy(w, &PlasmaWindowInterface::maximizedRequested);
|
||||
|
@ -603,6 +607,8 @@ void PlasmaWindowModelTest::testRequests()
|
|||
model->requestActivate(-1);
|
||||
model->requestClose(-1);
|
||||
model->requestVirtualDesktop(-1, 1);
|
||||
model->requestToggleKeepAbove(-1);
|
||||
model->requestToggleKeepBelow(-1);
|
||||
model->requestToggleMinimized(-1);
|
||||
model->requestToggleMaximized(-1);
|
||||
model->requestActivate(1);
|
||||
|
@ -610,6 +616,8 @@ void PlasmaWindowModelTest::testRequests()
|
|||
model->requestMove(1);
|
||||
model->requestResize(1);
|
||||
model->requestVirtualDesktop(1, 1);
|
||||
model->requestToggleKeepAbove(1);
|
||||
model->requestToggleKeepBelow(1);
|
||||
model->requestToggleMinimized(1);
|
||||
model->requestToggleMaximized(1);
|
||||
model->requestToggleShaded(1);
|
||||
|
@ -682,6 +690,30 @@ void PlasmaWindowModelTest::testRequests()
|
|||
QCOMPARE(minimizedRequestedSpy.count(), 0);
|
||||
QCOMPARE(maximizeRequestedSpy.count(), 0);
|
||||
QCOMPARE(shadeRequestedSpy.count(), 0);
|
||||
// keep above
|
||||
model->requestToggleKeepAbove(0);
|
||||
QVERIFY(keepAboveRequestedSpy.wait());
|
||||
QCOMPARE(keepAboveRequestedSpy.count(), 1);
|
||||
QCOMPARE(keepAboveRequestedSpy.first().first().toBool(), true);
|
||||
QCOMPARE(activateRequestedSpy.count(), 1);
|
||||
QCOMPARE(closeRequestedSpy.count(), 1);
|
||||
QCOMPARE(moveRequestedSpy.count(), 1);
|
||||
QCOMPARE(resizeRequestedSpy.count(), 1);
|
||||
QCOMPARE(virtualDesktopRequestedSpy.count(), 1);
|
||||
QCOMPARE(maximizeRequestedSpy.count(), 0);
|
||||
QCOMPARE(shadeRequestedSpy.count(), 0);
|
||||
// keep Below
|
||||
model->requestToggleKeepBelow(0);
|
||||
QVERIFY(keepBelowRequestedSpy.wait());
|
||||
QCOMPARE(keepBelowRequestedSpy.count(), 1);
|
||||
QCOMPARE(keepBelowRequestedSpy.first().first().toBool(), true);
|
||||
QCOMPARE(activateRequestedSpy.count(), 1);
|
||||
QCOMPARE(closeRequestedSpy.count(), 1);
|
||||
QCOMPARE(moveRequestedSpy.count(), 1);
|
||||
QCOMPARE(resizeRequestedSpy.count(), 1);
|
||||
QCOMPARE(virtualDesktopRequestedSpy.count(), 1);
|
||||
QCOMPARE(maximizeRequestedSpy.count(), 0);
|
||||
QCOMPARE(shadeRequestedSpy.count(), 0);
|
||||
// minimize
|
||||
model->requestToggleMinimized(0);
|
||||
QVERIFY(minimizedRequestedSpy.wait());
|
||||
|
@ -721,6 +753,20 @@ void PlasmaWindowModelTest::testRequests()
|
|||
// the toggles can also support a different state
|
||||
QSignalSpy dataChangedSpy(model, &PlasmaWindowModel::dataChanged);
|
||||
QVERIFY(dataChangedSpy.isValid());
|
||||
// keepAbove
|
||||
w->setKeepAbove(true);
|
||||
QVERIFY(dataChangedSpy.wait());
|
||||
model->requestToggleKeepAbove(0);
|
||||
QVERIFY(keepAboveRequestedSpy.wait());
|
||||
QCOMPARE(keepAboveRequestedSpy.count(), 2);
|
||||
QCOMPARE(keepAboveRequestedSpy.last().first().toBool(), false);
|
||||
// keepBelow
|
||||
w->setKeepBelow(true);
|
||||
QVERIFY(dataChangedSpy.wait());
|
||||
model->requestToggleKeepBelow(0);
|
||||
QVERIFY(keepBelowRequestedSpy.wait());
|
||||
QCOMPARE(keepBelowRequestedSpy.count(), 2);
|
||||
QCOMPARE(keepBelowRequestedSpy.last().first().toBool(), false);
|
||||
// minimize
|
||||
w->setMinimized(true);
|
||||
QVERIFY(dataChangedSpy.wait());
|
||||
|
|
|
@ -61,6 +61,8 @@ private Q_SLOTS:
|
|||
void testRequests();
|
||||
void testRequestsBoolean_data();
|
||||
void testRequestsBoolean();
|
||||
void testKeepAbove();
|
||||
void testKeepBelow();
|
||||
void testShowingDesktop();
|
||||
void testRequestShowingDesktop_data();
|
||||
void testRequestShowingDesktop();
|
||||
|
@ -477,6 +479,50 @@ void TestWindowManagement::testRequestShowingDesktop()
|
|||
QTEST(requestSpy.first().first().value<PlasmaWindowManagementInterface::ShowingDesktopState>(), "expectedValue");
|
||||
}
|
||||
|
||||
void TestWindowManagement::testKeepAbove()
|
||||
{
|
||||
using namespace KWayland::Server;
|
||||
// this test verifies setting the keep above state
|
||||
QVERIFY(!m_window->isKeepAbove());
|
||||
QSignalSpy keepAboveChangedSpy(m_window, &KWayland::Client::PlasmaWindow::keepAboveChanged);
|
||||
QVERIFY(keepAboveChangedSpy.isValid());
|
||||
m_windowInterface->setKeepAbove(true);
|
||||
QVERIFY(keepAboveChangedSpy.wait());
|
||||
QCOMPARE(keepAboveChangedSpy.count(), 1);
|
||||
QVERIFY(m_window->isKeepAbove());
|
||||
// setting to same should not change
|
||||
m_windowInterface->setKeepAbove(true);
|
||||
QVERIFY(!keepAboveChangedSpy.wait(100));
|
||||
QCOMPARE(keepAboveChangedSpy.count(), 1);
|
||||
// setting to other state should change
|
||||
m_windowInterface->setKeepAbove(false);
|
||||
QVERIFY(keepAboveChangedSpy.wait());
|
||||
QCOMPARE(keepAboveChangedSpy.count(), 2);
|
||||
QVERIFY(!m_window->isKeepAbove());
|
||||
}
|
||||
|
||||
void TestWindowManagement::testKeepBelow()
|
||||
{
|
||||
using namespace KWayland::Server;
|
||||
// this test verifies setting the keep below state
|
||||
QVERIFY(!m_window->isKeepBelow());
|
||||
QSignalSpy keepBelowChangedSpy(m_window, &KWayland::Client::PlasmaWindow::keepBelowChanged);
|
||||
QVERIFY(keepBelowChangedSpy.isValid());
|
||||
m_windowInterface->setKeepBelow(true);
|
||||
QVERIFY(keepBelowChangedSpy.wait());
|
||||
QCOMPARE(keepBelowChangedSpy.count(), 1);
|
||||
QVERIFY(m_window->isKeepBelow());
|
||||
// setting to same should not change
|
||||
m_windowInterface->setKeepBelow(true);
|
||||
QVERIFY(!keepBelowChangedSpy.wait(100));
|
||||
QCOMPARE(keepBelowChangedSpy.count(), 1);
|
||||
// setting to other state should change
|
||||
m_windowInterface->setKeepBelow(false);
|
||||
QVERIFY(keepBelowChangedSpy.wait());
|
||||
QCOMPARE(keepBelowChangedSpy.count(), 2);
|
||||
QVERIFY(!m_window->isKeepBelow());
|
||||
}
|
||||
|
||||
void TestWindowManagement::testParentWindow()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
|
|
Loading…
Reference in a new issue