From 3e74a8782a1f8b9b16239b436ea74e18c9cb10b3 Mon Sep 17 00:00:00 2001 From: Lieven Hey Date: Fri, 11 Oct 2024 10:35:25 +0200 Subject: [PATCH] feat: move compressed test data to files instead of base64 strings --- tests/integrationtests/archives/test.bz2 | Bin 0 -> 56 bytes tests/integrationtests/archives/test.gz | Bin 0 -> 32 bytes tests/integrationtests/archives/test.txt | 1 + tests/integrationtests/archives/test.xz | Bin 0 -> 76 bytes tests/integrationtests/tst_perfparser.cpp | 24 +++++----------------- 5 files changed, 6 insertions(+), 19 deletions(-) create mode 100644 tests/integrationtests/archives/test.bz2 create mode 100644 tests/integrationtests/archives/test.gz create mode 100644 tests/integrationtests/archives/test.txt create mode 100644 tests/integrationtests/archives/test.xz diff --git a/tests/integrationtests/archives/test.bz2 b/tests/integrationtests/archives/test.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..2df50c49994c34feddb68ce6f6e27989d3231216 GIT binary patch literal 56 zcmZ>Y%CIzaj8qGbyivrc&%nSK-oPN>z`)?Z(7?trfkA;miLLF5!pV-~nJ+ZtyLT$h M(eTKzWSHIn0HP`ocK`qY literal 0 HcmV?d00001 diff --git a/tests/integrationtests/archives/test.gz b/tests/integrationtests/archives/test.gz new file mode 100644 index 0000000000000000000000000000000000000000..b9d794e16e13c36f3decf07b34ceb5b59cdcc4dc GIT binary patch literal 32 jcmb2|=3oE==Fc8yPo50tIIn-o^C1(%sK0|GpXjA9HhP`x2UgOP#TBQ+-{Um-ldC?|!BLFqxM{nfV? Yb_|R("content"); QTest::addColumn("filename"); - QTest::newRow("plain") << QByteArrayLiteral("Hello World\n") << QStringLiteral("XXXXXX"); - QTest::newRow("gzip") << QByteArray::fromBase64( - QByteArrayLiteral("H4sIAAAAAAAAA/NIzcnJVwjPL8pJ4QIA4+WVsAwAAAA=")) - << QStringLiteral("XXXXXX.gz"); - QTest::newRow("bzip2") << QByteArray::fromBase64( - QByteArrayLiteral("QlpoOTFBWSZTWdhyAS8AAAFXgAAQQAAAQACABgSQACAAIgaG1CDJiMdp6Cgfi7kinChIbDkAl4A=")) - << QStringLiteral("XXXXXX.bz2"); - QTest::newRow("xz") << QByteArray::fromBase64(QByteArrayLiteral( - "/Td6WFoAAATm1rRGAgAhARYAAAB0L+WjAQALSGVsbG8gV29ybGQKACLgdT/V7Tg+AAEkDKYY2NgftvN9AQAAAAAEWVo=")) - << QStringLiteral("XXXXXX.xz"); + QTest::newRow("plain") << QFINDTESTDATA("archives/test.txt"); + QTest::newRow("gzip") << QFINDTESTDATA("archives/test.gz"); + QTest::newRow("bzip2") << QFINDTESTDATA("archives/test.bz2"); + QTest::newRow("xz") << QFINDTESTDATA("archives/test.xz"); } void testDecompression() { - QFETCH(QByteArray, content); QFETCH(QString, filename); - QTemporaryFile compressed; - compressed.setFileTemplate(filename); - compressed.open(); - compressed.write(content); - compressed.close(); - PerfParser parser; - QFile decompressed(parser.decompressIfNeeded(compressed.fileName())); + QFile decompressed(parser.decompressIfNeeded(filename)); decompressed.open(QIODevice::ReadOnly); QCOMPARE(decompressed.readAll(), QByteArrayLiteral("Hello World\n"));