File indexing completed on 2025-01-05 03:58:11

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 28/08/2021
0007  * Description : an unit-test to detect image quality level
0008  *
0009  * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2021-2022 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "detectcompression_utest.h"
0017 
0018 // Qt includes
0019 
0020 #include <QTest>
0021 #include <QStringList>
0022 #include <QFileInfoList>
0023 #include <QDebug>
0024 #include <QDir>
0025 
0026 // Local includes
0027 
0028 #include "digikam_globals.h"
0029 #include "imagequalitycontainer.h"
0030 #include "dpluginloader.h"
0031 #include "digikam_debug.h"
0032 
0033 using namespace Digikam;
0034 
0035 QTEST_MAIN(ImgQSortTestDetectCompression)
0036 
0037 ImgQSortTestDetectCompression::ImgQSortTestDetectCompression(QObject* const parent)
0038     : ImgQSortTest(parent)
0039 {
0040     m_dataTestCases = dataTestCases;
0041 }
0042 
0043 void ImgQSortTestDetectCompression::testParseTestImagesForCompressionDetection()
0044 {
0045     QHash<QString, bool> results = testParseTestImages(QLatin1String("compressionDetection"),
0046                                                        ImgQSortTest_ParseTestImagesDefautDetection, DETECTCOMPRESSION);
0047 
0048     for (const auto& test_case : results.keys())
0049     {
0050         QVERIFY(results.value(test_case));
0051     }
0052 }
0053 
0054 void ImgQSortTestDetectCompression::testParseTestImagesForCompressionDetection_failCase()
0055 {
0056     QHash<QString, bool> results = testParseTestImages(QLatin1String("compressionDetection_failCase"),
0057                                                        ImgQSortTest_ParseTestImagesDefautDetection, DETECTCOMPRESSION);
0058 
0059     for (const auto& test_case : results.keys())
0060     {
0061         QEXPECT_FAIL("", "Will fix in the next release", Continue);
0062 
0063         QVERIFY(results.value(test_case));
0064     }
0065 }
0066 
0067 #include "moc_detectcompression_utest.cpp"