File indexing completed on 2024-04-21 03:52:28

0001 /* This file is part of the KDE project
0002    SPDX-FileCopyrightText: 2015 Luiz Romário Santana Rios <luizromario@gmail.com>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KCOMPRESSIONDEVICETEST_H
0008 #define KCOMPRESSIONDEVICETEST_H
0009 
0010 #include <QNetworkAccessManager>
0011 #include <QObject>
0012 #include <memory>
0013 
0014 #include <KCompressionDevice>
0015 #include <KTar>
0016 
0017 class QNetworkReply;
0018 
0019 class KCompressionDeviceTest : public QObject
0020 {
0021     Q_OBJECT
0022 
0023 private:
0024     QNetworkReply *getArchive(const QString &extension);
0025     QString formatExtension(KCompressionDevice::CompressionType type) const;
0026 
0027     void setDeviceToArchive(QIODevice *d, KCompressionDevice::CompressionType type);
0028 
0029     void testBufferedDevice(KCompressionDevice::CompressionType type);
0030     void testExtraction();
0031 
0032     QNetworkAccessManager qnam;
0033     std::unique_ptr<KCompressionDevice> device;
0034     std::unique_ptr<KTar> archive;
0035 
0036 private Q_SLOTS:
0037     void regularKTarUsage();
0038     void testGZipBufferedDevice();
0039     void testBZip2BufferedDevice();
0040     void testXzBufferedDevice();
0041     void testZstdBufferedDevice();
0042 
0043     void testWriteErrorOnOpen();
0044     void testWriteErrorOnClose();
0045 
0046     void testSeekReadUncompressedBuffer_data();
0047     void testSeekReadUncompressedBuffer();
0048 };
0049 
0050 #endif