Changeset View
Changeset View
Standalone View
Standalone View
autotests/jobtest.cpp
Show First 20 Lines • Show All 1726 Lines • ▼ Show 20 Line(s) | 1686 | { | |||
---|---|---|---|---|---|
1727 | } else { | 1727 | } else { | ||
1728 | QFile::remove(file1); | 1728 | QFile::remove(file1); | ||
1729 | QFile::remove(file2); | 1729 | QFile::remove(file2); | ||
1730 | QFile::remove(file3); | 1730 | QFile::remove(file3); | ||
1731 | QFile::remove(file4); | 1731 | QFile::remove(file4); | ||
1732 | } | 1732 | } | ||
1733 | } | 1733 | } | ||
1734 | 1734 | | |||
1735 | void JobTest::copyDirectoryAlreadyExistsSkip() | ||||
1736 | { | ||||
1737 | // when copying a directory (which contains at least one file) to some location, and then | ||||
1738 | // copying the same dir to the same location again, and clicking "Skip" there should be no | ||||
1739 | // segmentation fault, bug 408350 | ||||
1740 | | ||||
1741 | const QString src = homeTmpDir() + "a"; | ||||
1742 | createTestDirectory(src); | ||||
1743 | const QString dest = homeTmpDir() + "dest"; | ||||
1744 | createTestDirectory(dest); | ||||
1745 | | ||||
1746 | QUrl u = QUrl::fromLocalFile(src); | ||||
1747 | QUrl d = QUrl::fromLocalFile(dest); | ||||
1748 | | ||||
1749 | KIO::Job *job = KIO::copy(u, d, KIO::HideProgressInfo); | ||||
1750 | job->setUiDelegate(nullptr); | ||||
1751 | QVERIFY(job->exec()); | ||||
1752 | QVERIFY(QFile::exists(dest + QStringLiteral("/a/testfile"))); | ||||
1753 | | ||||
1754 | job = KIO::copy(u, d, KIO::HideProgressInfo); | ||||
1755 | // Simulate the user pressing "Skip" in the dialog. | ||||
1756 | PredefinedAnswerJobUiDelegate extension; | ||||
1757 | extension.m_skipResult = KIO::S_SKIP; | ||||
1758 | job->setUiDelegateExtension(&extension); | ||||
1759 | QVERIFY(job->exec()); | ||||
1760 | QVERIFY(QFile::exists(dest + QStringLiteral("/a/testfile"))); | ||||
1761 | | ||||
1762 | QDir(src).removeRecursively(); | ||||
1763 | QDir(dest).removeRecursively(); | ||||
1764 | } | ||||
1765 | | ||||
1735 | void JobTest::safeOverwrite_data() | 1766 | void JobTest::safeOverwrite_data() | ||
1736 | { | 1767 | { | ||
1737 | QTest::addColumn<bool>("destFileExists"); | 1768 | QTest::addColumn<bool>("destFileExists"); | ||
1738 | 1769 | | |||
1739 | QTest::newRow("dest file exists") << true; | 1770 | QTest::newRow("dest file exists") << true; | ||
1740 | QTest::newRow("dest file doesn't exist") << false; | 1771 | QTest::newRow("dest file doesn't exist") << false; | ||
1741 | } | 1772 | } | ||
1742 | 1773 | | |||
▲ Show 20 Lines • Show All 379 Lines • Show Last 20 Lines |