shubham added a comment.

    void JobTest::moveDirectoryToInaccessibleFilesystem()
    {
    #ifdef Q_OS_WIN
        QSKIP("Skipping unaccessible folder test on Windows, cannot remove all 
permissions from a folder");
    #endif
        // Given a directory that cannot be moved to destination beacause 
filesystem is write protected
        const QString src = homeTmpDir() + "srcdir";
        const QString dest = homeTmpDir() + "destdir";
        //QVERIFY(QDir().mkpath(src));
        QVERIFY(QFileInfo(src).isDir());
        QVERIFY(QFile(dest).setPermissions(QFile::Permissions())); // Make it 
inaccessible
    
        KIO::CopyJob *job = KIO::move(QUrl::fromLocalFile(src), 
QUrl::fromLocalFile(dest), KIO::HideProgressInfo);
        job->setUiDelegate(nullptr);
        job->setUiDelegateExtension(nullptr);
    
        // The job should fail with "access denied"
        QVERIFY(!job->exec());
        QCOMPARE(job->error(), (int)KIO::ERR_CANNOT_WRITE);
    
        QVERIFY(QFile::exists(dest));
    
        // Cleanup
        QVERIFY(!QFile::exists(src));
    }

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D17545

To: shubham, #frameworks, dfaure
Cc: davidedmundson, ngraham, broulik, kde-frameworks-devel, michaelh, bruns

Reply via email to