| 175 | } |
| 176 | |
| 177 | void TestProjectLoad::addRemoveFiles() |
| 178 | { |
| 179 | const TestProject p = makeProject(); |
| 180 | |
| 181 | createFile(p.dir->path()+"/sdf"); |
| 182 | |
| 183 | ICore::self()->projectController()->openProject(p.file); |
| 184 | QTRY_COMPARE(ICore::self()->projectController()->projects().size(), 1); |
| 185 | IProject* project = ICore::self()->projectController()->projects().first(); |
| 186 | QCOMPARE(project->projectFile().toUrl(), p.file); |
| 187 | |
| 188 | //KDirWatch adds/removes the file automatically |
| 189 | for (int i=0; i<100; ++i) { |
| 190 | createFile(p.dir->path()+"/blub"+QString::number(i)); |
| 191 | } |
| 192 | for (int i=0; i<50; ++i) { |
| 193 | QFile::remove(p.dir->path()+"/blub"+QString::number(i)); |
| 194 | } |
| 195 | QTRY_COMPARE(project->projectItem()->fileList().count(), 51); |
| 196 | |
| 197 | QUrl url = QUrl::fromLocalFile(p.dir->path()+"/blub"+QString::number(50)).adjusted(QUrl::NormalizePathSegments); |
| 198 | QCOMPARE(project->filesForPath(IndexedString(url)).count(), 1); |
| 199 | ProjectFileItem* file = project->filesForPath(IndexedString(url)).at(0); |
| 200 | project->projectFileManager()->removeFilesAndFolders(QList<ProjectBaseItem*>() << file ); //message box has to be accepted manually :( |
| 201 | QTRY_COMPARE(project->projectItem()->fileList().count(), 50); |
| 202 | |
| 203 | for (int i=51; i<100; ++i) { |
| 204 | QFile::remove(p.dir->path()+"/blub"+QString::number(i)); |
| 205 | } |
| 206 | |
| 207 | QTRY_COMPARE(project->projectItem()->fileList().count(), 1); |
| 208 | } |
| 209 | |
| 210 | void TestProjectLoad::removeDirRecursive() |
| 211 | { |
nothing calls this directly
no test coverage detected