[autotests] Extend StrutsTests for setup on mobile
This testcase tries to emulate the panel setup on the phone, - Window placement strategy is set to maximizing - Top panel with height of 60 - Bottom panel with height of 150 However this is still not complete testcase, some todo items: - Create Plasmashell desktop window before creating panels - Create normal window and verify if its placement/position is right Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>icc-effect-5.14.5
parent
1a779ccd88
commit
a69b47f7b7
|
@ -60,6 +60,7 @@ private Q_SLOTS:
|
|||
void testWaylandStruts_data();
|
||||
void testWaylandStruts();
|
||||
void testMoveWaylandPanel();
|
||||
void testWaylandMobilePanel();
|
||||
void testX11Struts_data();
|
||||
void testX11Struts();
|
||||
void test363804();
|
||||
|
@ -349,6 +350,85 @@ void StrutsTest::testMoveWaylandPanel()
|
|||
QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1000));
|
||||
}
|
||||
|
||||
void StrutsTest::testWaylandMobilePanel()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
|
||||
//First enable maxmizing policy
|
||||
KConfigGroup group = kwinApp()->config()->group("Windows");
|
||||
group.writeEntry("Placement", "Maximizing");
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
// create first top panel
|
||||
const QRect windowGeometry(0, 0, 1280, 60);
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
Q_UNUSED(shellSurface)
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
|
||||
plasmaSurface->setPosition(windowGeometry.topLeft());
|
||||
plasmaSurface->setRole(PlasmaShellSurface::Role::Panel);
|
||||
|
||||
QSignalSpy windowCreatedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
|
||||
// map the first panel
|
||||
QImage img(windowGeometry.size(), QImage::Format_RGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), windowGeometry.size()));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
QCOMPARE(windowCreatedSpy.count(), 1);
|
||||
|
||||
auto c = windowCreatedSpy.first().first().value<ShellClient*>();
|
||||
QVERIFY(c);
|
||||
QVERIFY(!c->isActive());
|
||||
QCOMPARE(c->geometry(), windowGeometry);
|
||||
QVERIFY(c->isDock());
|
||||
QVERIFY(c->hasStrut());
|
||||
windowCreatedSpy.clear();
|
||||
|
||||
QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 60, 1280, 964));
|
||||
QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 60, 1280, 964));
|
||||
QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024));
|
||||
QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024));
|
||||
QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 964));
|
||||
|
||||
// create another bottom panel
|
||||
const QRect windowGeometry2(0, 874, 1280, 150);
|
||||
QScopedPointer<Surface> surface2(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface2(m_shell->createSurface(surface2.data()));
|
||||
Q_UNUSED(shellSurface2)
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data()));
|
||||
plasmaSurface2->setPosition(windowGeometry2.topLeft());
|
||||
plasmaSurface2->setRole(PlasmaShellSurface::Role::Panel);
|
||||
|
||||
QImage img2(windowGeometry2.size(), QImage::Format_RGB32);
|
||||
img2.fill(Qt::blue);
|
||||
surface2->attachBuffer(m_shm->createBuffer(img2));
|
||||
surface2->damage(QRect(QPoint(0, 0), windowGeometry2.size()));
|
||||
surface2->commit(Surface::CommitFlag::None);
|
||||
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
QCOMPARE(windowCreatedSpy.count(), 1);
|
||||
|
||||
auto c1 = windowCreatedSpy.first().first().value<ShellClient*>();
|
||||
QVERIFY(c1);
|
||||
QVERIFY(!c1->isActive());
|
||||
QCOMPARE(c1->geometry(), windowGeometry2);
|
||||
QVERIFY(c1->isDock());
|
||||
QVERIFY(c1->hasStrut());
|
||||
windowCreatedSpy.clear();
|
||||
|
||||
QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 60, 1280, 814));
|
||||
QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 60, 1280, 814));
|
||||
QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024));
|
||||
QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024));
|
||||
QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 814));
|
||||
}
|
||||
|
||||
void StrutsTest::testX11Struts_data()
|
||||
{
|
||||
QTest::addColumn<QRect>("windowGeometry");
|
||||
|
|
Loading…
Reference in New Issue