Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/idle_inhibition_test.cpp
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | |||||
74 | 74 | | |||
75 | void TestIdleInhibition::testInhibit_data() | 75 | void TestIdleInhibition::testInhibit_data() | ||
76 | { | 76 | { | ||
77 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 77 | QTest::addColumn<Test::ShellSurfaceType>("type"); | ||
78 | 78 | | |||
79 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 79 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | ||
80 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | 80 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | ||
81 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 81 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | ||
82 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | ||||
82 | } | 83 | } | ||
83 | 84 | | |||
84 | void TestIdleInhibition::testInhibit() | 85 | void TestIdleInhibition::testInhibit() | ||
85 | { | 86 | { | ||
86 | auto idle = waylandServer()->display()->findChild<IdleInterface*>(); | 87 | auto idle = waylandServer()->display()->findChild<IdleInterface*>(); | ||
87 | QVERIFY(idle); | 88 | QVERIFY(idle); | ||
88 | QVERIFY(!idle->isInhibited()); | 89 | QVERIFY(!idle->isInhibited()); | ||
89 | QSignalSpy inhibitedSpy(idle, &IdleInterface::inhibitedChanged); | 90 | QSignalSpy inhibitedSpy(idle, &IdleInterface::inhibitedChanged); | ||
90 | QVERIFY(inhibitedSpy.isValid()); | 91 | QVERIFY(inhibitedSpy.isValid()); | ||
91 | 92 | | |||
92 | // now create window | 93 | // now create window | ||
93 | QScopedPointer<Surface> surface(Test::createSurface()); | 94 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
94 | QFETCH(Test::ShellSurfaceType, type); | 95 | QFETCH(Test::ShellSurfaceType, type); | ||
95 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | 96 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | ||
96 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | | |||
97 | QVERIFY(c); | | |||
98 | | ||||
99 | // not yet inhibited | | |||
100 | QVERIFY(!idle->isInhibited()); | | |||
101 | 97 | | |||
102 | // now create inhibition on window | 98 | // now create inhibition on window | ||
103 | QScopedPointer<IdleInhibitor> inhibitor(Test::waylandIdleInhibitManager()->createInhibitor(surface.data())); | 99 | QScopedPointer<IdleInhibitor> inhibitor(Test::waylandIdleInhibitManager()->createInhibitor(surface.data())); | ||
104 | QVERIFY(inhibitor->isValid()); | 100 | QVERIFY(inhibitor->isValid()); | ||
101 | | ||||
102 | // render the client | ||||
103 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
104 | QVERIFY(c); | ||||
105 | | ||||
105 | // this should inhibit our server object | 106 | // this should inhibit our server object | ||
106 | QVERIFY(inhibitedSpy.wait()); | | |||
107 | QVERIFY(idle->isInhibited()); | 107 | QVERIFY(idle->isInhibited()); | ||
108 | 108 | | |||
109 | // deleting the object should uninhibit again | 109 | // deleting the object should uninhibit again | ||
110 | inhibitor.reset(); | 110 | inhibitor.reset(); | ||
111 | QVERIFY(inhibitedSpy.wait()); | 111 | QVERIFY(inhibitedSpy.wait()); | ||
112 | QVERIFY(!idle->isInhibited()); | 112 | QVERIFY(!idle->isInhibited()); | ||
113 | 113 | | |||
114 | // inhibit again and destroy window | 114 | // inhibit again and destroy window | ||
Show All 15 Lines |