feat(tests): add test for FS::copy with files

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-10-28 20:55:25 -03:00
parent be3c9abcfe
commit 81333515e0
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -183,6 +183,32 @@ slots:
f();
}
void test_copy_single_file()
{
QTemporaryDir tempDir;
tempDir.setAutoRemove(true);
{
QString file = QFINDTESTDATA("testdata/FileSystem/test_folder/pack.mcmeta");
qDebug() << "From:" << file << "To:" << tempDir.path();
QDir target_dir(FS::PathCombine(tempDir.path(), "pack.mcmeta"));
qDebug() << tempDir.path();
qDebug() << target_dir.path();
FS::copy c(file, target_dir.filePath("pack.mcmeta"));
c();
auto filter = QDir::Filter::Files;
for (auto entry: target_dir.entryList(filter)) {
qDebug() << entry;
}
QVERIFY(target_dir.entryList(filter).contains("pack.mcmeta"));
}
}
void test_getDesktop()
{
QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));