MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / getFileList

Method getFileList

lib/QuaZip/qztest/testquazip.cpp:61–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void TestQuaZip::getFileList()
62{
63 QFETCH(QString, zipName);
64 QFETCH(QStringList, fileNames);
65 fileNames.sort();
66 QDir curDir;
67 if (curDir.exists(zipName)) {
68 if (!curDir.remove(zipName))
69 QFAIL("Can't remove zip file");
70 }
71 if (!createTestFiles(fileNames)) {
72 QFAIL("Can't create test file");
73 }
74 if (!createTestArchive(zipName, fileNames)) {
75 QFAIL("Can't create test archive");
76 }
77 QuaZip testZip(zipName);
78 QVERIFY(testZip.open(QuaZip::mdUnzip));
79 QVERIFY(testZip.goToFirstFile());
80 QString firstFile = testZip.getCurrentFileName();
81 QStringList fileList = testZip.getFileNameList();
82 fileList.sort();
83 QCOMPARE(fileList, fileNames);
84 QHash<QString, QFileInfo> srcInfo;
85 foreach (QString fileName, fileNames) {
86 srcInfo[fileName] = QFileInfo("tmp/" + fileName);
87 }
88 QList<QuaZipFileInfo> destList = testZip.getFileInfoList();
89 QCOMPARE(destList.size(), srcInfo.size());
90 for (const auto& dest : destList) {
91 QCOMPARE(static_cast<qint64>(dest.uncompressedSize),
92 srcInfo[dest.name].size());
93 }
94 // Now test zip64
95 QList<QuaZipFileInfo64> destList64 = testZip.getFileInfoList64();
96 QCOMPARE(destList64.size(), srcInfo.size());
97 for (const auto& dest : destList64) {
98 QCOMPARE(static_cast<qint64>(dest.uncompressedSize),
99 srcInfo[dest.name].size());
100 }
101 // test that we didn't mess up the current file
102 QCOMPARE(testZip.getCurrentFileName(), firstFile);
103 testZip.close();
104 // clean up
105 removeTestFiles(fileNames);
106 curDir.remove(zipName);
107}
108
109void TestQuaZip::add_data()
110{

Callers

nothing calls this directly

Calls 13

createTestFilesFunction · 0.85
createTestArchiveFunction · 0.85
removeTestFilesFunction · 0.85
existsMethod · 0.80
goToFirstFileMethod · 0.80
getCurrentFileNameMethod · 0.80
getFileNameListMethod · 0.80
getFileInfoListMethod · 0.80
getFileInfoList64Method · 0.80
removeMethod · 0.45
openMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected