[autotest] Test case for hover move on decoration
Verifies that the cursor shapes are adjusted correctly.
This commit is contained in:
parent
749ec28e23
commit
a9f48ec62c
1 changed files with 39 additions and 0 deletions
|
@ -39,6 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -55,6 +57,7 @@ private Q_SLOTS:
|
|||
void cleanup();
|
||||
void testAxis();
|
||||
void testDoubleClick();
|
||||
void testHover();
|
||||
|
||||
private:
|
||||
AbstractClient *showWindow();
|
||||
|
@ -287,6 +290,42 @@ void KWin::DecorationInputTest::testDoubleClick()
|
|||
QVERIFY(!c->isOnAllDesktops());
|
||||
}
|
||||
|
||||
void DecorationInputTest::testHover()
|
||||
{
|
||||
AbstractClient *c = showWindow();
|
||||
QVERIFY(c);
|
||||
QVERIFY(c->isDecorated());
|
||||
QVERIFY(!c->noBorder());
|
||||
|
||||
// our left border is moved out of the visible area, so move the window to a better place
|
||||
c->move(QPoint(20, 0));
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2));
|
||||
QCOMPARE(c->cursor(), Qt::ArrowCursor);
|
||||
|
||||
MOTION(QPoint(20, 0));
|
||||
QCOMPARE(c->cursor(), Qt::SizeFDiagCursor);
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() / 2, 0));
|
||||
QCOMPARE(c->cursor(), Qt::SizeVerCursor);
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() - 1, 0));
|
||||
QCOMPARE(c->cursor(), Qt::SizeBDiagCursor);
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() - 1, c->height() / 2));
|
||||
QCOMPARE(c->cursor(), Qt::SizeHorCursor);
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() - 1, c->height() - 1));
|
||||
QCOMPARE(c->cursor(), Qt::SizeFDiagCursor);
|
||||
MOTION(QPoint(c->geometry().x() + c->geometry().width() / 2, c->height() - 1));
|
||||
QCOMPARE(c->cursor(), Qt::SizeVerCursor);
|
||||
MOTION(QPoint(c->geometry().x(), c->height() - 1));
|
||||
QCOMPARE(c->cursor(), Qt::SizeBDiagCursor);
|
||||
MOTION(QPoint(c->geometry().x(), c->height() / 2));
|
||||
QCOMPARE(c->cursor(), Qt::SizeHorCursor);
|
||||
|
||||
MOTION(c->geometry().center());
|
||||
QEXPECT_FAIL("", "Cursor not set back on leave", Continue);
|
||||
QCOMPARE(c->cursor(), Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANTEST_MAIN(KWin::DecorationInputTest)
|
||||
|
|
Loading…
Reference in a new issue