| 1 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 2 |
|
| 3 |
#pragma once |
| 4 |
|
| 5 |
|
| 6 |
#include "tests/testinterface.h" |
| 7 |
|
| 8 |
#include <QObject> |
| 9 |
#include <QStringList> |
| 10 |
|
| 11 |
class QProcess; |
| 12 |
class QByteArray; |
| 13 |
|
| 14 |
/** |
| 15 |
* Core tests for the application. |
| 16 |
*/ |
| 17 |
class CoreTests final : public QObject |
| 18 |
{ |
| 19 |
Q_OBJECT |
| 20 |
|
| 21 |
public: |
| 22 |
explicit CoreTests(const TestInterfacePtr &test, QObject *parent = nullptr); |
| 23 |
|
| 24 |
private slots: |
| 25 |
void initTestCase(); |
| 26 |
void cleanupTestCase(); |
| 27 |
void init(); |
| 28 |
void cleanup(); |
| 29 |
|
| 30 |
void configPath(); |
| 31 |
void readLog(); |
| 32 |
void rotateLog(); |
| 33 |
void pluginsDisabled(); |
| 34 |
void commandHelp(); |
| 35 |
void commandVersion(); |
| 36 |
void badCommand(); |
| 37 |
void badSessionName(); |
| 38 |
void commandSession(); |
| 39 |
|
| 40 |
void commandCatchExceptions(); |
| 41 |
|
| 42 |
void commandExit(); |
| 43 |
void commandEval(); |
| 44 |
void commandEvalThrows(); |
| 45 |
void commandEvalThrowsWithLineNumber(); |
| 46 |
void commandEvalSyntaxError(); |
| 47 |
void commandEvalArguments(); |
| 48 |
void commandEvalEndingWithComment(); |
| 49 |
void commandPrint(); |
| 50 |
void commandAbort(); |
| 51 |
void commandFail(); |
| 52 |
void commandSource(); |
| 53 |
|
| 54 |
void commandVisible(); |
| 55 |
void commandToggle(); |
| 56 |
void commandShowHide(); |
| 57 |
void commandShowHideRapid(); |
| 58 |
void commandShowAt(); |
| 59 |
void commandFocused(); |
| 60 |
|
| 61 |
void commandsUnicode(); |
| 62 |
|
| 63 |
void commandsAddRead(); |
| 64 |
void commandsWriteRead(); |
| 65 |
void commandsReadUtf8ByDefault(); |
| 66 |
void commandChange(); |
| 67 |
|
| 68 |
void commandSetCurrentTab(); |
| 69 |
|
| 70 |
void commandConfig(); |
| 71 |
void commandToggleConfig(); |
| 72 |
|
| 73 |
void commandDialog(); |
| 74 |
void commandDialogCloseOnDisconnect(); |
| 75 |
|
| 76 |
void commandMenuItems(); |
| 77 |
|
| 78 |
void commandsPackUnpack(); |
| 79 |
void commandsBase64(); |
| 80 |
void commandsGetSetItem(); |
| 81 |
|
| 82 |
void commandsChecksums(); |
| 83 |
|
| 84 |
void commandEscapeHTML(); |
| 85 |
|
| 86 |
void commandExecute(); |
| 87 |
|
| 88 |
void commandSettings(); |
| 89 |
|
| 90 |
void commandsEnvSetEnv(); |
| 91 |
|
| 92 |
void commandSleep(); |
| 93 |
|
| 94 |
void commandsData(); |
| 95 |
|
| 96 |
void commandCurrentWindowTitle(); |
| 97 |
|
| 98 |
void commandCopy(); |
| 99 |
void commandClipboard(); |
| 100 |
void commandHasClipboardFormat(); |
| 101 |
|
| 102 |
void commandEdit(); |
| 103 |
void commandEditItem(); |
| 104 |
|
| 105 |
void commandGetSetCurrentPath(); |
| 106 |
|
| 107 |
void commandSelectItems(); |
| 108 |
|
| 109 |
void commandsExportImport(); |
| 110 |
|
| 111 |
void commandsGetSetCommands(); |
| 112 |
|
| 113 |
void commandsImportExportCommands(); |
| 114 |
void commandsImportExportCommandsFixIndentation(); |
| 115 |
|
| 116 |
void commandsAddCommandsRegExp(); |
| 117 |
|
| 118 |
void commandScreenshot(); |
| 119 |
|
| 120 |
void commandNotification(); |
| 121 |
void commandNotificationUrgency(); |
| 122 |
void commandNotificationPersistent(); |
| 123 |
void commandPlaySound(); |
| 124 |
|
| 125 |
void commandIcon(); |
| 126 |
void commandIconTag(); |
| 127 |
void commandIconTagColor(); |
| 128 |
void commandLoadTheme(); |
| 129 |
|
| 130 |
void commandDateString(); |
| 131 |
|
| 132 |
void commandAfterMilliseconds(); |
| 133 |
|
| 134 |
void commandAsync(); |
| 135 |
|
| 136 |
void commandFilter(); |
| 137 |
|
| 138 |
void commandMimeTypes(); |
| 139 |
|
| 140 |
void commandUnload(); |
| 141 |
void commandForceUnload(); |
| 142 |
|
| 143 |
void commandServerLogAndLogs(); |
| 144 |
|
| 145 |
void commandStats(); |
| 146 |
void statsQObjectLeak(); |
| 147 |
void statsItemPreview(); |
| 148 |
|
| 149 |
void classByteArray(); |
| 150 |
void classFile(); |
| 151 |
void classDir(); |
| 152 |
void classTemporaryFile(); |
| 153 |
void classItemSelection(); |
| 154 |
void classItemSelectionGetCurrent(); |
| 155 |
void classItemSelectionByteArray(); |
| 156 |
void classItemSelectionSort(); |
| 157 |
void classSettings(); |
| 158 |
void calledWithInstance(); |
| 159 |
|
| 160 |
void pipingCommands(); |
| 161 |
|
| 162 |
void chainingCommands(); |
| 163 |
|
| 164 |
void configMaxitems(); |
| 165 |
|
| 166 |
void keysAndFocusing(); |
| 167 |
|
| 168 |
void navigationDefault(); |
| 169 |
void navigationVi(); |
| 170 |
void navigationEmacs(); |
| 171 |
|
| 172 |
void selectItems(); |
| 173 |
|
| 174 |
void moveItems(); |
| 175 |
void deleteItems(); |
| 176 |
void searchItems(); |
| 177 |
void searchItemsAndSelect(); |
| 178 |
void searchItemsAndCopy(); |
| 179 |
void searchRowNumber(); |
| 180 |
void searchAccented(); |
| 181 |
void searchManyItems(); |
| 182 |
void copyItems(); |
| 183 |
void selectAndCopyOrder(); |
| 184 |
void copyItemsNullCharacter(); |
| 185 |
|
| 186 |
void sortAndReverse(); |
| 187 |
|
| 188 |
void createTabDialog(); |
| 189 |
|
| 190 |
void copyPasteCommands(); |
| 191 |
|
| 192 |
void editItems(); |
| 193 |
void createNewItem(); |
| 194 |
void editNotes(); |
| 195 |
void editHtml(); |
| 196 |
|
| 197 |
void toggleClipboardMonitoring(); |
| 198 |
|
| 199 |
void clipboardToItem(); |
| 200 |
void itemToClipboard(); |
| 201 |
void tabAdd(); |
| 202 |
void tabRemove(); |
| 203 |
void tabIcon(); |
| 204 |
void action(); |
| 205 |
void insertRemoveItems(); |
| 206 |
void renameTab(); |
| 207 |
void renameClipboardTab(); |
| 208 |
void importExportTab(); |
| 209 |
|
| 210 |
void removeAllFoundItems(); |
| 211 |
|
| 212 |
void nextPrevious(); |
| 213 |
|
| 214 |
void externalEditor(); |
| 215 |
|
| 216 |
void nextPreviousTab(); |
| 217 |
|
| 218 |
void itemPreview(); |
| 219 |
|
| 220 |
void openAndSavePreferences(); |
| 221 |
|
| 222 |
void pasteFromMainWindow(); |
| 223 |
|
| 224 |
void tray(); |
| 225 |
void menu(); |
| 226 |
|
| 227 |
void traySearch(); |
| 228 |
void trayPaste(); |
| 229 |
void trayShowHideAction(); |
| 230 |
void trayMenuToggleRapid(); |
| 231 |
|
| 232 |
void pasteNext(); |
| 233 |
|
| 234 |
// Options for tray menu. |
| 235 |
void configTrayTab(); |
| 236 |
void configMove(); |
| 237 |
void configTrayTabIsCurrent(); |
| 238 |
|
| 239 |
void configAutostart(); |
| 240 |
|
| 241 |
void envVariablePaths(); |
| 242 |
|
| 243 |
void configTabs(); |
| 244 |
|
| 245 |
void selectedItems(); |
| 246 |
|
| 247 |
void shortcutCommand(); |
| 248 |
void shortcutCommandOverrideEnter(); |
| 249 |
void shortcutCommandMatchInput(); |
| 250 |
void shortcutCommandMatchCmd(); |
| 251 |
|
| 252 |
void shortcutCommandSelectedItemData(); |
| 253 |
void shortcutCommandSetSelectedItemData(); |
| 254 |
void shortcutCommandSelectedItemsData(); |
| 255 |
void shortcutCommandSetSelectedItemsData(); |
| 256 |
void shortcutCommandSelectedAndCurrent(); |
| 257 |
void shortcutCommandMoveSelected(); |
| 258 |
|
| 259 |
void automaticCommandIgnore(); |
| 260 |
void automaticCommandRemove(); |
| 261 |
void automaticCommandInput(); |
| 262 |
void automaticCommandRegExp(); |
| 263 |
void automaticCommandSetData(); |
| 264 |
void automaticCommandOutputTab(); |
| 265 |
void automaticCommandNoOutputTab(); |
| 266 |
void automaticCommandChaining(); |
| 267 |
void automaticCommandCopyToTab(); |
| 268 |
void automaticCommandStoreSpecialFormat(); |
| 269 |
void automaticCommandIgnoreSpecialFormat(); |
| 270 |
|
| 271 |
void globalCommandInMenu(); |
| 272 |
|
| 273 |
void scriptCommandLoaded(); |
| 274 |
void scriptCommandAddFunction(); |
| 275 |
void scriptCommandOverrideFunction(); |
| 276 |
void scriptCommandEnhanceFunction(); |
| 277 |
void scriptCommandEndingWithComment(); |
| 278 |
void scriptCommandWithError(); |
| 279 |
|
| 280 |
void scriptPaste(); |
| 281 |
void scriptOnTabSelected(); |
| 282 |
void scriptOnItemsRemoved(); |
| 283 |
void scriptOnItemsAdded(); |
| 284 |
void scriptOnItemsChanged(); |
| 285 |
void scriptOnItemsLoaded(); |
| 286 |
void scriptEventMaxRecursion(); |
| 287 |
void scriptSlowCollectOverrides(); |
| 288 |
|
| 289 |
void displayCommand(); |
| 290 |
void displayCommandForMenu(); |
| 291 |
|
| 292 |
void synchronizeInternalCommands(); |
| 293 |
|
| 294 |
void utilityCommands(); |
| 295 |
|
| 296 |
void setTabName(); |
| 297 |
|
| 298 |
void showHideAboutDialog(); |
| 299 |
void showHideClipboardDialog(); |
| 300 |
void showHideItemDialog(); |
| 301 |
void showHideLogDialog(); |
| 302 |
void showHideActionHandlerDialog(); |
| 303 |
|
| 304 |
void shortcutDialogAddShortcut(); |
| 305 |
void shortcutDialogAddTwoShortcuts(); |
| 306 |
void shortcutDialogChangeShortcut(); |
| 307 |
void shortcutDialogSameShortcut(); |
| 308 |
void shortcutDialogCancel(); |
| 309 |
|
| 310 |
void actionDialogCancel(); |
| 311 |
void actionDialogAccept(); |
| 312 |
void actionDialogSelectionInputOutput(); |
| 313 |
|
| 314 |
void exitConfirm(); |
| 315 |
void exitNoConfirm(); |
| 316 |
void exitStopCommands(); |
| 317 |
void terminateActionRequestTerminate(); |
| 318 |
void terminateActionRequestKill(); |
| 319 |
|
| 320 |
void abortInputReader(); |
| 321 |
|
| 322 |
void changeAlwaysOnTop(); |
| 323 |
|
| 324 |
void networkTests(); |
| 325 |
|
| 326 |
void pluginNotInstalled(); |
| 327 |
|
| 328 |
void startServerAndRunCommand(); |
| 329 |
|
| 330 |
void avoidStoringPasswords(); |
| 331 |
void scriptsForPasswords(); |
| 332 |
|
| 333 |
void currentClipboardOwner(); |
| 334 |
void singleClipboardProvider(); |
| 335 |
|
| 336 |
void saveLargeItem(); |
| 337 |
|
| 338 |
void slowClipboard(); |
| 339 |
void clipboardUriList(); |
| 340 |
void clipboardMimeSizeLimit(); |
| 341 |
void clipboardMimeSizeLimitConfig(); |
| 342 |
|
| 343 |
void handleUnexpectedTypes(); |
| 344 |
|
| 345 |
void expireTabs(); |
| 346 |
void expireEncryptionPassword(); |
| 347 |
void expireEncryptionPasswordOnConfigChange(); |
| 348 |
|
| 349 |
void dragNDropItemOrder(); |
| 350 |
void dragNDropItemToTabTree(); |
| 351 |
void dragNDropTreeTab(); |
| 352 |
void dragNDropTreeTabNested(); |
| 353 |
void dragNDropTreeTabChildCollision(); |
| 354 |
void dragNDropTreeTabPartialRenameFailure(); |
| 355 |
void dragNDropTreeTabKeepsCollapsedState(); |
| 356 |
|
| 357 |
void tabEncryption(); |
| 358 |
void tabEncryptionPasswordNew(); |
| 359 |
void tabEncryptionPasswordCurrent(); |
| 360 |
void tabEncryptionPasswordRetry(); |
| 361 |
void tabEncryptionPasswordRetryFail(); |
| 362 |
void tabEncryptionPasswordAbortRetry(); |
| 363 |
void tabEncryptionLargeItems(); |
| 364 |
void tabEncryptionChangePassword(); |
| 365 |
|
| 366 |
void exportImportNoPasswordTab(); |
| 367 |
void exportImportNoPasswordSettingsOnly(); |
| 368 |
void exportImportNoPasswordCommandsOnly(); |
| 369 |
void exportImportPasswordTab(); |
| 370 |
void exportImportPasswordSettingsOnly(); |
| 371 |
void exportImportPasswordCommandsOnly(); |
| 372 |
void exportImportErrors(); |
| 373 |
|
| 374 |
private: |
| 375 |
void navigationTestInit(); |
| 376 |
void navigationTestDownUp(const QString &down, const QString &up); |
| 377 |
void navigationTestEndHome(const QString &end, const QString &home); |
| 378 |
void navigationTestEscapeEditor(const QString &esc, const QString &editor); |
| 379 |
void navigationTestEscapeSearch(const QString &esc, const QString &search); |
| 380 |
|
| 381 |
enum ExportFlags { |
| 382 |
ExportWithPassword = 1, |
| 383 |
ExportTab = 2, |
| 384 |
ExportSettings = 4, |
| 385 |
ExportCommands = 8 |
| 386 |
}; |
| 387 |
void exportImport(int flags); |
| 388 |
|
| 389 |
void clearServerErrors(); |
| 390 |
int run(const QStringList &arguments, QByteArray *stdoutData = nullptr, |
| 391 |
QByteArray *stderrData = nullptr, const QByteArray &in = QByteArray(), |
| 392 |
const QStringList &environment = QStringList()); |
| 393 |
bool hasTab(const QString &tabName); |
| 394 |
|
| 395 |
TestInterfacePtr m_test; |
| 396 |
}; |