Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/decoration_input_test.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | 44 | | |||
45 | #include <linux/input.h> | 45 | #include <linux/input.h> | ||
46 | 46 | | |||
47 | Q_DECLARE_METATYPE(Qt::WindowFrameSection) | 47 | Q_DECLARE_METATYPE(Qt::WindowFrameSection) | ||
48 | 48 | | |||
49 | namespace KWin | 49 | namespace KWin | ||
50 | { | 50 | { | ||
51 | 51 | | |||
52 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_decoration_input-0"); | 52 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_decoration_input-1"); | ||
53 | 53 | | |||
54 | class DecorationInputTest : public QObject | 54 | class DecorationInputTest : public QObject | ||
55 | { | 55 | { | ||
56 | Q_OBJECT | 56 | Q_OBJECT | ||
57 | private Q_SLOTS: | 57 | private Q_SLOTS: | ||
58 | void initTestCase(); | 58 | void initTestCase(); | ||
59 | void init(); | 59 | void init(); | ||
60 | void cleanup(); | 60 | void cleanup(); | ||
61 | void testAxis_data(); | 61 | void testAxis_data(); | ||
62 | void testAxis(); | 62 | void testAxis(); | ||
63 | void testDoubleClick_data(); | 63 | void testDoubleClick_data(); | ||
64 | void testDoubleClick(); | 64 | void testDoubleClick(); | ||
65 | void testDoubleTap_data(); | 65 | void testDoubleTap_data(); | ||
66 | void testDoubleTap(); | 66 | void testDoubleTap(); | ||
67 | void testHover_data(); | 67 | void testHover_data(); | ||
68 | void testHover(); | 68 | void testHover(); | ||
69 | void testPressToMove_data(); | 69 | void testPressToMove_data(); | ||
70 | void testPressToMove(); | 70 | void testPressToMove(); | ||
71 | void testTapToMove_data(); | 71 | void testTapToMove_data(); | ||
72 | void testTapToMove(); | 72 | void testTapToMove(); | ||
73 | void testResizeOutsideWindow_data(); | ||||
74 | void testResizeOutsideWindow(); | ||||
73 | 75 | | |||
74 | private: | 76 | private: | ||
75 | AbstractClient *showWindow(Test::ShellSurfaceType type); | 77 | AbstractClient *showWindow(Test::ShellSurfaceType type); | ||
76 | }; | 78 | }; | ||
77 | 79 | | |||
78 | #define MOTION(target) \ | 80 | #define MOTION(target) \ | ||
79 | kwinApp()->platform()->pointerMotion(target, timestamp++) | 81 | kwinApp()->platform()->pointerMotion(target, timestamp++) | ||
80 | 82 | | |||
▲ Show 20 Lines • Show All 412 Lines • ▼ Show 20 Line(s) | 455 | { | |||
493 | 495 | | |||
494 | kwinApp()->platform()->touchUp(1, timestamp++); | 496 | kwinApp()->platform()->touchUp(1, timestamp++); | ||
495 | QTRY_VERIFY(!c->isMove()); | 497 | QTRY_VERIFY(!c->isMove()); | ||
496 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2); | 498 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2); | ||
497 | // TODO: the offset should also be included | 499 | // TODO: the offset should also be included | ||
498 | QCOMPARE(c->pos(), oldPos + offset2 + offset3); | 500 | QCOMPARE(c->pos(), oldPos + offset2 + offset3); | ||
499 | } | 501 | } | ||
500 | 502 | | |||
503 | void DecorationInputTest::testResizeOutsideWindow_data() | ||||
504 | { | ||||
505 | QTest::addColumn<Test::ShellSurfaceType>("type"); | ||||
506 | QTest::addColumn<Qt::Edge>("edge"); | ||||
507 | QTest::addColumn<Qt::CursorShape>("expectedCursor"); | ||||
508 | | ||||
509 | QTest::newRow("wlShell - left") << Test::ShellSurfaceType::WlShell << Qt::LeftEdge << Qt::SizeHorCursor; | ||||
510 | QTest::newRow("xdgShellV5 - left") << Test::ShellSurfaceType::XdgShellV5 << Qt::LeftEdge << Qt::SizeHorCursor; | ||||
511 | QTest::newRow("wlShell - right") << Test::ShellSurfaceType::WlShell << Qt::RightEdge << Qt::SizeHorCursor; | ||||
512 | QTest::newRow("xdgShellV5 - right") << Test::ShellSurfaceType::XdgShellV5 << Qt::RightEdge << Qt::SizeHorCursor; | ||||
513 | QTest::newRow("wlShell - bottom") << Test::ShellSurfaceType::WlShell << Qt::BottomEdge << Qt::SizeVerCursor; | ||||
514 | QTest::newRow("xdgShellV5 - bottom") << Test::ShellSurfaceType::XdgShellV5 << Qt::BottomEdge << Qt::SizeVerCursor; | ||||
sebas: Top edge? Also, what about the corners? | |||||
Top edge doesn't support this in breeze. That's why it's not set. The idea is to provide resize borders if there is no border at all. But the top still has the window title and buttons, so there is a resize area already. Corner I didn't include as it would make the test way more complicated (would need to pass flags around and then calculate the positions) while we don't gain much for it. What's important is that the areas are properly handled and that's tested. graesslin: Top edge doesn't support this in breeze. That's why it's not set. The idea is to provide resize… | |||||
515 | } | ||||
516 | | ||||
517 | void DecorationInputTest::testResizeOutsideWindow() | ||||
518 | { | ||||
519 | // this test verifies that one can resize the window outside the decoration with NoSideBorder | ||||
520 | | ||||
521 | // first adjust config | ||||
522 | kwinApp()->config()->group("org.kde.kdecoration2").writeEntry("BorderSize", QStringLiteral("None")); | ||||
I don't see any call to QStandardPaths::setTestModeEnabled(...), are you overwriting the user's config here? http://doc.qt.io/qt-5/qstandardpaths.html#setTestModeEnabled sebas: I don't see any call to QStandardPaths::setTestModeEnabled(...), are you overwriting the user's… | |||||
graesslin: Please see line 132ff. We are using an in-memory KConfigPtr. | |||||
523 | kwinApp()->config()->sync(); | ||||
524 | workspace()->slotReconfigure(); | ||||
525 | | ||||
526 | // now create window | ||||
527 | QFETCH(Test::ShellSurfaceType, type); | ||||
528 | AbstractClient *c = showWindow(type); | ||||
529 | QVERIFY(c); | ||||
530 | QVERIFY(c->isDecorated()); | ||||
531 | QVERIFY(!c->noBorder()); | ||||
532 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | ||||
533 | QVERIFY(c->geometry() != c->inputGeometry()); | ||||
534 | QVERIFY(c->inputGeometry().contains(c->geometry())); | ||||
535 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | ||||
536 | QVERIFY(startMoveResizedSpy.isValid()); | ||||
537 | | ||||
538 | // go to border | ||||
539 | quint32 timestamp = 1; | ||||
540 | QFETCH(Qt::Edge, edge); | ||||
541 | switch (edge) { | ||||
542 | case Qt::LeftEdge: | ||||
543 | MOTION(QPoint(c->geometry().x() -1, c->geometry().center().y())); | ||||
544 | break; | ||||
545 | case Qt::RightEdge: | ||||
546 | MOTION(QPoint(c->geometry().x() + c->geometry().width() +1, c->geometry().center().y())); | ||||
547 | break; | ||||
548 | case Qt::BottomEdge: | ||||
549 | MOTION(QPoint(c->geometry().center().x(), c->geometry().y() + c->geometry().height() + 1)); | ||||
550 | break; | ||||
551 | default: | ||||
sebas: TopEdge missing? | |||||
graesslin: See above. It's not supported for TopEdge. | |||||
552 | break; | ||||
553 | } | ||||
554 | QVERIFY(!c->geometry().contains(KWin::Cursor::pos())); | ||||
555 | | ||||
556 | // pressing should trigger resize | ||||
557 | PRESS; | ||||
558 | QVERIFY(!c->isResize()); | ||||
559 | QVERIFY(startMoveResizedSpy.wait()); | ||||
560 | QVERIFY(c->isResize()); | ||||
561 | | ||||
562 | RELEASE; | ||||
563 | QVERIFY(!c->isResize()); | ||||
564 | } | ||||
565 | | ||||
501 | } | 566 | } | ||
502 | 567 | | |||
503 | WAYLANDTEST_MAIN(KWin::DecorationInputTest) | 568 | WAYLANDTEST_MAIN(KWin::DecorationInputTest) | ||
504 | #include "decoration_input_test.moc" | 569 | #include "decoration_input_test.moc" |
Top edge? Also, what about the corners?