void JobTest::setup() { // Start with a clean base dir cleanup(); QDir dir; // TT: why not a static method? bool ok = dir.mkdir(homeTmpDir()); if(!ok) kdFatal() << "Couldn't create " << homeTmpDir() << endl; ok = dir.mkdir(otherTmpDir()); if(!ok) kdFatal() << "Couldn't create " << otherTmpDir() << endl; ok = dir.mkdir(realSystemPath()); if(!ok) kdFatal() << "Couldn't create " << realSystemPath() << endl; }
void JobTest::moveDirectoryToOtherPartition() { kdDebug() << k_funcinfo << endl; const QString src = homeTmpDir() + "dirFromHome"; const QString dest = otherTmpDir() + "dirFromHome_moved"; createTestDirectory(src); moveLocalDirectory(src, dest); }
void JobTest::moveSymlinkToOtherPartition() { kdDebug() << k_funcinfo << endl; const QString filePath = homeTmpDir() + "testlink"; const QString dest = otherTmpDir() + "testlink_moved"; createTestSymlink(filePath); moveLocalSymlink(filePath, dest); }
void JobTest::moveFileToOtherPartition() { kdDebug() << k_funcinfo << endl; const QString filePath = homeTmpDir() + "fileFromHome"; const QString dest = otherTmpDir() + "fileFromHome_moved"; createTestFile(filePath); moveLocalFile(filePath, dest); }
void pasteFileToOtherPartition() { const QString filePath = homeTmpDir() + "fileFromHome"; const QString dest = otherTmpDir() + "fileFromHome_copied"; QFile::remove(dest); createTestFile( filePath ); QMimeData* mimeData = new QMimeData; KUrl fileUrl(filePath); fileUrl.populateMimeData(mimeData); QApplication::clipboard()->setMimeData(mimeData); KIO::Job* job = KIO::pasteClipboard(otherTmpDir(), static_cast<QWidget*>(0)); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( QFile::exists( filePath ) ); // still there }
void JobTest::copyDirectoryToOtherPartition() { kdDebug() << k_funcinfo << endl; const QString src = homeTmpDir() + "dirFromHome"; const QString dest = otherTmpDir() + "dirFromHome_copied"; // src is already created by copyDirectoryToSamePartition() // so this is just in case someone calls this method only if(!QFile::exists(src)) createTestDirectory(src); copyLocalDirectory(src, dest); }
void cleanupTestCase() { delDir( homeTmpDir() ); delDir( otherTmpDir() ); }
void JobTest::cleanup() { KIO::NetAccess::del(homeTmpDir(), 0); KIO::NetAccess::del(otherTmpDir(), 0); KIO::NetAccess::del(systemTmpDir(), 0); }