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 "detectgeneral_utest.h" 0017 0018 // Qt includes 0019 0020 #include <QTest> 0021 #include <QStringList> 0022 #include <QFileInfoList> 0023 #include <QDebug> 0024 0025 // Local includes 0026 0027 #include "digikam_globals.h" 0028 #include "imagequalitycontainer.h" 0029 #include "dpluginloader.h" 0030 0031 using namespace Digikam; 0032 0033 QTEST_MAIN(ImgQSortTestGeneral) 0034 0035 ImgQSortTestGeneral::ImgQSortTestGeneral(QObject* const) 0036 { 0037 m_dataTestCases = dataTestCases; 0038 } 0039 0040 void ImgQSortTestGeneral::testParseTestImagesForGeneralNormalImage() 0041 { 0042 QHash<QString, bool> results = testParseTestImages(QLatin1String("normalImage"), 0043 ImgQSortTest_ParseTestImagesDefautDetection, DETECTIONGENERAL); 0044 0045 for (const auto& test_case : results.keys()) 0046 { 0047 QVERIFY(results.value(test_case)); 0048 } 0049 } 0050 0051 void ImgQSortTestGeneral::testParseTestImagesForSunImage() 0052 { 0053 CustomDetection customSettings { true, true, true, false, false }; 0054 0055 if (!m_hasExifTool) 0056 { 0057 m_dataTestCases.remove(QLatin1String("sunImage"), 0058 PairImageQuality(QLatin1String("exposure_sun_1.jpg"), 1)); 0059 m_dataTestCases.insert(QLatin1String("sunImage"), 0060 PairImageQuality(QLatin1String("exposure_sun_1.jpg"), 2)); 0061 } 0062 0063 QHash<QString, bool> results = testParseTestImages(QLatin1String("sunImage"), 0064 ImgQSortTest_ParseTestImagesCustomDetection, customSettings); 0065 0066 for (const auto& test_case : results.keys()) 0067 { 0068 QVERIFY(results.value(test_case)); 0069 } 0070 } 0071 0072 void ImgQSortTestGeneral::testParseTestImagesForGeneral_failCase() 0073 { 0074 QHash<QString, bool> results = testParseTestImages(QLatin1String("failCase"), 0075 ImgQSortTest_ParseTestImagesDefautDetection, DETECTIONGENERAL); 0076 0077 for (const auto& test_case : results.keys()) 0078 { 0079 QEXPECT_FAIL("", "Will fix in the next release", Continue); 0080 0081 QVERIFY(results.value(test_case)); 0082 } 0083 } 0084 0085 #include "moc_detectgeneral_utest.cpp"