Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / kioslave / trash / tests / testtrash.h
blobdb1129d445459c7fe6d100d6a348785e3297daa3
1 /* This file is part of the KDE project
2 Copyright (C) 2004 David Faure <faure@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef TESTTRASH_H
21 #define TESTTRASH_H
23 #include <QObject>
25 class TestTrash : public QObject
27 Q_OBJECT
29 public:
30 TestTrash() {}
31 void setup();
32 void runAll();
34 // tests
36 void testIcons();
38 void urlTestFile();
39 void urlTestDirectory();
40 void urlTestSubDirectory();
42 void trashFileFromHome();
43 void trashPercentFileFromHome();
44 void trashUtf8FileFromHome();
45 void trashUmlautFileFromHome();
46 void testTrashNotEmpty();
47 void trashFileFromOther();
48 void trashFileIntoOtherPartition();
49 void trashFileOwnedByRoot();
50 void trashSymlinkFromHome();
51 void trashSymlinkFromOther();
52 void trashBrokenSymlinkFromHome();
53 void trashDirectoryFromHome();
54 void trashReadOnlyDirFromHome();
55 void trashDirectoryFromOther();
56 void trashDirectoryOwnedByRoot();
58 void tryRenameInsideTrash();
60 void statRoot();
61 void statFileInRoot();
62 void statDirectoryInRoot();
63 void statSymlinkInRoot();
64 void statFileInDirectory();
66 void copyFileFromTrash();
67 void copyFileInDirectoryFromTrash();
68 void copyDirectoryFromTrash();
69 void copySymlinkFromTrash();
71 void moveFileFromTrash();
72 void moveFileInDirectoryFromTrash();
73 void moveDirectoryFromTrash();
74 void moveSymlinkFromTrash();
76 void listRootDir();
77 void listRecursiveRootDir();
78 void listSubDir();
80 void delRootFile();
81 void delFileInDirectory();
82 void delDirectory();
84 void getFile();
85 void restoreFile();
86 void restoreFileFromSubDir();
87 void restoreFileToDeletedDirectory();
89 void emptyTrash();
91 private Q_SLOTS:
92 void slotEntries( KIO::Job*, const KIO::UDSEntryList& );
94 private:
95 void trashFile( const QString& origFilePath, const QString& fileId );
96 void trashSymlink( const QString& origFilePath, const QString& fileName, bool broken );
97 void trashDirectory( const QString& origPath, const QString& fileName );
98 void copyFromTrash( const QString& fileId, const QString& destPath, const QString& relativePath = QString() );
99 void moveFromTrash( const QString& fileId, const QString& destPath, const QString& relativePath = QString() );
101 QString homeTmpDir() const;
102 QString otherTmpDir() const;
103 QString utf8FileName() const;
104 QString umlautFileName() const;
105 QString readOnlyDirPath() const;
107 QString m_trashDir;
109 QString m_otherPartitionTopDir;
110 QString m_otherPartitionTrashDir;
111 bool m_tmpIsWritablePartition;
112 int m_tmpTrashId;
113 int m_otherPartitionId;
115 int m_entryCount;
116 QStringList m_listResult;
119 #endif