Exemple #1
0
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;
}
Exemple #2
0
void JobTest::moveDirectoryToOtherPartition()
{
    kdDebug() << k_funcinfo << endl;
    const QString src = homeTmpDir() + "dirFromHome";
    const QString dest = otherTmpDir() + "dirFromHome_moved";
    createTestDirectory(src);
    moveLocalDirectory(src, dest);
}
Exemple #3
0
void JobTest::moveSymlinkToOtherPartition()
{
    kdDebug() << k_funcinfo << endl;
    const QString filePath = homeTmpDir() + "testlink";
    const QString dest = otherTmpDir() + "testlink_moved";
    createTestSymlink(filePath);
    moveLocalSymlink(filePath, dest);
}
Exemple #4
0
void JobTest::moveFileToOtherPartition()
{
    kdDebug() << k_funcinfo << endl;
    const QString filePath = homeTmpDir() + "fileFromHome";
    const QString dest = otherTmpDir() + "fileFromHome_moved";
    createTestFile(filePath);
    moveLocalFile(filePath, dest);
}
Exemple #5
0
    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
    }
Exemple #6
0
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);
}
Exemple #7
0
 void cleanupTestCase()
 {
     delDir( homeTmpDir() );
     delDir( otherTmpDir() );
 }
Exemple #8
0
void JobTest::cleanup()
{
    KIO::NetAccess::del(homeTmpDir(), 0);
    KIO::NetAccess::del(otherTmpDir(), 0);
    KIO::NetAccess::del(systemTmpDir(), 0);
}