summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2020-05-06 18:30:43 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2020-08-14 13:17:11 +0200
commitd40f88e8d23f9d5fdb08ff9a394d9697a0d86fc8 (patch)
tree73384e08f6d362bfc7f1da9f5ce2ff0b28641c4e /tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
parent94b7a4f9b8d0746dae54b0a1870f119e8b17830d (diff)
QDecompressHelper: Introduce zstd support
Also take this opportunity to reshuffle the content-encodings in the intended ordering since the ordering is used to signify priority. Task-number: QTBUG-83269 Change-Id: I022eecf1ba03b54dbd9c98a9d63d05fb05fd2124 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp')
-rw-r--r--tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp b/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
index 2641c65497..7a3aa37a47 100644
--- a/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
+++ b/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
@@ -73,9 +73,15 @@ void tst_QDecompressHelper::initTestCase()
{
Q_INIT_RESOURCE(gzip);
Q_INIT_RESOURCE(inflate);
+#if QT_CONFIG(zstd)
+ Q_INIT_RESOURCE(zstandard);
+#endif
}
void tst_QDecompressHelper::cleanupTestCase()
{
+#if QT_CONFIG(zstd)
+ Q_CLEANUP_RESOURCE(zstandard);
+#endif
Q_CLEANUP_RESOURCE(inflate);
Q_CLEANUP_RESOURCE(gzip);
}
@@ -98,6 +104,11 @@ void tst_QDecompressHelper::encodingSupported()
++expected;
#endif
+#if QT_CONFIG(zstd)
+ QVERIFY(QDecompressHelper::isSupportedEncoding("zstd"));
+ QVERIFY(accepted.contains("zstd"));
+ ++expected;
+#endif
QCOMPARE(expected, accepted.size());
}
@@ -129,6 +140,12 @@ void tst_QDecompressHelper::sharedDecompress_data()
<< QByteArray("br") << QByteArray::fromBase64("DwWAaGVsbG8gd29ybGQD")
<< QByteArray("hello world");
#endif
+
+#if QT_CONFIG(zstd)
+ QTest::newRow("zstandard-hello-world")
+ << QByteArray("zstd") << QByteArray::fromBase64("KLUv/QRYWQAAaGVsbG8gd29ybGRoaR6y")
+ << QByteArray("hello world");
+#endif
}
void tst_QDecompressHelper::decompress_data()
@@ -340,6 +357,10 @@ void tst_QDecompressHelper::decompressBigData_data()
#if QT_CONFIG(brotli)
QTest::newRow("brotli-4G") << QByteArray("br") << (srcDir + "/4G.br") << fourGiB;
#endif
+
+#if QT_CONFIG(zstd)
+ QTest::newRow("zstandard-4G") << QByteArray("zstd") << (":/4G.zst") << fourGiB;
+#endif
}
void tst_QDecompressHelper::decompressBigData()