Changeset View
Changeset View
Standalone View
Standalone View
libkonq/autotests/konqpopupmenutest.cpp
Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Line(s) | 163 | { | |||
---|---|---|---|---|---|
179 | 179 | | |||
180 | QStringList actions = extractActionNames(popup); | 180 | QStringList actions = extractActionNames(popup); | ||
181 | actions.removeAll(QStringLiteral("services_submenu")); | 181 | actions.removeAll(QStringLiteral("services_submenu")); | ||
182 | qDebug() << actions; | 182 | qDebug() << actions; | ||
183 | QStringList expectedActions; | 183 | QStringList expectedActions; | ||
184 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | 184 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | ||
185 | << QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("rename") << QStringLiteral("trash") << QStringLiteral("separator") | 185 | << QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("rename") << QStringLiteral("trash") << QStringLiteral("separator") | ||
186 | << QStringLiteral("openwith") | 186 | << QStringLiteral("openwith") | ||
187 | << QStringLiteral("openwith") | ||||
188 | << QStringLiteral("separator") | ||||
187 | << QStringLiteral("preview1"); | 189 | << QStringLiteral("preview1"); | ||
188 | expectedActions << QStringLiteral("separator"); | 190 | expectedActions << QStringLiteral("separator"); | ||
189 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | 191 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | ||
190 | // (came from arkplugin) << "compress" | 192 | // (came from arkplugin) << "compress" | ||
191 | expectedActions << QStringLiteral("properties"); | 193 | expectedActions << QStringLiteral("properties"); | ||
192 | qDebug() << "Expected:" << expectedActions; | 194 | qDebug() << "Expected:" << expectedActions; | ||
193 | QCOMPARE(actions, expectedActions); | 195 | QCOMPARE(actions, expectedActions); | ||
194 | } | 196 | } | ||
Show All 24 Lines | 199 | { | |||
219 | 221 | | |||
220 | QStringList actions = extractActionNames(popup); | 222 | QStringList actions = extractActionNames(popup); | ||
221 | actions.removeAll(QStringLiteral("services_submenu")); | 223 | actions.removeAll(QStringLiteral("services_submenu")); | ||
222 | qDebug() << actions; | 224 | qDebug() << actions; | ||
223 | QStringList expectedActions; | 225 | QStringList expectedActions; | ||
224 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | 226 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | ||
225 | << QStringLiteral("copy") << QStringLiteral("separator") | 227 | << QStringLiteral("copy") << QStringLiteral("separator") | ||
226 | << QStringLiteral("openwith") | 228 | << QStringLiteral("openwith") | ||
229 | << QStringLiteral("openwith") | ||||
230 | << QStringLiteral("separator") | ||||
227 | << QStringLiteral("preview1"); | 231 | << QStringLiteral("preview1"); | ||
228 | expectedActions << QStringLiteral("separator"); | 232 | expectedActions << QStringLiteral("separator"); | ||
229 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("separator"); | 233 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("separator"); | ||
230 | expectedActions << QStringLiteral("properties"); | 234 | expectedActions << QStringLiteral("properties"); | ||
231 | qDebug() << "Expected:" << expectedActions; | 235 | qDebug() << "Expected:" << expectedActions; | ||
232 | QCOMPARE(actions, expectedActions); | 236 | QCOMPARE(actions, expectedActions); | ||
233 | } | 237 | } | ||
234 | 238 | | |||
Show All 17 Lines | 240 | { | |||
252 | 256 | | |||
253 | QStringList actions = extractActionNames(popup); | 257 | QStringList actions = extractActionNames(popup); | ||
254 | actions.removeAll(QStringLiteral("services_submenu")); | 258 | actions.removeAll(QStringLiteral("services_submenu")); | ||
255 | qDebug() << actions; | 259 | qDebug() << actions; | ||
256 | QStringList expectedActions; | 260 | QStringList expectedActions; | ||
257 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | 261 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | ||
258 | << QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("rename") << QStringLiteral("trash") << QStringLiteral("separator") | 262 | << QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("rename") << QStringLiteral("trash") << QStringLiteral("separator") | ||
259 | << QStringLiteral("openwith") | 263 | << QStringLiteral("openwith") | ||
264 | << QStringLiteral("openwith") | ||||
265 | << QStringLiteral("separator") | ||||
260 | << QStringLiteral("preview_submenu"); | 266 | << QStringLiteral("preview_submenu"); | ||
261 | expectedActions << QStringLiteral("separator"); | 267 | expectedActions << QStringLiteral("separator"); | ||
262 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | 268 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | ||
263 | expectedActions << QStringLiteral("properties"); | 269 | expectedActions << QStringLiteral("properties"); | ||
264 | qDebug() << "Expected:" << expectedActions; | 270 | qDebug() << "Expected:" << expectedActions; | ||
265 | QCOMPARE(actions, expectedActions); | 271 | QCOMPARE(actions, expectedActions); | ||
266 | } | 272 | } | ||
267 | 273 | | |||
Show All 16 Lines | 275 | { | |||
284 | popup.setActionGroups(actionGroups); | 290 | popup.setActionGroups(actionGroups); | ||
285 | QStringList actions = extractActionNames(popup); | 291 | QStringList actions = extractActionNames(popup); | ||
286 | actions.removeAll(QStringLiteral("services_submenu")); | 292 | actions.removeAll(QStringLiteral("services_submenu")); | ||
287 | qDebug() << actions; | 293 | qDebug() << actions; | ||
288 | QStringList expectedActions; | 294 | QStringList expectedActions; | ||
289 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | 295 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | ||
290 | << QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("pasteto") << QStringLiteral("rename") << QStringLiteral("trash") << QStringLiteral("separator") | 296 | << QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("pasteto") << QStringLiteral("rename") << QStringLiteral("trash") << QStringLiteral("separator") | ||
291 | << QStringLiteral("openwith") | 297 | << QStringLiteral("openwith") | ||
298 | << QStringLiteral("openwith") | ||||
299 | << QStringLiteral("separator") | ||||
292 | << QStringLiteral("preview_submenu"); | 300 | << QStringLiteral("preview_submenu"); | ||
293 | expectedActions << QStringLiteral("separator"); | 301 | expectedActions << QStringLiteral("separator"); | ||
294 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | 302 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | ||
295 | expectedActions << QStringLiteral("properties"); | 303 | expectedActions << QStringLiteral("properties"); | ||
296 | qDebug() << "Expected:" << expectedActions; | 304 | qDebug() << "Expected:" << expectedActions; | ||
297 | QCOMPARE(actions, expectedActions); | 305 | QCOMPARE(actions, expectedActions); | ||
298 | } | 306 | } | ||
299 | 307 | | |||
Show All 16 Lines | 309 | { | |||
316 | 324 | | |||
317 | QStringList actions = extractActionNames(popup); | 325 | QStringList actions = extractActionNames(popup); | ||
318 | actions.removeAll(QStringLiteral("services_submenu")); | 326 | actions.removeAll(QStringLiteral("services_submenu")); | ||
319 | qDebug() << actions; | 327 | qDebug() << actions; | ||
320 | QStringList expectedActions; | 328 | QStringList expectedActions; | ||
321 | expectedActions << QStringLiteral("newmenu") << QStringLiteral("separator") | 329 | expectedActions << QStringLiteral("newmenu") << QStringLiteral("separator") | ||
322 | << QStringLiteral("paste") << QStringLiteral("separator") | 330 | << QStringLiteral("paste") << QStringLiteral("separator") | ||
323 | << QStringLiteral("openwith") | 331 | << QStringLiteral("openwith") | ||
332 | << QStringLiteral("openwith") | ||||
333 | << QStringLiteral("separator") | ||||
324 | << QStringLiteral("preview_submenu"); | 334 | << QStringLiteral("preview_submenu"); | ||
325 | expectedActions << QStringLiteral("separator"); | 335 | expectedActions << QStringLiteral("separator"); | ||
326 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | 336 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("moveTo_submenu") << QStringLiteral("separator"); | ||
327 | expectedActions << QStringLiteral("properties"); | 337 | expectedActions << QStringLiteral("properties"); | ||
328 | qDebug() << "Expected:" << expectedActions; | 338 | qDebug() << "Expected:" << expectedActions; | ||
329 | QCOMPARE(actions, expectedActions); | 339 | QCOMPARE(actions, expectedActions); | ||
330 | } | 340 | } | ||
331 | 341 | | |||
Show All 16 Lines | 343 | { | |||
348 | popup.setActionGroups(actionGroups); | 358 | popup.setActionGroups(actionGroups); | ||
349 | 359 | | |||
350 | QStringList actions = extractActionNames(popup); | 360 | QStringList actions = extractActionNames(popup); | ||
351 | actions.removeAll(QStringLiteral("services_submenu")); | 361 | actions.removeAll(QStringLiteral("services_submenu")); | ||
352 | qDebug() << actions; | 362 | qDebug() << actions; | ||
353 | QStringList expectedActions; | 363 | QStringList expectedActions; | ||
354 | expectedActions // << "paste" // no paste since readonly | 364 | expectedActions // << "paste" // no paste since readonly | ||
355 | << QStringLiteral("openwith") | 365 | << QStringLiteral("openwith") | ||
366 | << QStringLiteral("openwith") | ||||
367 | << QStringLiteral("separator") | ||||
356 | << QStringLiteral("preview_submenu"); | 368 | << QStringLiteral("preview_submenu"); | ||
357 | expectedActions << QStringLiteral("separator"); | 369 | expectedActions << QStringLiteral("separator"); | ||
358 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("separator"); // no moveTo_submenu, since readonly | 370 | expectedActions << QStringLiteral("copyTo_submenu") << QStringLiteral("separator"); // no moveTo_submenu, since readonly | ||
359 | expectedActions << QStringLiteral("properties"); | 371 | expectedActions << QStringLiteral("properties"); | ||
360 | qDebug() << "Expected:" << expectedActions; | 372 | qDebug() << "Expected:" << expectedActions; | ||
361 | QCOMPARE(actions, expectedActions); | 373 | QCOMPARE(actions, expectedActions); | ||
362 | } | 374 | } | ||
363 | 375 | | |||
Show All 18 Lines | 377 | { | |||
382 | 394 | | |||
383 | QStringList actions = extractActionNames(popup); | 395 | QStringList actions = extractActionNames(popup); | ||
384 | qDebug() << actions; | 396 | qDebug() << actions; | ||
385 | QStringList expectedActions; | 397 | QStringList expectedActions; | ||
386 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | 398 | expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator") | ||
387 | << QStringLiteral("bookmark_add") << QStringLiteral("savelinkas") << QStringLiteral("copylinklocation") | 399 | << QStringLiteral("bookmark_add") << QStringLiteral("savelinkas") << QStringLiteral("copylinklocation") | ||
388 | << QStringLiteral("separator") | 400 | << QStringLiteral("separator") | ||
389 | << QStringLiteral("openwith") | 401 | << QStringLiteral("openwith") | ||
402 | << QStringLiteral("openwith") | ||||
403 | << QStringLiteral("separator") | ||||
390 | << QStringLiteral("preview_submenu") | 404 | << QStringLiteral("preview_submenu") | ||
391 | << QStringLiteral("separator") | 405 | << QStringLiteral("separator") | ||
392 | << QStringLiteral("viewDocumentSource"); | 406 | << QStringLiteral("viewDocumentSource"); | ||
393 | qDebug() << "Expected:" << expectedActions; | 407 | qDebug() << "Expected:" << expectedActions; | ||
394 | QCOMPARE(actions, expectedActions); | 408 | QCOMPARE(actions, expectedActions); | ||
395 | } | 409 | } | ||
396 | 410 | | |||
397 | void KonqPopupMenuTest::testHtmlPage() | 411 | void KonqPopupMenuTest::testHtmlPage() | ||
Show All 23 Lines | 412 | { | |||
421 | popup.setBookmarkManager(KBookmarkManager::userBookmarksManager()); | 435 | popup.setBookmarkManager(KBookmarkManager::userBookmarksManager()); | ||
422 | 436 | | |||
423 | QStringList actions = extractActionNames(popup); | 437 | QStringList actions = extractActionNames(popup); | ||
424 | qDebug() << actions; | 438 | qDebug() << actions; | ||
425 | QStringList expectedActions; | 439 | QStringList expectedActions; | ||
426 | expectedActions << QStringLiteral("bookmark_add") | 440 | expectedActions << QStringLiteral("bookmark_add") | ||
427 | << QStringLiteral("separator") | 441 | << QStringLiteral("separator") | ||
428 | << QStringLiteral("openwith") | 442 | << QStringLiteral("openwith") | ||
443 | << QStringLiteral("openwith") | ||||
444 | << QStringLiteral("separator") | ||||
429 | << QStringLiteral("preview_submenu") | 445 | << QStringLiteral("preview_submenu") | ||
430 | << QStringLiteral("separator") | 446 | << QStringLiteral("separator") | ||
431 | // << TODO "stopanimations" | 447 | // << TODO "stopanimations" | ||
432 | << QStringLiteral("viewDocumentSource") << QStringLiteral("security") << QStringLiteral("setEncoding"); | 448 | << QStringLiteral("viewDocumentSource") << QStringLiteral("security") << QStringLiteral("setEncoding"); | ||
433 | qDebug() << "Expected:" << expectedActions; | 449 | qDebug() << "Expected:" << expectedActions; | ||
434 | QCOMPARE(actions, expectedActions); | 450 | QCOMPARE(actions, expectedActions); | ||
435 | } | 451 | } | ||
436 | 452 | | |||
437 | // TODO test ShowBookmark. Probably the same logic? | 453 | // TODO test ShowBookmark. Probably the same logic? | ||
438 | // TODO separate filemanager and webbrowser bookmark managers, too (share file bookmarks with file dialog) | 454 | // TODO separate filemanager and webbrowser bookmark managers, too (share file bookmarks with file dialog) | ||
439 | 455 | | |||
440 | // TODO test text selection actions in khtml | 456 | // TODO test text selection actions in khtml | ||
441 | 457 | | |||
442 | // TODO trash:/ tests | 458 | // TODO trash:/ tests | ||
443 | 459 | | |||
444 | // TODO test NoDeletion part flag | 460 | // TODO test NoDeletion part flag |