Unify test factory methods and add Wii support
This commit is contained in:
parent
b58561eb78
commit
588d03ad8f
@ -1,18 +0,0 @@
|
||||
#ifndef ZONEFILE_FACTORY_H
|
||||
#define ZONEFILE_FACTORY_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <memory>
|
||||
|
||||
class ZoneFile;
|
||||
|
||||
class ZoneFileFactory {
|
||||
public:
|
||||
static std::shared_ptr<ZoneFile> Create(const QByteArray& data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_FACTORY_H
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD10_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,24 +31,18 @@ void AutoTest_COD10_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod10_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod10_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod10_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod10_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod10_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -58,10 +56,10 @@ void AutoTest_COD10_360::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod10_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod10_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -72,24 +70,18 @@ void AutoTest_COD10_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod10_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod10_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod10_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod10_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod10_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -119,6 +111,36 @@ void AutoTest_COD10_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD10";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD11_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,24 +31,18 @@ void AutoTest_COD11_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod11_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod11_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod11_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod11_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod11_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -58,10 +56,10 @@ void AutoTest_COD11_360::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod11_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod11_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -72,24 +70,18 @@ void AutoTest_COD11_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod11_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod11_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod11_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod11_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod11_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -119,6 +111,36 @@ void AutoTest_COD11_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD11";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD11_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD12_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,28 +31,22 @@ void AutoTest_COD12_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod12_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod12_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod12_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod12_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
bool fastFileOpened = testFastFile.open(QIODevice::ReadOnly);
|
||||
if (!fastFileOpened) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(fastFileOpened,
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod12_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -66,10 +64,10 @@ void AutoTest_COD12_360::testDecompression() {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(sizeMatches,
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod12_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod12_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -84,24 +82,18 @@ void AutoTest_COD12_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod12_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod12_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod12_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod12_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod12_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -131,6 +123,36 @@ void AutoTest_COD12_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD12";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD12_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ class AutoTest_COD2_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
@ -32,28 +32,22 @@ void AutoTest_COD2_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod2_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod2_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod2_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod2_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
bool fastFileOpened = testFastFile.open(QIODevice::ReadOnly);
|
||||
if (!fastFileOpened) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(fastFileOpened
|
||||
, qPrintable("Failed to open test fastfile: " + fastFilePath_cod2_360));
|
||||
, qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -68,10 +62,10 @@ void AutoTest_COD2_360::testDecompression() {
|
||||
zoneStream >> zoneSize;
|
||||
// TODO: Find new way to verify as cod2 doesn't store size in zone file
|
||||
//QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
// qPrintable("Decompression validation failed for: " + fastFilePath_cod2_360));
|
||||
// qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod2_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -88,31 +82,24 @@ void AutoTest_COD2_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod2_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
break;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod2_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
const QString testName = "Compress: " + zoneFilePath_cod2_360;
|
||||
const QString testName = "Compress: " + zoneFilePath;
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod2_360);
|
||||
QFile zoneFile(zoneFilePath);
|
||||
bool zoneFileOpened = zoneFile.open(QIODevice::ReadOnly);
|
||||
if (!zoneFileOpened) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(zoneFileOpened, qPrintable("Failed to open zone file: " + zoneFilePath_cod2_360));
|
||||
QVERIFY2(zoneFileOpened, qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod2_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -126,10 +113,7 @@ void AutoTest_COD2_360::testCompression() {
|
||||
|
||||
QByteArray header = originalFFData.left(20);
|
||||
|
||||
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
|
||||
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
|
||||
|
||||
QByteArray recompressedData = header + newCompressedData;
|
||||
QByteArray recompressedData = header + Compression::CompressZLIB(decompressedData);
|
||||
|
||||
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
|
||||
QFile recompressedFile(recompressedFilePath);
|
||||
@ -151,46 +135,31 @@ void AutoTest_COD2_360::testCompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testFactory_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod2_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath_cod2_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Create w/ factory: " + fastFilePath_cod2_360;
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod2_360);
|
||||
bool fastFileOpened = testFastFile.open(QIODevice::ReadOnly);
|
||||
if (!fastFileOpened) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(fastFileOpened
|
||||
, qPrintable("Failed to open test fastfile: " + fastFilePath_cod2_360));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(testFFData);
|
||||
|
||||
bool correctPlatform = fastFile->GetPlatform() == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory created fastfile for platform: " + fastFile->GetPlatform()));
|
||||
|
||||
bool correctGame = fastFile->GetGame() == "COD2";
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD2";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory created fastfile for game: " + fastFile->GetGame()));
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD4_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,24 +31,18 @@ void AutoTest_COD4_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod4_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod4_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod4_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod4_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod4_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -66,10 +64,10 @@ void AutoTest_COD4_360::testDecompression() {
|
||||
qDebug() << "Test zone Size: " << testZoneData.size();
|
||||
}
|
||||
QVERIFY2(abs(zoneSize - testZoneData.size()) == 36,
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod4_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod4_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -80,24 +78,18 @@ void AutoTest_COD4_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod4_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod4_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod4_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod4_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod4_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -121,6 +113,36 @@ void AutoTest_COD4_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD4";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ class AutoTest_COD5_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
@ -32,29 +32,18 @@ void AutoTest_COD5_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod5_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
int ffCount = 0;
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
ffCount++;
|
||||
|
||||
if (ffCount == FILE_MAX) { break; }
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod5_360);
|
||||
return;
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod5_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod5_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod5_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -73,10 +62,10 @@ void AutoTest_COD5_360::testDecompression() {
|
||||
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
|
||||
}
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod5_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod5_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -87,28 +76,18 @@ void AutoTest_COD5_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod5_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
int zoneCount = 0;
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
zoneCount++;
|
||||
|
||||
if (zoneCount == FILE_MAX) { break; }
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod5_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod5_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod5_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod5_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -139,39 +118,31 @@ void AutoTest_COD5_360::testCompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testFactory_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod5_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
int ffCount = 0;
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
ffCount++;
|
||||
|
||||
if (ffCount == FILE_MAX) { break; }
|
||||
}
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath_cod5_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Create w/ factory: " + fastFilePath_cod5_360;
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath_cod5_360);
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
bool correctPlatform = fastFile->GetPlatform() == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory created fastfile for platform: " + fastFile->GetPlatform()));
|
||||
|
||||
bool correctGame = fastFile->GetGame() == "COD5";
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD5";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory created fastfile for game: " + fastFile->GetGame()));
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD6_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,24 +31,18 @@ void AutoTest_COD6_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod6_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod6_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod6_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod6_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod6_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -82,10 +80,10 @@ void AutoTest_COD6_360::testDecompression() {
|
||||
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
|
||||
}
|
||||
QVERIFY2(zoneSize + 32 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod6_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod6_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -96,24 +94,18 @@ void AutoTest_COD6_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod6_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod6_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod6_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod6_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod6_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -144,6 +136,36 @@ void AutoTest_COD6_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD6";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD6_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -13,12 +13,16 @@ class AutoTest_COD7_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -28,24 +32,18 @@ void AutoTest_COD7_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod7_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod7_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod7_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod7_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod7_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -120,10 +118,10 @@ void AutoTest_COD7_360::testDecompression() {
|
||||
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
|
||||
}
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod7_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod7_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -134,51 +132,115 @@ void AutoTest_COD7_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod7_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod7_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod7_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod7_360));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
const QString testName = "Compress: " + zoneFilePath;
|
||||
|
||||
// Open the original .zone file (decompressed zone data).
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
const QByteArray zoneData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod7_360);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
QByteArray compressedData;
|
||||
QByteArray key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
QVERIFY2(originalFile.open(QIODevice::ReadOnly), qPrintable("Failed to open original .ff file: " + originalFFPath));
|
||||
QByteArray originalFFData = originalFile.readAll();
|
||||
originalFile.close();
|
||||
// Read the original fastfile header to recover metadata (filename, IV table, etc.)
|
||||
QString ffPath = zoneFilePath;
|
||||
ffPath.replace(".zone", ".ff");
|
||||
QFile originalFF(ffPath);
|
||||
QVERIFY2(originalFF.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open original fastfile: " + ffPath));
|
||||
QByteArray header = originalFF.read(0x13C); // Everything up to section data
|
||||
originalFF.seek(24); // IV Table starts at 24 (after magic + skip + filename)
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
originalFF.read(fileName.data(), 32);
|
||||
originalFF.close();
|
||||
|
||||
QByteArray header = originalFFData.left(12);
|
||||
QByteArray ivTable = Encryption::InitIVTable(fileName);
|
||||
|
||||
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
|
||||
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
|
||||
// Rebuild sections from zone data
|
||||
QDataStream zoneStream(zoneData);
|
||||
zoneStream.setByteOrder(QDataStream::BigEndian);
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
|
||||
int remainder = (newCompressedData.size() + 12) % 32;
|
||||
if (remainder != 0) {
|
||||
int paddingNeeded = 32 - remainder;
|
||||
newCompressedData.append(QByteArray(paddingNeeded, '\0'));
|
||||
QByteArray remainingData = zoneData.mid(4); // exclude size field
|
||||
const int chunkSize = 0x40000; // 256KB max section size
|
||||
|
||||
QDataStream fastFileStreamOut(&compressedData, QIODevice::WriteOnly);
|
||||
fastFileStreamOut.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
int sectionIndex = 0;
|
||||
int offset = 0;
|
||||
while (offset < remainingData.size()) {
|
||||
int sectionLen = qMin(chunkSize, remainingData.size() - offset);
|
||||
QByteArray chunk = remainingData.mid(offset, sectionLen);
|
||||
|
||||
QByteArray deflated = Compression::CompressDeflate(chunk);
|
||||
|
||||
QByteArray iv = Encryption::GetIV(ivTable, sectionIndex);
|
||||
QByteArray encrypted = Encryption::salsa20DecryptSection(deflated, key, iv);
|
||||
QByteArray sha1 = QCryptographicHash::hash(chunk, QCryptographicHash::Sha1);
|
||||
Encryption::UpdateIVTable(ivTable, sectionIndex, sha1);
|
||||
|
||||
fastFileStreamOut << static_cast<qint32>(encrypted.size());
|
||||
fastFileStreamOut.writeRawData(encrypted.constData(), encrypted.size());
|
||||
|
||||
offset += sectionLen;
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
QByteArray recompressedData = header + newCompressedData;
|
||||
// Write 0 section size terminator
|
||||
fastFileStreamOut << static_cast<qint32>(0);
|
||||
|
||||
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
|
||||
QFile recompressedFile(recompressedFilePath);
|
||||
QVERIFY2(recompressedFile.open(QIODevice::WriteOnly), qPrintable("Failed to write recompressed file."));
|
||||
recompressedFile.write(recompressedData);
|
||||
recompressedFile.close();
|
||||
// Combine with header
|
||||
QByteArray fullFastFile = header + compressedData;
|
||||
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
// Save re-encoded fastfile
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + "_recompressed.ff";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
QVERIFY2(outputFile.open(QIODevice::WriteOnly),
|
||||
qPrintable("Failed to open output file for writing: " + outputFilePath));
|
||||
outputFile.write(fullFastFile);
|
||||
outputFile.close();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD7";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_360::cleanupTestCase() {
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD8_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,32 +31,21 @@ void AutoTest_COD8_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod8_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
break;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod8_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod8_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod8_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod8_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
//const QByteArray testData = Compression::CompressXMem("Hello World!");
|
||||
//const QByteArray testOutData = Compression::DecompressXMem(testData);
|
||||
//qDebug() << "Input: Hello World! - Output: " << testData.toHex() << " - New: " << testOutData;
|
||||
|
||||
QByteArray pattern;
|
||||
pattern.append(static_cast<unsigned char>(0xFF));
|
||||
|
||||
@ -82,10 +75,10 @@ void AutoTest_COD8_360::testDecompression() {
|
||||
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
|
||||
}
|
||||
//QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
// qPrintable("Decompression validation failed for: " + fastFilePath_cod8_360));
|
||||
// qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod8_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -96,25 +89,18 @@ void AutoTest_COD8_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod8_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
break;
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod8_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod8_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod8_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod8_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -144,6 +130,36 @@ void AutoTest_COD8_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD8";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD9_360 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,24 +31,18 @@ void AutoTest_COD9_360::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod9_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod9_360);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath_cod9_360;
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod9_360);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod9_360));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -58,10 +56,10 @@ void AutoTest_COD9_360::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod9_360));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod9_360);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -72,24 +70,18 @@ void AutoTest_COD9_360::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod9_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod9_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod9_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod9_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod9_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -119,6 +111,36 @@ void AutoTest_COD9_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD9";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD10_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,23 +31,16 @@ void AutoTest_COD10_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod10_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
|
||||
void AutoTest_COD10_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod10_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod10_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod10_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -57,10 +54,10 @@ void AutoTest_COD10_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod10_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod10_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -71,24 +68,18 @@ void AutoTest_COD10_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod10_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod10_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod10_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod10_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod10_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -116,6 +107,36 @@ void AutoTest_COD10_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD10";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD11_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,23 +31,16 @@ void AutoTest_COD11_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod11_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
|
||||
void AutoTest_COD11_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod11_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod11_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod11_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -57,10 +54,10 @@ void AutoTest_COD11_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod11_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod11_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -71,24 +68,18 @@ void AutoTest_COD11_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod11_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod11_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod11_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod11_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod11_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -116,6 +107,36 @@ void AutoTest_COD11_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD11";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD12_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,23 +31,16 @@ void AutoTest_COD12_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod12_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
|
||||
void AutoTest_COD12_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod12_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod12_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod12_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -57,10 +54,10 @@ void AutoTest_COD12_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod12_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod12_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -71,24 +68,18 @@ void AutoTest_COD12_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod12_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod12_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod12_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod12_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod12_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -116,6 +107,36 @@ void AutoTest_COD12_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD12";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -13,12 +13,16 @@ class AutoTest_COD4_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -28,22 +32,16 @@ void AutoTest_COD4_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod4_pc");
|
||||
|
||||
QStringList fastFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : fastFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod4_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod4_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod4_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -57,10 +55,10 @@ void AutoTest_COD4_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod4_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod4_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -71,24 +69,18 @@ void AutoTest_COD4_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod4_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod4_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod4_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod4_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod4_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -112,6 +104,36 @@ void AutoTest_COD4_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD4";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD5_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD5_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod5_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod5_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod5_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod5_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD5_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod5_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod5_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD5_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod5_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod5_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod5_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod5_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod5_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -116,6 +108,36 @@ void AutoTest_COD5_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath, true);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD5";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD6_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD6_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod6_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod6_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod6_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod6_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD6_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 40 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod6_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod6_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD6_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod6_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod6_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod6_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod6_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod6_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -108,6 +100,36 @@ void AutoTest_COD6_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD6";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD7_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD7_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod7_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod7_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod7_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod7_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD7_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod7_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod7_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD7_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod7_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod7_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod7_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod7_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod7_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -115,6 +107,36 @@ void AutoTest_COD7_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD7";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD8_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,23 +31,16 @@ void AutoTest_COD8_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod8_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
|
||||
void AutoTest_COD8_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod8_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod8_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod8_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -57,10 +54,10 @@ void AutoTest_COD8_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod8_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod8_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -71,24 +68,18 @@ void AutoTest_COD8_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod8_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod8_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod8_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod8_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod8_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -116,6 +107,36 @@ void AutoTest_COD8_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD8";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD9_PC : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,23 +31,16 @@ void AutoTest_COD9_PC::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PC::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod9_pc");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
|
||||
void AutoTest_COD9_PC::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod9_pc);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod9_pc);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod9_pc));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -57,10 +54,10 @@ void AutoTest_COD9_PC::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod9_pc));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod9_pc);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -71,24 +68,18 @@ void AutoTest_COD9_PC::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PC::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod9_pc");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PC::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod9_pc);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod9_pc);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod9_pc));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod9_pc);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -116,6 +107,36 @@ void AutoTest_COD9_PC::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PC::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PC::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD9";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PC";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PC::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD10_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD10_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod10_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod10_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod10_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod10_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD10_PS3::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod10_ps3));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod10_ps3);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD10_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod10_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod10_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod10_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod10_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod10_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD10_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD10";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD11_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD11_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod11_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod11_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod11_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod11_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD11_PS3::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod11_ps3));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod11_ps3);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD11_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod11_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod11_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod11_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod11_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod11_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD11_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD11";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD11_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD12_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,13 +31,7 @@ void AutoTest_COD12_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod12_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::testDecompression() {
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD12_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod12_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod12_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod12_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod12_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod12_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD12_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD12";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD12_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD4_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,67 +31,80 @@ void AutoTest_COD4_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod4_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod4_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod4_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod4_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
|
||||
const QByteArray compressedData = testFFData.mid(12);
|
||||
const QByteArray testZoneData = Compression::DecompressDeflate(compressedData);
|
||||
// Validate header
|
||||
QVERIFY2(testFFData.size() > 12, "FastFile too small to contain header");
|
||||
QByteArray header = testFFData.left(8);
|
||||
QVERIFY2(header == "IWffu100", "Invalid FastFile header!");
|
||||
|
||||
// Verify the decompressed data via its embedded zone size.
|
||||
QDataStream zoneStream(testZoneData);
|
||||
zoneStream.setByteOrder(QDataStream::LittleEndian);
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
//QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
// qPrintable("Decompression validation failed for: " + fastFilePath_cod4_ps3));
|
||||
QDataStream headerStream(testFFData.mid(8, 6));
|
||||
headerStream.setByteOrder(QDataStream::BigEndian);
|
||||
qint32 version;
|
||||
qint16 identifier;
|
||||
headerStream >> version >> identifier;
|
||||
QVERIFY2(version == 1, "Unsupported game version");
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod4_ps3);
|
||||
QByteArray decompressed;
|
||||
int pos = 12;
|
||||
|
||||
// Loop until EOF or invalid chunk
|
||||
while (pos <= testFFData.size()) {
|
||||
// Read 2-byte BIG-ENDIAN chunk size
|
||||
quint16 chunkSize;
|
||||
QDataStream chunkStream(testFFData.mid(pos, 2));
|
||||
chunkStream.setByteOrder(QDataStream::BigEndian);
|
||||
chunkStream >> chunkSize;
|
||||
|
||||
pos += 2;
|
||||
|
||||
if (chunkSize == 0 || pos + chunkSize > testFFData.size()) {
|
||||
qWarning() << "Invalid or incomplete chunk detected, stopping.";
|
||||
break;
|
||||
}
|
||||
|
||||
const QByteArray compressedChunk = testFFData.mid(pos, chunkSize);
|
||||
|
||||
decompressed.append(Compression::DecompressDeflate(compressedChunk));
|
||||
|
||||
pos += chunkSize;
|
||||
}
|
||||
|
||||
// Write decompressed .zone file
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
QVERIFY2(outputFile.open(QIODevice::WriteOnly),
|
||||
qPrintable("Failed to open output file for writing: " + outputFilePath));
|
||||
outputFile.write(testZoneData);
|
||||
outputFile.write(decompressed);
|
||||
outputFile.close();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod4_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
void AutoTest_COD4_PS3::testCompression_data() {
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod4_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod4_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod4_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod4_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -96,26 +113,71 @@ void AutoTest_COD4_PS3::testCompression() {
|
||||
originalFile.close();
|
||||
|
||||
QByteArray header = originalFFData.left(12);
|
||||
QByteArray recompressedData = header;
|
||||
|
||||
QByteArray newCompressedData = Compression::CompressDeflateWithSettings(decompressedData, Z_BEST_COMPRESSION);
|
||||
// Split decompressed data into chunks (optional: same size as original or fixed 0x4000)
|
||||
const int chunkSize = 0x4000;
|
||||
int offset = 0;
|
||||
|
||||
int remainder = (newCompressedData.size() + 12) % 32;
|
||||
if (remainder != 0) {
|
||||
int paddingNeeded = 32 - remainder;
|
||||
newCompressedData.append(QByteArray(paddingNeeded, '\0'));
|
||||
while (offset < decompressedData.size()) {
|
||||
QByteArray chunk = decompressedData.mid(offset, chunkSize);
|
||||
offset += chunk.size();
|
||||
|
||||
QByteArray compressedChunk = Compression::CompressDeflate(chunk);
|
||||
quint16 length = static_cast<quint16>(compressedChunk.size());
|
||||
|
||||
// Write 2-byte big-endian chunk size
|
||||
recompressedData.append(static_cast<char>((length >> 8) & 0xFF));
|
||||
recompressedData.append(static_cast<char>(length & 0xFF));
|
||||
|
||||
// Write compressed chunk
|
||||
recompressedData.append(compressedChunk);
|
||||
}
|
||||
|
||||
QByteArray recompressedData = header + newCompressedData;
|
||||
// No terminator chunk needed if original didn't have one
|
||||
|
||||
// Save new file
|
||||
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
|
||||
QFile recompressedFile(recompressedFilePath);
|
||||
QVERIFY2(recompressedFile.open(QIODevice::WriteOnly), qPrintable("Failed to write recompressed file."));
|
||||
recompressedFile.write(recompressedData);
|
||||
recompressedFile.close();
|
||||
|
||||
// Validate byte-for-byte match
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
|
||||
void AutoTest_COD4_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD4";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD5_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,72 +31,79 @@ void AutoTest_COD5_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod5_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod5_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod5_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod5_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
|
||||
const QByteArray compressedData = testFFData.mid(12);
|
||||
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
|
||||
// Validate header
|
||||
QVERIFY2(testFFData.size() > 12, "FastFile too small to contain header");
|
||||
QByteArray header = testFFData.left(8);
|
||||
QVERIFY2(header == "IWffu100", "Invalid FastFile header!");
|
||||
|
||||
// Verify the decompressed data via its embedded zone size.
|
||||
QDataStream zoneStream(testZoneData);
|
||||
zoneStream.setByteOrder(QDataStream::LittleEndian);
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
if (abs(zoneSize - testZoneData.size()) != 36) {
|
||||
qDebug() << "Zone Size: " << zoneSize;
|
||||
qDebug() << "Test zone Size: " << testZoneData.size();
|
||||
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
|
||||
QDataStream headerStream(testFFData.mid(8, 6));
|
||||
headerStream.setByteOrder(QDataStream::BigEndian);
|
||||
qint32 version;
|
||||
qint16 identifier;
|
||||
headerStream >> version >> identifier;
|
||||
QVERIFY2(version == 387, "Unsupported game version");
|
||||
|
||||
QByteArray decompressed;
|
||||
int pos = 12;
|
||||
|
||||
// Loop until EOF or invalid chunk
|
||||
while (pos <= testFFData.size()) {
|
||||
// Read 2-byte BIG-ENDIAN chunk size
|
||||
quint16 chunkSize;
|
||||
QDataStream chunkStream(testFFData.mid(pos, 2));
|
||||
chunkStream.setByteOrder(QDataStream::BigEndian);
|
||||
chunkStream >> chunkSize;
|
||||
|
||||
pos += 2;
|
||||
|
||||
if (chunkSize == 0 || pos + chunkSize > testFFData.size()) {
|
||||
qWarning() << "Invalid or incomplete chunk detected, stopping.";
|
||||
break;
|
||||
}
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod5_ps3));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod5_ps3);
|
||||
const QByteArray compressedChunk = testFFData.mid(pos, chunkSize);
|
||||
|
||||
decompressed.append(Compression::DecompressDeflate(compressedChunk));
|
||||
|
||||
pos += chunkSize;
|
||||
}
|
||||
|
||||
// Write decompressed .zone file
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
QVERIFY2(outputFile.open(QIODevice::WriteOnly),
|
||||
qPrintable("Failed to open output file for writing: " + outputFilePath));
|
||||
outputFile.write(testZoneData);
|
||||
outputFile.write(decompressed);
|
||||
outputFile.close();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod5_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod5_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod5_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod5_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod5_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -101,27 +112,70 @@ void AutoTest_COD5_PS3::testCompression() {
|
||||
originalFile.close();
|
||||
|
||||
QByteArray header = originalFFData.left(12);
|
||||
QByteArray recompressedData = header;
|
||||
|
||||
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
|
||||
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
|
||||
// Split decompressed data into chunks (optional: same size as original or fixed 0x4000)
|
||||
const int chunkSize = 0x4000;
|
||||
int offset = 0;
|
||||
|
||||
int remainder = (newCompressedData.size() + 12) % 32;
|
||||
if (remainder != 0) {
|
||||
int paddingNeeded = 32 - remainder;
|
||||
newCompressedData.append(QByteArray(paddingNeeded, '\0'));
|
||||
while (offset < decompressedData.size()) {
|
||||
QByteArray chunk = decompressedData.mid(offset, chunkSize);
|
||||
offset += chunk.size();
|
||||
|
||||
QByteArray compressedChunk = Compression::CompressDeflate(chunk);
|
||||
quint16 length = static_cast<quint16>(compressedChunk.size());
|
||||
|
||||
// Write 2-byte big-endian chunk size
|
||||
recompressedData.append(static_cast<char>((length >> 8) & 0xFF));
|
||||
recompressedData.append(static_cast<char>(length & 0xFF));
|
||||
|
||||
// Write compressed chunk
|
||||
recompressedData.append(compressedChunk);
|
||||
}
|
||||
|
||||
QByteArray recompressedData = header + newCompressedData;
|
||||
// No terminator chunk needed if original didn't have one
|
||||
|
||||
// Save new file
|
||||
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
|
||||
QFile recompressedFile(recompressedFilePath);
|
||||
QVERIFY2(recompressedFile.open(QIODevice::WriteOnly), qPrintable("Failed to write recompressed file."));
|
||||
recompressedFile.write(recompressedData);
|
||||
recompressedFile.close();
|
||||
|
||||
// Validate byte-for-byte match
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD5";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD5_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD6_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD6_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod6_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod6_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod6_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod6_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD6_PS3::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod6_ps3));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod6_ps3);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD6_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod6_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod6_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod6_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod6_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod6_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD6_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD6";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD6_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "autotest_cod.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
class AutoTest_COD7_PS3 : public AutoTest_COD {
|
||||
Q_OBJECT
|
||||
@ -12,12 +13,16 @@ class AutoTest_COD7_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,39 +32,95 @@ void AutoTest_COD7_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod7_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod7_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Decompress: " + fastFilePath;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod7_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod7_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
|
||||
const QByteArray compressedData = testFFData.mid(12);
|
||||
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
|
||||
QByteArray decompressedData;
|
||||
QByteArray key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(testFFData);
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
fastFileStream.skipRawData(16);
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
QVERIFY2(fileMagic == "PHEEBs71",
|
||||
qPrintable("Invalid fast file magic: " + fileMagic));
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Build the IV table from the fileName.
|
||||
QByteArray ivTable = Encryption::InitIVTable(fileName);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
// Now the stream should be positioned at 0x13C, where sections begin.
|
||||
int sectionIndex = 0;
|
||||
while (true) {
|
||||
qint32 sectionSize = 0;
|
||||
fastFileStream >> sectionSize;
|
||||
if (sectionSize == 0)
|
||||
break;
|
||||
|
||||
// Read the section data.
|
||||
QByteArray sectionData;
|
||||
sectionData.resize(sectionSize);
|
||||
fastFileStream.readRawData(sectionData.data(), sectionSize);
|
||||
|
||||
// Compute the IV for this section.
|
||||
QByteArray iv = Encryption::GetIV(ivTable, sectionIndex);
|
||||
|
||||
// Decrypt the section using Salsa20.
|
||||
QByteArray decData = Encryption::salsa20DecryptSection(sectionData, key, iv);
|
||||
|
||||
// Compute SHA1 hash of the decrypted data.
|
||||
QByteArray sectionHash = QCryptographicHash::hash(decData, QCryptographicHash::Sha1);
|
||||
|
||||
// Update the IV table based on the section hash.
|
||||
Encryption::UpdateIVTable(ivTable, sectionIndex, sectionHash);
|
||||
|
||||
// Build a compressed data buffer by prepending the two-byte zlib header.
|
||||
decompressedData.append(Compression::DecompressDeflate(decData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
const QByteArray testZoneData = decompressedData;
|
||||
|
||||
// Verify the decompressed data via its embedded zone size.
|
||||
QDataStream zoneStream(testZoneData);
|
||||
zoneStream.setByteOrder(QDataStream::LittleEndian);
|
||||
zoneStream.setByteOrder(QDataStream::BigEndian);
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod7_ps3));
|
||||
if (abs(zoneSize - testZoneData.size()) != 36) {
|
||||
qDebug() << "Zone Size: " << zoneSize;
|
||||
qDebug() << "Test zone Size: " << testZoneData.size();
|
||||
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
|
||||
}
|
||||
QVERIFY2(zoneSize + 36 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod7_ps3);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +131,18 @@ void AutoTest_COD7_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod7_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod7_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod7_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod7_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod7_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +172,36 @@ void AutoTest_COD7_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD7";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD8_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD8_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod8_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod8_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod8_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod8_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD8_PS3::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod8_ps3));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod8_ps3);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD8_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod8_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod8_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod8_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod8_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod8_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD8_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD8";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD9_PS3 : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD9_PS3::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod9_ps3");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod9_ps3);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod9_ps3);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod9_ps3));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD9_PS3::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod9_ps3));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod9_ps3);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD9_PS3::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod9_ps3");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod9_ps3);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod9_ps3);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod9_ps3));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod9_ps3);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD9_PS3::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD9";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "PS3";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_PS3::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
147
tests/Wii/autotest_cod4_wii.cpp
Normal file
147
tests/Wii/autotest_cod4_wii.cpp
Normal file
@ -0,0 +1,147 @@
|
||||
#include <QtTest/QtTest>
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "autotest_cod.h"
|
||||
#include "compression.h"
|
||||
|
||||
class AutoTest_COD4_Wii : public AutoTest_COD {
|
||||
Q_OBJECT
|
||||
|
||||
const QString EXPORT_DIR = "./exports/cod7/Wii";
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
void AutoTest_COD4_Wii::initTestCase() {
|
||||
// Ensure the exports directory exists.
|
||||
createDirectory(EXPORT_DIR);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::testDecompression_data() {
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::testDecompression() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
|
||||
const QByteArray compressedData = testFFData.mid(12);
|
||||
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
|
||||
|
||||
// Verify the decompressed data via its embedded zone size.
|
||||
QDataStream zoneStream(testZoneData);
|
||||
zoneStream.setByteOrder(QDataStream::LittleEndian);
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
QVERIFY2(outputFile.open(QIODevice::WriteOnly),
|
||||
qPrintable("Failed to open output file for writing: " + outputFilePath));
|
||||
outputFile.write(testZoneData);
|
||||
outputFile.close();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::testCompression_data() {
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::testCompression() {
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
QVERIFY2(originalFile.open(QIODevice::ReadOnly), qPrintable("Failed to open original .ff file: " + originalFFPath));
|
||||
QByteArray originalFFData = originalFile.readAll();
|
||||
originalFile.close();
|
||||
|
||||
QByteArray header = originalFFData.left(12);
|
||||
|
||||
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
|
||||
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
|
||||
|
||||
int remainder = (newCompressedData.size() + 12) % 32;
|
||||
if (remainder != 0) {
|
||||
int paddingNeeded = 32 - remainder;
|
||||
newCompressedData.append(QByteArray(paddingNeeded, '\0'));
|
||||
}
|
||||
|
||||
QByteArray recompressedData = header + newCompressedData;
|
||||
|
||||
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
|
||||
QFile recompressedFile(recompressedFilePath);
|
||||
QVERIFY2(recompressedFile.open(QIODevice::WriteOnly), qPrintable("Failed to write recompressed file."));
|
||||
recompressedFile.write(recompressedData);
|
||||
recompressedFile.close();
|
||||
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD7";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "Wii";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD4_Wii::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
// Don't generate a main() function
|
||||
#include "AutoTest_COD4_Wii.moc"
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD7_Wii : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD7_Wii::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod7_wii");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod7_wii);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod7_wii);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod7_wii));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD7_Wii::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod7_wii));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod7_wii);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD7_Wii::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod7_wii");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod2_360);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod2_360);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod2_360));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod2_360);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD7_Wii::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD7";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "Wii";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD7_Wii::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
147
tests/Wii/autotest_cod8_wii.cpp
Normal file
147
tests/Wii/autotest_cod8_wii.cpp
Normal file
@ -0,0 +1,147 @@
|
||||
#include <QtTest/QtTest>
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "autotest_cod.h"
|
||||
#include "compression.h"
|
||||
|
||||
class AutoTest_COD8_Wii : public AutoTest_COD {
|
||||
Q_OBJECT
|
||||
|
||||
const QString EXPORT_DIR = "./exports/cod7/Wii";
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
void AutoTest_COD8_Wii::initTestCase() {
|
||||
// Ensure the exports directory exists.
|
||||
createDirectory(EXPORT_DIR);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::testDecompression_data() {
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::testDecompression() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
|
||||
const QByteArray compressedData = testFFData.mid(12);
|
||||
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
|
||||
|
||||
// Verify the decompressed data via its embedded zone size.
|
||||
QDataStream zoneStream(testZoneData);
|
||||
zoneStream.setByteOrder(QDataStream::LittleEndian);
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
QVERIFY2(outputFile.open(QIODevice::WriteOnly),
|
||||
qPrintable("Failed to open output file for writing: " + outputFilePath));
|
||||
outputFile.write(testZoneData);
|
||||
outputFile.close();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::testCompression_data() {
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::testCompression() {
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
QVERIFY2(originalFile.open(QIODevice::ReadOnly), qPrintable("Failed to open original .ff file: " + originalFFPath));
|
||||
QByteArray originalFFData = originalFile.readAll();
|
||||
originalFile.close();
|
||||
|
||||
QByteArray header = originalFFData.left(12);
|
||||
|
||||
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
|
||||
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
|
||||
|
||||
int remainder = (newCompressedData.size() + 12) % 32;
|
||||
if (remainder != 0) {
|
||||
int paddingNeeded = 32 - remainder;
|
||||
newCompressedData.append(QByteArray(paddingNeeded, '\0'));
|
||||
}
|
||||
|
||||
QByteArray recompressedData = header + newCompressedData;
|
||||
|
||||
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
|
||||
QFile recompressedFile(recompressedFilePath);
|
||||
QVERIFY2(recompressedFile.open(QIODevice::WriteOnly), qPrintable("Failed to write recompressed file."));
|
||||
recompressedFile.write(recompressedData);
|
||||
recompressedFile.close();
|
||||
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD7";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "Wii";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD8_Wii::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
// Don't generate a main() function
|
||||
#include "AutoTest_COD8_Wii.moc"
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD10_WiiU : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD10_WiiU::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod10_wiiu");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod10_wiiu);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod10_wiiu);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod10_wiiu));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD10_WiiU::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod10_wiiu));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod10_wiiu);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD10_WiiU::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod10_wiiu");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod10_wiiu);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod10_wiiu);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod10_wiiu));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod10_wiiu);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD10_WiiU::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD10";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "WiiU";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD10_WiiU::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -12,12 +12,16 @@ class AutoTest_COD9_WiiU : public AutoTest_COD {
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
// Data-driven test for decompression
|
||||
|
||||
void testDecompression_data();
|
||||
void testDecompression();
|
||||
// Data-driven test for recompression (compression)
|
||||
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -27,22 +31,16 @@ void AutoTest_COD9_WiiU::initTestCase() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod9_wiiu");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testDecompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::testDecompression() {
|
||||
QFETCH(QString, fastFilePath_cod9_wiiu);
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod9_wiiu);
|
||||
QFile testFastFile(fastFilePath);
|
||||
QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath_cod9_wiiu));
|
||||
qPrintable("Failed to open test fastfile: " + fastFilePath));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
@ -56,10 +54,10 @@ void AutoTest_COD9_WiiU::testDecompression() {
|
||||
quint32 zoneSize;
|
||||
zoneStream >> zoneSize;
|
||||
QVERIFY2(zoneSize + 44 == testZoneData.size(),
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath_cod9_wiiu));
|
||||
qPrintable("Decompression validation failed for: " + fastFilePath));
|
||||
|
||||
// Write the decompressed zone data to the exports folder with a .zone extension.
|
||||
QFileInfo fi(fastFilePath_cod9_wiiu);
|
||||
QFileInfo fi(fastFilePath);
|
||||
QString outputFileName = fi.completeBaseName() + ".zone";
|
||||
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
|
||||
QFile outputFile(outputFilePath);
|
||||
@ -70,24 +68,18 @@ void AutoTest_COD9_WiiU::testDecompression() {
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod9_wiiu");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
AutoTest_COD::testCompression_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::testCompression() {
|
||||
QFETCH(QString, zoneFilePath_cod9_wiiu);
|
||||
QFETCH(QString, zoneFilePath);
|
||||
|
||||
QFile zoneFile(zoneFilePath_cod9_wiiu);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod9_wiiu));
|
||||
QFile zoneFile(zoneFilePath);
|
||||
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath));
|
||||
QByteArray decompressedData = zoneFile.readAll();
|
||||
zoneFile.close();
|
||||
|
||||
QFileInfo fi(zoneFilePath_cod9_wiiu);
|
||||
QFileInfo fi(zoneFilePath);
|
||||
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
|
||||
|
||||
QFile originalFile(originalFFPath);
|
||||
@ -117,6 +109,36 @@ void AutoTest_COD9_WiiU::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::testFactory_data() {
|
||||
AutoTest_COD::testFactory_data();
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::testFactory() {
|
||||
QFETCH(QString, fastFilePath);
|
||||
|
||||
const QString testName = "Factory ingest: " + fastFilePath;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath);
|
||||
|
||||
const QString game = fastFile->GetGame();
|
||||
bool correctGame = game == "COD9";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory parsed wrong game [" + game + "] for fastfile: " + fastFilePath));
|
||||
|
||||
const QString platform = fastFile->GetPlatform();
|
||||
bool correctPlatform = platform == "WiiU";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory parsed wrong platform [" + platform + "] for fastfile: " + fastFilePath));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD9_WiiU::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "fastfile_factory.h"
|
||||
|
||||
#define FILE_MAX 1
|
||||
|
||||
class AutoTest_COD : public QObject {
|
||||
@ -36,41 +38,93 @@ public:
|
||||
QDir newDir(".");
|
||||
newDir.mkpath(aDir);
|
||||
}
|
||||
QStringList findFastFiles(const QString &aBaseDir, int aMaxIter = MAX_ITER) {
|
||||
QStringList fastFiles;
|
||||
|
||||
QDirIterator it(aBaseDir, QStringList() << "*.ff", QDir::Files, QDirIterator::Subdirectories);
|
||||
|
||||
int i = 0;
|
||||
while (it.hasNext() && i < aMaxIter) {
|
||||
fastFiles << it.next();
|
||||
++i;
|
||||
}
|
||||
|
||||
return fastFiles;
|
||||
}
|
||||
QStringList findZoneFiles(const QString &aBaseDir, int aMaxIter = MAX_ITER) {
|
||||
QStringList zoneFiles;
|
||||
QStringList findZoneFiles(const QString &aBaseDir, int aMaxIter = FILE_MAX) {
|
||||
QList<QPair<qint64, QString>> fileList;
|
||||
|
||||
QDirIterator it(aBaseDir, QStringList() << "*.zone", QDir::Files, QDirIterator::Subdirectories);
|
||||
|
||||
int i = 0;
|
||||
while (it.hasNext() && i < aMaxIter) {
|
||||
zoneFiles << it.next();
|
||||
QString path = it.next();
|
||||
QFileInfo fi(path);
|
||||
fileList.append(qMakePair(fi.size(), path));
|
||||
++i;
|
||||
}
|
||||
|
||||
return zoneFiles;
|
||||
std::sort(fileList.begin(), fileList.end(),
|
||||
[](const QPair<qint64, QString> &a, const QPair<qint64, QString> &b) {
|
||||
return a.first < b.first; // sort by size
|
||||
});
|
||||
|
||||
QStringList sorted;
|
||||
for (const auto &pair : fileList)
|
||||
sorted << pair.second;
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
QStringList findFastFiles(const QString &aBaseDir, int aMaxIter = FILE_MAX) {
|
||||
QList<QPair<qint64, QString>> fileList;
|
||||
|
||||
QDirIterator it(aBaseDir, QStringList() << "*.ff", QDir::Files, QDirIterator::Subdirectories);
|
||||
int i = 0;
|
||||
while (it.hasNext() && i < aMaxIter) {
|
||||
QString path = it.next();
|
||||
QFileInfo fi(path);
|
||||
fileList.append(qMakePair(fi.size(), path));
|
||||
++i;
|
||||
}
|
||||
|
||||
std::sort(fileList.begin(), fileList.end(),
|
||||
[](const QPair<qint64, QString> &a, const QPair<qint64, QString> &b) {
|
||||
return a.first < b.first; // sort by size
|
||||
});
|
||||
|
||||
QStringList sorted;
|
||||
for (const auto &pair : fileList)
|
||||
sorted << pair.second;
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
virtual void initTestCase() = 0;
|
||||
virtual void testDecompression_data() = 0;
|
||||
|
||||
void testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
}
|
||||
virtual void testDecompression() = 0;
|
||||
virtual void testCompression_data() = 0;
|
||||
|
||||
void testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
virtual void testCompression() = 0;
|
||||
|
||||
void testFactory_data() {
|
||||
QTest::addColumn<QString>("fastFilePath");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
}
|
||||
virtual void testFactory() = 0;
|
||||
|
||||
virtual void cleanupTestCase() = 0;
|
||||
|
||||
private:
|
||||
static const int MAX_ITER = 10000;
|
||||
QString mFastFileDirectory;
|
||||
QString mZoneFileDirectory;
|
||||
};
|
||||
|
||||
@ -32,7 +32,9 @@
|
||||
#include "PS3/autotest_cod11_ps3.cpp"
|
||||
#include "PS3/autotest_cod12_ps3.cpp"
|
||||
|
||||
#include "Wii/autotest_cod4_wii.cpp"
|
||||
#include "Wii/autotest_cod7_wii.cpp"
|
||||
#include "Wii/autotest_cod8_wii.cpp"
|
||||
|
||||
#include "WiiU/autotest_cod9_wiiu.cpp"
|
||||
#include "WiiU/autotest_cod10_wiiu.cpp"
|
||||
@ -47,10 +49,10 @@
|
||||
// individual games
|
||||
#define TEST_COD2 0
|
||||
#define TEST_COD4 0
|
||||
#define TEST_COD5 1
|
||||
#define TEST_COD5 0
|
||||
#define TEST_COD6 0
|
||||
#define TEST_COD7 0
|
||||
#define TEST_COD8 0
|
||||
#define TEST_COD8 1
|
||||
#define TEST_COD9 0
|
||||
#define TEST_COD10 0
|
||||
#define TEST_COD11 0
|
||||
@ -185,7 +187,7 @@ int main(int argc, char *argv[]) {
|
||||
AutoTest_COD8_PC *test_cod8_pc = new AutoTest_COD8_PC();
|
||||
test_cod8_pc->setFastFileDirectory("G:/Fast Files/PC/COD8");
|
||||
test_cod8_pc->setZoneFileDirectory("./exports/cod8/PC");
|
||||
//cod8Tests << test_cod8_pc;
|
||||
cod8Tests << test_cod8_pc;
|
||||
pcTests << test_cod8_pc;
|
||||
|
||||
AutoTest_COD9_PC *test_cod9_pc = new AutoTest_COD9_PC();
|
||||
@ -225,7 +227,7 @@ int main(int argc, char *argv[]) {
|
||||
AutoTest_COD5_PS3 *test_cod5_ps3 = new AutoTest_COD5_PS3();
|
||||
test_cod5_ps3->setFastFileDirectory("G:/Fast Files/PS3/COD5");
|
||||
test_cod5_ps3->setZoneFileDirectory("./exports/cod5/PS3");
|
||||
//cod5Tests << test_cod5_ps3;
|
||||
cod5Tests << test_cod5_ps3;
|
||||
ps3Tests << test_cod5_ps3;
|
||||
|
||||
AutoTest_COD6_PS3 *test_cod6_ps3 = new AutoTest_COD6_PS3();
|
||||
@ -243,7 +245,7 @@ int main(int argc, char *argv[]) {
|
||||
AutoTest_COD8_PS3 *test_cod8_ps3 = new AutoTest_COD8_PS3();
|
||||
test_cod8_ps3->setFastFileDirectory("G:/Fast Files/PS3/COD8");
|
||||
test_cod8_ps3->setZoneFileDirectory("./exports/cod8/PS3");
|
||||
//cod8Tests << test_cod8_ps3;
|
||||
cod8Tests << test_cod8_ps3;
|
||||
ps3Tests << test_cod8_ps3;
|
||||
|
||||
AutoTest_COD9_PS3 *test_cod9_ps3 = new AutoTest_COD9_PS3();
|
||||
@ -274,12 +276,24 @@ int main(int argc, char *argv[]) {
|
||||
/********* Wii COD TESTS *********/
|
||||
/**********************************/
|
||||
|
||||
AutoTest_COD4_Wii *test_cod4_wii = new AutoTest_COD4_Wii();
|
||||
test_cod4_wii->setFastFileDirectory("G:/Fast Files/Wii/COD4");
|
||||
test_cod4_wii->setZoneFileDirectory("./exports/cod4/Wii");
|
||||
cod4Tests << test_cod4_wii;
|
||||
wiiTests << test_cod4_wii;
|
||||
|
||||
AutoTest_COD7_Wii *test_cod7_wii = new AutoTest_COD7_Wii();
|
||||
test_cod7_wii->setFastFileDirectory("G:/Fast Files/Wii/COD7");
|
||||
test_cod7_wii->setZoneFileDirectory("./exports/cod7/Wii");
|
||||
cod7Tests << test_cod7_wii;
|
||||
wiiTests << test_cod7_wii;
|
||||
|
||||
AutoTest_COD8_Wii *test_cod8_wii = new AutoTest_COD8_Wii();
|
||||
test_cod8_wii->setFastFileDirectory("G:/Fast Files/Wii/COD8");
|
||||
test_cod8_wii->setZoneFileDirectory("./exports/cod8/Wii");
|
||||
cod8Tests << test_cod8_wii;
|
||||
wiiTests << test_cod8_wii;
|
||||
|
||||
/**********************************/
|
||||
/********* WiiU COD TESTS *********/
|
||||
/**********************************/
|
||||
@ -309,87 +323,101 @@ int main(int argc, char *argv[]) {
|
||||
qDebug() << "-- RUNNING TEST_COD4 --";
|
||||
foreach (auto test, cod4Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD5) {
|
||||
qDebug() << "-- RUNNING TEST_COD5 --";
|
||||
foreach (auto test, cod5Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD6) {
|
||||
qDebug() << "-- RUNNING TEST_COD6 --";
|
||||
foreach (auto test, cod6Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD7) {
|
||||
qDebug() << "-- RUNNING TEST_COD7 --";
|
||||
foreach (auto test, cod7Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD8) {
|
||||
qDebug() << "-- RUNNING TEST_COD8 --";
|
||||
foreach (auto test, cod8Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD9) {
|
||||
qDebug() << "-- RUNNING TEST_COD9 --";
|
||||
foreach (auto test, cod9Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD10) {
|
||||
qDebug() << "-- RUNNING TEST_COD10 --";
|
||||
foreach (auto test, cod10Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD11) {
|
||||
qDebug() << "-- RUNNING TEST_COD11 --";
|
||||
foreach (auto test, cod11Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD12) {
|
||||
qDebug() << "-- RUNNING TEST_COD12 --";
|
||||
foreach (auto test, cod12Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
}
|
||||
}
|
||||
|
||||
if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_360) {
|
||||
qDebug() << "-- RUNNING TEST_360 --";
|
||||
foreach (auto test, xbox360Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_PC) {
|
||||
qDebug() << "-- RUNNING TEST_PC --";
|
||||
foreach (auto test, pcTests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_PS3) {
|
||||
qDebug() << "-- RUNNING TEST_PS3 --";
|
||||
foreach (auto test, ps3Tests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_WII) {
|
||||
qDebug() << "-- RUNNING TEST_WII --";
|
||||
foreach (auto test, wiiTests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
}
|
||||
}
|
||||
if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_WIIU) {
|
||||
qDebug() << "-- RUNNING TEST_WIIU --";
|
||||
foreach (auto test, wiiUTests) {
|
||||
QTest::qExec(test, argc, argv);
|
||||
}
|
||||
}
|
||||
// if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_360) {
|
||||
// qDebug() << "-- RUNNING TEST_360 --";
|
||||
// foreach (auto test, xbox360Tests) {
|
||||
// QTest::qExec(test, argc, argv);
|
||||
// allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
// }
|
||||
// }
|
||||
// if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_PC) {
|
||||
// qDebug() << "-- RUNNING TEST_PC --";
|
||||
// foreach (auto test, pcTests) {
|
||||
// QTest::qExec(test, argc, argv);
|
||||
// allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
// }
|
||||
// }
|
||||
// if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_PS3) {
|
||||
// qDebug() << "-- RUNNING TEST_PS3 --";
|
||||
// foreach (auto test, ps3Tests) {
|
||||
// QTest::qExec(test, argc, argv);
|
||||
// allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
// }
|
||||
// }
|
||||
// if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_WII) {
|
||||
// qDebug() << "-- RUNNING TEST_WII --";
|
||||
// foreach (auto test, wiiTests) {
|
||||
// QTest::qExec(test, argc, argv);
|
||||
// allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
// }
|
||||
// }
|
||||
// if (TEST_EVERYTHING || TEST_ALL_PLATFORMS || TEST_WIIU) {
|
||||
// qDebug() << "-- RUNNING TEST_WIIU --";
|
||||
// foreach (auto test, wiiUTests) {
|
||||
// QTest::qExec(test, argc, argv);
|
||||
// allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
|
||||
// }
|
||||
// }
|
||||
|
||||
QJsonObject root;
|
||||
root["project"] = "XPlor";
|
||||
|
||||
@ -43,7 +43,9 @@ SOURCES += \
|
||||
PS3/autotest_cod11_ps3.cpp \
|
||||
PS3/autotest_cod12_ps3.cpp \
|
||||
# Wii autotests
|
||||
Wii/autotest_cod4_wii.cpp \
|
||||
Wii/autotest_cod7_wii.cpp \
|
||||
Wii/autotest_cod8_wii.cpp \
|
||||
# WiiU autotests
|
||||
WiiU/autotest_cod9_wiiu.cpp \
|
||||
WiiU/autotest_cod10_wiiu.cpp \
|
||||
@ -63,13 +65,6 @@ HEADERS += \
|
||||
# SOURCES -= autotest_cod5.cpp
|
||||
# }
|
||||
|
||||
app.depends += \
|
||||
libs/core \
|
||||
libs/compression \
|
||||
libs/encryption \
|
||||
libs/zonefile \
|
||||
libs/fastfile
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/ -lcore -lencryption -lcompression -lfastfile -lzonefile \
|
||||
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64
|
||||
@ -90,8 +85,6 @@ DEPENDPATH += \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
RESOURCES +=
|
||||
|
||||
# Copy DLLs to Debug & Release folder
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user