Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_rules_test.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 39 | private Q_SLOTS: | |||
---|---|---|---|---|---|
50 | void testApplyInitialSkipPager_data(); | 50 | void testApplyInitialSkipPager_data(); | ||
51 | void testApplyInitialSkipPager(); | 51 | void testApplyInitialSkipPager(); | ||
52 | void testApplyInitialSkipSwitcher_data(); | 52 | void testApplyInitialSkipSwitcher_data(); | ||
53 | void testApplyInitialSkipSwitcher(); | 53 | void testApplyInitialSkipSwitcher(); | ||
54 | void testApplyInitialKeepAbove_data(); | 54 | void testApplyInitialKeepAbove_data(); | ||
55 | void testApplyInitialKeepAbove(); | 55 | void testApplyInitialKeepAbove(); | ||
56 | void testApplyInitialKeepBelow_data(); | 56 | void testApplyInitialKeepBelow_data(); | ||
57 | void testApplyInitialKeepBelow(); | 57 | void testApplyInitialKeepBelow(); | ||
58 | void testApplyInitialShortcut_data(); | ||||
59 | void testApplyInitialShortcut(); | ||||
58 | }; | 60 | }; | ||
59 | 61 | | |||
60 | void TestShellClientRules::initTestCase() | 62 | void TestShellClientRules::initTestCase() | ||
61 | { | 63 | { | ||
62 | qRegisterMetaType<KWin::ShellClient*>(); | 64 | qRegisterMetaType<KWin::ShellClient*>(); | ||
63 | qRegisterMetaType<KWin::AbstractClient*>(); | 65 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
64 | 66 | | |||
65 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 67 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 116 | { | |||
130 | QCOMPARE(c->desktop(), 2); | 132 | QCOMPARE(c->desktop(), 2); | ||
131 | QCOMPARE(c->isMinimized(), false); | 133 | QCOMPARE(c->isMinimized(), false); | ||
132 | QCOMPARE(c->isActive(), true); | 134 | QCOMPARE(c->isActive(), true); | ||
133 | QCOMPARE(c->skipTaskbar(), false); | 135 | QCOMPARE(c->skipTaskbar(), false); | ||
134 | QCOMPARE(c->skipPager(), false); | 136 | QCOMPARE(c->skipPager(), false); | ||
135 | QCOMPARE(c->skipSwitcher(), false); | 137 | QCOMPARE(c->skipSwitcher(), false); | ||
136 | QCOMPARE(c->keepAbove(), false); | 138 | QCOMPARE(c->keepAbove(), false); | ||
137 | QCOMPARE(c->keepBelow(), false); | 139 | QCOMPARE(c->keepBelow(), false); | ||
140 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
138 | } | 141 | } | ||
139 | 142 | | |||
140 | TEST_DATA(testApplyInitialMinimize) | 143 | TEST_DATA(testApplyInitialMinimize) | ||
141 | 144 | | |||
142 | void TestShellClientRules::testApplyInitialMinimize() | 145 | void TestShellClientRules::testApplyInitialMinimize() | ||
143 | { | 146 | { | ||
144 | // install the temporary rule | 147 | // install the temporary rule | ||
145 | QFETCH(int, ruleNumber); | 148 | QFETCH(int, ruleNumber); | ||
Show All 11 Lines | |||||
157 | QCOMPARE(c->isActive(), false); | 160 | QCOMPARE(c->isActive(), false); | ||
158 | c->setMinimized(false); | 161 | c->setMinimized(false); | ||
159 | QCOMPARE(c->isMinimized(), false); | 162 | QCOMPARE(c->isMinimized(), false); | ||
160 | QCOMPARE(c->skipTaskbar(), false); | 163 | QCOMPARE(c->skipTaskbar(), false); | ||
161 | QCOMPARE(c->skipPager(), false); | 164 | QCOMPARE(c->skipPager(), false); | ||
162 | QCOMPARE(c->skipSwitcher(), false); | 165 | QCOMPARE(c->skipSwitcher(), false); | ||
163 | QCOMPARE(c->keepAbove(), false); | 166 | QCOMPARE(c->keepAbove(), false); | ||
164 | QCOMPARE(c->keepBelow(), false); | 167 | QCOMPARE(c->keepBelow(), false); | ||
168 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
165 | } | 169 | } | ||
166 | 170 | | |||
167 | TEST_DATA(testApplyInitialSkipTaskbar) | 171 | TEST_DATA(testApplyInitialSkipTaskbar) | ||
168 | 172 | | |||
169 | void TestShellClientRules::testApplyInitialSkipTaskbar() | 173 | void TestShellClientRules::testApplyInitialSkipTaskbar() | ||
170 | { | 174 | { | ||
171 | // install the temporary rule | 175 | // install the temporary rule | ||
172 | QFETCH(int, ruleNumber); | 176 | QFETCH(int, ruleNumber); | ||
Show All 9 Lines | |||||
182 | QCOMPARE(c->desktop(), 1); | 186 | QCOMPARE(c->desktop(), 1); | ||
183 | QCOMPARE(c->isMinimized(), false); | 187 | QCOMPARE(c->isMinimized(), false); | ||
184 | QCOMPARE(c->isActive(), true); | 188 | QCOMPARE(c->isActive(), true); | ||
185 | QCOMPARE(c->skipTaskbar(), true); | 189 | QCOMPARE(c->skipTaskbar(), true); | ||
186 | QCOMPARE(c->skipPager(), false); | 190 | QCOMPARE(c->skipPager(), false); | ||
187 | QCOMPARE(c->skipSwitcher(), false); | 191 | QCOMPARE(c->skipSwitcher(), false); | ||
188 | QCOMPARE(c->keepAbove(), false); | 192 | QCOMPARE(c->keepAbove(), false); | ||
189 | QCOMPARE(c->keepBelow(), false); | 193 | QCOMPARE(c->keepBelow(), false); | ||
194 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
190 | } | 195 | } | ||
191 | 196 | | |||
192 | TEST_DATA(testApplyInitialSkipPager) | 197 | TEST_DATA(testApplyInitialSkipPager) | ||
193 | 198 | | |||
194 | void TestShellClientRules::testApplyInitialSkipPager() | 199 | void TestShellClientRules::testApplyInitialSkipPager() | ||
195 | { | 200 | { | ||
196 | // install the temporary rule | 201 | // install the temporary rule | ||
197 | QFETCH(int, ruleNumber); | 202 | QFETCH(int, ruleNumber); | ||
Show All 9 Lines | |||||
207 | QCOMPARE(c->desktop(), 1); | 212 | QCOMPARE(c->desktop(), 1); | ||
208 | QCOMPARE(c->isMinimized(), false); | 213 | QCOMPARE(c->isMinimized(), false); | ||
209 | QCOMPARE(c->isActive(), true); | 214 | QCOMPARE(c->isActive(), true); | ||
210 | QCOMPARE(c->skipTaskbar(), false); | 215 | QCOMPARE(c->skipTaskbar(), false); | ||
211 | QCOMPARE(c->skipPager(), true); | 216 | QCOMPARE(c->skipPager(), true); | ||
212 | QCOMPARE(c->skipSwitcher(), false); | 217 | QCOMPARE(c->skipSwitcher(), false); | ||
213 | QCOMPARE(c->keepAbove(), false); | 218 | QCOMPARE(c->keepAbove(), false); | ||
214 | QCOMPARE(c->keepBelow(), false); | 219 | QCOMPARE(c->keepBelow(), false); | ||
220 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
215 | } | 221 | } | ||
216 | 222 | | |||
217 | TEST_DATA(testApplyInitialSkipSwitcher) | 223 | TEST_DATA(testApplyInitialSkipSwitcher) | ||
218 | 224 | | |||
219 | void TestShellClientRules::testApplyInitialSkipSwitcher() | 225 | void TestShellClientRules::testApplyInitialSkipSwitcher() | ||
220 | { | 226 | { | ||
221 | // install the temporary rule | 227 | // install the temporary rule | ||
222 | QFETCH(int, ruleNumber); | 228 | QFETCH(int, ruleNumber); | ||
Show All 9 Lines | |||||
232 | QCOMPARE(c->desktop(), 1); | 238 | QCOMPARE(c->desktop(), 1); | ||
233 | QCOMPARE(c->isMinimized(), false); | 239 | QCOMPARE(c->isMinimized(), false); | ||
234 | QCOMPARE(c->isActive(), true); | 240 | QCOMPARE(c->isActive(), true); | ||
235 | QCOMPARE(c->skipTaskbar(), false); | 241 | QCOMPARE(c->skipTaskbar(), false); | ||
236 | QCOMPARE(c->skipPager(), false); | 242 | QCOMPARE(c->skipPager(), false); | ||
237 | QCOMPARE(c->skipSwitcher(), true); | 243 | QCOMPARE(c->skipSwitcher(), true); | ||
238 | QCOMPARE(c->keepAbove(), false); | 244 | QCOMPARE(c->keepAbove(), false); | ||
239 | QCOMPARE(c->keepBelow(), false); | 245 | QCOMPARE(c->keepBelow(), false); | ||
246 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
240 | } | 247 | } | ||
241 | 248 | | |||
242 | TEST_DATA(testApplyInitialKeepAbove) | 249 | TEST_DATA(testApplyInitialKeepAbove) | ||
243 | 250 | | |||
244 | void TestShellClientRules::testApplyInitialKeepAbove() | 251 | void TestShellClientRules::testApplyInitialKeepAbove() | ||
245 | { | 252 | { | ||
246 | // install the temporary rule | 253 | // install the temporary rule | ||
247 | QFETCH(int, ruleNumber); | 254 | QFETCH(int, ruleNumber); | ||
Show All 9 Lines | |||||
257 | QCOMPARE(c->desktop(), 1); | 264 | QCOMPARE(c->desktop(), 1); | ||
258 | QCOMPARE(c->isMinimized(), false); | 265 | QCOMPARE(c->isMinimized(), false); | ||
259 | QCOMPARE(c->isActive(), true); | 266 | QCOMPARE(c->isActive(), true); | ||
260 | QCOMPARE(c->skipTaskbar(), false); | 267 | QCOMPARE(c->skipTaskbar(), false); | ||
261 | QCOMPARE(c->skipPager(), false); | 268 | QCOMPARE(c->skipPager(), false); | ||
262 | QCOMPARE(c->skipSwitcher(), false); | 269 | QCOMPARE(c->skipSwitcher(), false); | ||
263 | QCOMPARE(c->keepAbove(), true); | 270 | QCOMPARE(c->keepAbove(), true); | ||
264 | QCOMPARE(c->keepBelow(), false); | 271 | QCOMPARE(c->keepBelow(), false); | ||
272 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
265 | } | 273 | } | ||
266 | 274 | | |||
267 | TEST_DATA(testApplyInitialKeepBelow) | 275 | TEST_DATA(testApplyInitialKeepBelow) | ||
268 | 276 | | |||
269 | void TestShellClientRules::testApplyInitialKeepBelow() | 277 | void TestShellClientRules::testApplyInitialKeepBelow() | ||
270 | { | 278 | { | ||
271 | // install the temporary rule | 279 | // install the temporary rule | ||
272 | QFETCH(int, ruleNumber); | 280 | QFETCH(int, ruleNumber); | ||
Show All 9 Lines | |||||
282 | QCOMPARE(c->desktop(), 1); | 290 | QCOMPARE(c->desktop(), 1); | ||
283 | QCOMPARE(c->isMinimized(), false); | 291 | QCOMPARE(c->isMinimized(), false); | ||
284 | QCOMPARE(c->isActive(), true); | 292 | QCOMPARE(c->isActive(), true); | ||
285 | QCOMPARE(c->skipTaskbar(), false); | 293 | QCOMPARE(c->skipTaskbar(), false); | ||
286 | QCOMPARE(c->skipPager(), false); | 294 | QCOMPARE(c->skipPager(), false); | ||
287 | QCOMPARE(c->skipSwitcher(), false); | 295 | QCOMPARE(c->skipSwitcher(), false); | ||
288 | QCOMPARE(c->keepAbove(), false); | 296 | QCOMPARE(c->keepAbove(), false); | ||
289 | QCOMPARE(c->keepBelow(), true); | 297 | QCOMPARE(c->keepBelow(), true); | ||
298 | QCOMPARE(c->shortcut(), QKeySequence()); | ||||
299 | } | ||||
300 | | ||||
301 | TEST_DATA(testApplyInitialShortcut) | ||||
302 | | ||||
303 | void TestShellClientRules::testApplyInitialShortcut() | ||||
304 | { | ||||
305 | // install the temporary rule | ||||
306 | QFETCH(int, ruleNumber); | ||||
307 | const QKeySequence sequence{Qt::ControlModifier + Qt::ShiftModifier + Qt::MetaModifier + Qt::AltModifier + Qt::Key_Space}; | ||||
308 | QString rule = QStringLiteral("shortcut=%1\nshortcutrule=%2").arg(sequence.toString()).arg(ruleNumber); | ||||
309 | QMetaObject::invokeMethod(RuleBook::self(), "temporaryRulesMessage", Q_ARG(QString, rule)); | ||||
310 | | ||||
311 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
312 | QFETCH(Test::ShellSurfaceType, type); | ||||
313 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | ||||
314 | | ||||
315 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
316 | QVERIFY(c); | ||||
317 | QCOMPARE(c->desktop(), 1); | ||||
318 | QCOMPARE(c->isMinimized(), false); | ||||
319 | QCOMPARE(c->isActive(), true); | ||||
320 | QCOMPARE(c->skipTaskbar(), false); | ||||
321 | QCOMPARE(c->skipPager(), false); | ||||
322 | QCOMPARE(c->skipSwitcher(), false); | ||||
323 | QCOMPARE(c->keepAbove(), false); | ||||
324 | QCOMPARE(c->keepBelow(), false); | ||||
325 | QCOMPARE(c->shortcut(), sequence); | ||||
290 | } | 326 | } | ||
291 | 327 | | |||
292 | WAYLANDTEST_MAIN(TestShellClientRules) | 328 | WAYLANDTEST_MAIN(TestShellClientRules) | ||
293 | #include "shell_client_rules_test.moc" | 329 | #include "shell_client_rules_test.moc" |