File indexing completed on 2025-03-16 03:43:39
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2004 David Faure <faure@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef TESTTRASH_H 0009 #define TESTTRASH_H 0010 0011 #include "udsentry.h" 0012 #include <QObject> 0013 #include <QTemporaryDir> 0014 0015 #include <KIO/Job> 0016 0017 class TestTrash : public QObject 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 TestTrash() 0023 { 0024 } 0025 0026 private Q_SLOTS: 0027 void initTestCase(); 0028 void cleanupTestCase(); 0029 0030 void testIcons(); 0031 0032 void urlTestFile(); 0033 void urlTestDirectory(); 0034 void urlTestSubDirectory(); 0035 0036 void trashFileFromHome(); 0037 void trashPercentFileFromHome(); 0038 void trashUtf8FileFromHome(); 0039 void trashUmlautFileFromHome(); 0040 void testTrashNotEmpty(); 0041 void trashFileFromOther(); 0042 void trashFileIntoOtherPartition(); 0043 void trashFileOwnedByRoot(); 0044 void trashSymlinkFromHome(); 0045 void trashSymlinkFromOther(); 0046 void trashBrokenSymlinkFromHome(); 0047 void trashDirectoryFromHome(); 0048 void trashDotDirectory(); 0049 void trashReadOnlyDirFromHome(); 0050 void trashDirectoryFromOther(); 0051 void trashDirectoryOwnedByRoot(); 0052 void trashDirectoryWithTrailingSlash(); 0053 void trashBrokenSymlinkIntoSubdir(); 0054 0055 void statRoot(); 0056 void statFileInRoot(); 0057 void statDirectoryInRoot(); 0058 void statSymlinkInRoot(); 0059 void statFileInDirectory(); 0060 void statBrokenSymlinkInSubdir(); 0061 void testRemoveStaleInfofile(); 0062 0063 void copyFileFromTrash(); 0064 void copyFileInDirectoryFromTrash(); 0065 void copyDirectoryFromTrash(); 0066 void copySymlinkFromTrash(); 0067 0068 void renameFileInTrash(); 0069 void renameDirInTrash(); 0070 void moveFileFromTrash(); 0071 void moveFileFromTrashToDir_data(); 0072 void moveFileFromTrashToDir(); 0073 void moveFileInDirectoryFromTrash(); 0074 void moveDirectoryFromTrash(); 0075 void moveSymlinkFromTrash(); 0076 void testMoveNonExistingFile(); 0077 0078 void listRootDir(); 0079 void listRecursiveRootDir(); 0080 void mostLocalUrlTest(); 0081 void listSubDir(); 0082 0083 void delRootFile(); 0084 void delFileInDirectory(); 0085 void delDirectory(); 0086 0087 void getFile(); 0088 void restoreFile(); 0089 void restoreFileFromSubDir(); 0090 void restoreFileToDeletedDirectory(); 0091 0092 void emptyTrash(); 0093 void testEmptyTrashSize(); 0094 0095 protected Q_SLOTS: 0096 void slotEntries(KIO::Job *, const KIO::UDSEntryList &); 0097 0098 private: 0099 void trashFile(const QString &origFilePath, const QString &fileId); 0100 void trashSymlink(const QString &origFilePath, const QString &fileName, bool broken); 0101 void trashDirectory(const QString &origPath, const QString &fileName); 0102 void copyFromTrash(const QString &fileId, const QString &destPath, const QString &relativePath = QString()); 0103 void moveInTrash(const QString &fileId, const QString &destFileId); 0104 void moveFromTrash(const QString &fileId, const QString &destPath, const QString &relativePath = QString()); 0105 void checkDirCacheValidity(); 0106 0107 QString homeTmpDir() const; 0108 QString otherTmpDir() const; 0109 QString utf8FileName() const; 0110 QString umlautFileName() const; 0111 QString readOnlyDirPath() const; 0112 0113 QString m_trashDir; 0114 0115 QString m_otherPartitionTopDir; 0116 QString m_otherPartitionTrashDir; 0117 bool m_tmpIsWritablePartition; 0118 int m_tmpTrashId; 0119 int m_otherPartitionId; 0120 0121 int m_entryCount; 0122 QStringList m_listResult; 0123 QStringList m_displayNameListResult; 0124 0125 QTemporaryDir m_tempDir; 0126 }; 0127 0128 #endif