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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2015-08-12
0007  * Description : metadata settings tests for getImageRating and setImageRating.
0008  *
0009  * SPDX-FileCopyrightText: 2015 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_COMMENT_READ_WRITE_UTEST_H
0016 #define DIGIKAM_COMMENT_READ_WRITE_UTEST_H
0017 
0018 // Qt includes
0019 
0020 #include <QObject>
0021 #include <QStringList>
0022 
0023 // Local includes
0024 
0025 #include "captionvalues.h"
0026 
0027 class CommentReadWriteTest : public QObject
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032 
0033     explicit CommentReadWriteTest(QObject* const parent = nullptr);
0034 
0035 private Q_SLOTS:
0036 
0037     void initTestCase();
0038     void cleanupTestCase();
0039 
0040     /**
0041      * @brief testSimpleReadAfterWrite - default read and write
0042      * Description:
0043      * Load default values, write then read a set of tags
0044      * Results: Values must match
0045      */
0046     void testSimpleReadAfterWrite();
0047 
0048     /**
0049      * @brief testWriteToDisabledNamespaces - test if implementation
0050      *                                     will not write tags to disabled namespaces
0051      * Description: make a custom settings container with one disabled and one
0052      *     enabled namespace. Call setImageTagPaths. Read the result of both
0053      *     namespaces
0054      * Results: The result of read from disabled namespace should be empty
0055      *          The result of read from other namespace should be initial tag paths
0056      */
0057     void testWriteToDisabledNamespaces();
0058 
0059     /**
0060      * @brief testReadFromDisabledNamespaces - test if disabled namespaces are ignored
0061      * Description: Write tagSet1 to first, disable namespace, write tagSet2 to second
0062      *              enabled namespace
0063      * Results: The call of getImageTagsPaths should return tagSet2
0064      */
0065     void testReadFromDisabledNamespaces();
0066 
0067 private:
0068 
0069     Digikam::CaptionsMap commentSet1;
0070     Digikam::CaptionsMap commentSet2;
0071 };
0072 
0073 #endif // DIGIKAM_COMMENT_READ_WRITE_UTEST_H