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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-06-21
0007  * Description : unit test to switch digiKam database from sqlite to mysql
0008  *
0009  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DATABASE_SWITCH_UTEST_H
0016 #define DIGIKAM_DATABASE_SWITCH_UTEST_H
0017 
0018 // Qt includes
0019 
0020 #include <QTest>
0021 #include <QDir>
0022 #include <QString>
0023 
0024 class DatabaseSwitchTest : public QObject
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029 
0030     explicit DatabaseSwitchTest(QObject* const parent = nullptr)
0031         : QObject(parent)
0032     {
0033     }
0034 
0035 private Q_SLOTS:
0036 
0037     void testFromSqliteToMysql();
0038     void testFromMysqlToSqlite();
0039 
0040     void initTestCase();
0041     void cleanupTestCase();
0042 
0043 private:
0044 
0045     void startStopSqlite(const QDir& dbDir);
0046     void startStopMysql(const QDir& dbDir);
0047 
0048 private:
0049 
0050     QString m_filesPath;              ///< Path to images to import in database.
0051     QString m_sqlitePath;             ///< Path to sqlite database files.
0052     QString m_db1Path;                ///< Temporary path to original database files.
0053     QDir    m_db1Dir;                 ///< Same that previous as QDir object.
0054     QString m_db2Path;                ///< Temporary path to target database files.
0055     QDir    m_db2Dir;                 ///< Same that previous as QDir object.
0056 };
0057 
0058 #endif // DIGIKAM_DATABASE_SWITCH_UTEST_H