MCPcopy Create free account
hub / github.com/KDE/kdevelop / addRemoveFiles

Method addRemoveFiles

plugins/genericprojectmanager/tests/test_projectload.cpp:177–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void 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
210void TestProjectLoad::removeDirRecursive()
211{

Callers

nothing calls this directly

Calls 15

makeProjectFunction · 0.85
projectControllerMethod · 0.80
projectsMethod · 0.80
projectFileManagerMethod · 0.80
createFileFunction · 0.70
IndexedStringClass · 0.50
pathMethod · 0.45
openProjectMethod · 0.45
sizeMethod · 0.45
firstMethod · 0.45
toUrlMethod · 0.45
projectFileMethod · 0.45

Tested by

no test coverage detected