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 #ifndef DIGIKAM_DETECT_EXPOSURE_UTEST_H
0017 #define DIGIKAM_DETECT_EXPOSURE_UTEST_H
0018 
0019 // Qt includes
0020 
0021 #include <QObject>
0022 #include <QDir>
0023 #include <QMultiMap>
0024 #include <QString>
0025 
0026 // Local includes
0027 
0028 #include "imgqsorttest_shared.h"
0029 #include "imgqsorttest.h"
0030 
0031 namespace Digikam
0032 {
0033 
0034 class ImgQSortTestDetecteExposure : public ImgQSortTest
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit ImgQSortTestDetecteExposure(QObject* const parent = nullptr);
0041 
0042 private Q_SLOTS:
0043 
0044     void testParseTestImagesForExposureDetection_sun();
0045     void testParseTestImagesForExposureDetection_backlight();
0046     void testParseTestImagesForExposureDetection();
0047 };
0048 
0049 // pair name image - quality expected
0050 using PairImageQuality = QPair<QString, int>;
0051 using DataTestCases    = QMultiMap<QString, PairImageQuality>;
0052 
0053 DataTestCases const dataTestCases =
0054 {
0055     {QLatin1String("exposureBacklight"), PairImageQuality(QLatin1String("exposure_backlight_1.jpg"), 1)},
0056     {QLatin1String("exposureBacklight"), PairImageQuality(QLatin1String("exposure_backlight_2.jpg"), 1)},
0057     {QLatin1String("exposureBacklight"), PairImageQuality(QLatin1String("exposure_backlight_3.jpg"), 1)},
0058 
0059     {QLatin1String("exposureSun"),       PairImageQuality(QLatin1String("exposure_sun_1.jpg"),       2)},
0060     {QLatin1String("exposureSun"),       PairImageQuality(QLatin1String("exposure_sun_2.jpg"),       2)},
0061     {QLatin1String("exposureSun"),       PairImageQuality(QLatin1String("exposure_sun_3.jpg"),       1)},
0062 
0063     {QLatin1String("exposureDetection"), PairImageQuality(QLatin1String("test_overexposed_5.jpg"),   2)},
0064     {QLatin1String("exposureDetection"), PairImageQuality(QLatin1String("test_overexposed_9.jpg"),   1)},
0065     {QLatin1String("exposureDetection"), PairImageQuality(QLatin1String("test_underexposed_1.jpg"),  1)},
0066     {QLatin1String("exposureDetection"), PairImageQuality(QLatin1String("test_underexposed_5.jpg"),  2)},
0067 
0068 };
0069 
0070 } // namespace Digikam
0071 
0072 #endif // DIGIKAM_DETECT_EXPOSURE_UTEST_H