autotests: test placement to always put the titlebar on the screen
CCBUG: 489500
This commit is contained in:
parent
d548ade3a6
commit
b0a8294b05
1 changed files with 34 additions and 0 deletions
|
@ -46,6 +46,8 @@ private Q_SLOTS:
|
|||
void testCascadeIfCoveringIgnoreNonCovering();
|
||||
void testCascadeIfCoveringIgnoreOutOfArea();
|
||||
void testCascadeIfCoveringIgnoreAlreadyCovered();
|
||||
void testTitlebarOnScreen_data();
|
||||
void testTitlebarOnScreen();
|
||||
|
||||
private:
|
||||
void setPlacementPolicy(PlacementPolicy policy);
|
||||
|
@ -533,5 +535,37 @@ void TestPlacement::testCascadeIfCoveringIgnoreAlreadyCovered()
|
|||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
}
|
||||
|
||||
void TestPlacement::testTitlebarOnScreen_data()
|
||||
{
|
||||
QTest::addColumn<PlacementPolicy>("placementMode");
|
||||
QTest::addRow("PlacementRandom") << PlacementPolicy::PlacementRandom;
|
||||
QTest::addRow("PlacementSmart") << PlacementPolicy::PlacementSmart;
|
||||
QTest::addRow("PlacementCentered") << PlacementPolicy::PlacementCentered;
|
||||
QTest::addRow("PlacementZeroCornered") << PlacementPolicy::PlacementZeroCornered;
|
||||
QTest::addRow("PlacementUnderMouse") << PlacementPolicy::PlacementUnderMouse;
|
||||
QTest::addRow("PlacementMaximizing") << PlacementPolicy::PlacementMaximizing;
|
||||
}
|
||||
|
||||
void TestPlacement::testTitlebarOnScreen()
|
||||
{
|
||||
// this test verifies that windows that are bigger than the screen
|
||||
// still get placed with their title bar on the screen
|
||||
|
||||
QFETCH(PlacementPolicy, placementMode);
|
||||
setPlacementPolicy(PlacementPolicy(placementMode));
|
||||
|
||||
KWin::input()->pointer()->warp(QPoint(200, 0));
|
||||
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), QPoint(200, 0));
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, workspace()->outputs().front()->geometry().height() + 100), Qt::red);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->frameGeometry().y(), 0);
|
||||
|
||||
shellSurface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestPlacement)
|
||||
#include "placement_test.moc"
|
||||
|
|
Loading…
Reference in a new issue