From 79745eede9816f29323f2e04daa93331c3663eed Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Tue, 26 May 2015 08:31:11 +0200 Subject: [PATCH] Add more autotest --- CMakeLists.txt | 7 ++- autotests/CMakeLists.txt | 8 --- migration/autotests/CMakeLists.txt | 19 ++++++ .../autotests}/kmmigratekmail4configtest.cpp | 2 +- .../autotests}/kmmigratekmail4configtest.h | 0 migration/autotests/migrateinfotest.cpp | 31 ++++++++++ migration/autotests/migrateinfotest.h | 31 ++++++++++ migration/kmmigratekmail4config.h | 13 +---- migration/migrateinfo.cpp | 58 +++++++++++++++++++ migration/migrateinfo.h | 43 ++++++++++++++ 10 files changed, 190 insertions(+), 22 deletions(-) create mode 100644 migration/autotests/CMakeLists.txt rename {autotests => migration/autotests}/kmmigratekmail4configtest.cpp (95%) rename {autotests => migration/autotests}/kmmigratekmail4configtest.h (100%) create mode 100644 migration/autotests/migrateinfotest.cpp create mode 100644 migration/autotests/migrateinfotest.h create mode 100644 migration/migrateinfo.cpp create mode 100644 migration/migrateinfo.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a37970f80..2fc05427a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,6 +172,10 @@ if (KDEPIM_BUILD_DESKTOP) tag/tagactionmanager.cpp tag/tagselectdialog.cpp ) + set(kmailprivate_migrate_LIB_SRCS + migration/kmmigratekmail4config.cpp + migration/migrateinfo.cpp + ) set(kmailprivate_LIB_SRCS kmail_debug.cpp kmmainwin.cpp @@ -193,7 +197,7 @@ if (KDEPIM_BUILD_DESKTOP) foldershortcutactionmanager.cpp kmlaunchexternalcomponent.cpp manageshowcollectionproperties.cpp - migration/kmmigratekmail4config.cpp + ${kmailprivate_migrate_LIB_SRCS} ${kmailprivate_attributes_LIB_SRCS} ${kmailprivate_tag_LIB_SRCS} ${kmailprivate_job_LIB_SRCS} @@ -351,6 +355,7 @@ generate_export_header(kmailprivate BASE_NAME kmail) add_subdirectory(mailmerge/autotests/) add_subdirectory(folderarchive/autotests/) add_subdirectory(editor/potentialphishingemail/autotests) + add_subdirectory(migration/autotests/) endif() ########### install files ############### diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index dc22752ca..a65650bdc 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -68,11 +68,3 @@ set(KDEPIMLIBS_RUN_SQLITE_ISOLATED_TESTS TRUE) add_akonadi_isolated_test_advanced( tagselectdialogtest.cpp "../tag/tagselectdialog.cpp;../kmail_debug.cpp" "${KDEPIMLIBS_AKONADI_LIBS};kmailprivate;mailcommon") - -set( kmail_migratekmail4configtest_source kmmigratekmail4configtest.cpp ../migration/kmmigratekmail4config.cpp) -add_executable(migratekmail4configtest ${kmail_migratekmail4configtest_source}) -ecm_mark_as_test(kmail-migratekmail4configtest) -target_link_libraries( migratekmail4configtest Qt5::Test ) - - - diff --git a/migration/autotests/CMakeLists.txt b/migration/autotests/CMakeLists.txt new file mode 100644 index 000000000..8d6dcd9ee --- /dev/null +++ b/migration/autotests/CMakeLists.txt @@ -0,0 +1,19 @@ +set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) +include_directories( + BEFORE + ${CMAKE_SOURCE_DIR}/kmail + ${CMAKE_BINARY_DIR}/kmail +) + +set( kmail_migratekmail4configtest_source kmmigratekmail4configtest.cpp ../kmmigratekmail4config.cpp ../migrateinfo.cpp) +add_executable(migratekmail4configtest ${kmail_migratekmail4configtest_source}) +ecm_mark_as_test(kmail-migratekmail4configtest) +target_link_libraries( migratekmail4configtest Qt5::Test ) + + + +set( kmail_migrateinfotest_source migrateinfotest.cpp ../migrateinfo.cpp) +add_executable(migrateinfotest ${kmail_migrateinfotest_source}) +ecm_mark_as_test(kmail-migrateinfotest) +target_link_libraries( migrateinfotest Qt5::Test ) + diff --git a/autotests/kmmigratekmail4configtest.cpp b/migration/autotests/kmmigratekmail4configtest.cpp similarity index 95% rename from autotests/kmmigratekmail4configtest.cpp rename to migration/autotests/kmmigratekmail4configtest.cpp index 0512dee5c..81200bd15 100644 --- a/autotests/kmmigratekmail4configtest.cpp +++ b/migration/autotests/kmmigratekmail4configtest.cpp @@ -16,7 +16,7 @@ */ #include "kmmigratekmail4configtest.h" -#include "../migration/kmmigratekmail4config.h" +#include "../kmmigratekmail4config.h" #include KMMigrateKMail4ConfigTest::KMMigrateKMail4ConfigTest(QObject *parent) diff --git a/autotests/kmmigratekmail4configtest.h b/migration/autotests/kmmigratekmail4configtest.h similarity index 100% rename from autotests/kmmigratekmail4configtest.h rename to migration/autotests/kmmigratekmail4configtest.h diff --git a/migration/autotests/migrateinfotest.cpp b/migration/autotests/migrateinfotest.cpp new file mode 100644 index 000000000..b0937b16c --- /dev/null +++ b/migration/autotests/migrateinfotest.cpp @@ -0,0 +1,31 @@ +/* + Copyright (c) 2015 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "migrateinfotest.h" +#include + +MigrateInfoTest::MigrateInfoTest(QObject *parent) +{ + +} + +MigrateInfoTest::~MigrateInfoTest() +{ + +} + +QTEST_MAIN(MigrateInfoTest) diff --git a/migration/autotests/migrateinfotest.h b/migration/autotests/migrateinfotest.h new file mode 100644 index 000000000..042468523 --- /dev/null +++ b/migration/autotests/migrateinfotest.h @@ -0,0 +1,31 @@ +/* + Copyright (c) 2015 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MIGRATEINFOTEST_H +#define MIGRATEINFOTEST_H + +#include + +class MigrateInfoTest : public QObject +{ + Q_OBJECT +public: + explicit MigrateInfoTest(QObject *parent = Q_NULLPTR); + ~MigrateInfoTest(); +}; + +#endif // MIGRATEINFOTEST_H diff --git a/migration/kmmigratekmail4config.h b/migration/kmmigratekmail4config.h index 2e0b63022..a7485d394 100644 --- a/migration/kmmigratekmail4config.h +++ b/migration/kmmigratekmail4config.h @@ -20,18 +20,7 @@ #include #include - -struct MigrateInfo -{ - MigrateInfo() - : folder(false) - { - - } - QString type; - QString path; - bool folder; -}; +#include "migrateinfo.h" class KMMigrateKMail4Config : public QObject { diff --git a/migration/migrateinfo.cpp b/migration/migrateinfo.cpp new file mode 100644 index 000000000..3202ee39e --- /dev/null +++ b/migration/migrateinfo.cpp @@ -0,0 +1,58 @@ +/* + Copyright (c) 2015 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "migrateinfo.h" + +MigrateInfo::MigrateInfo() + : mFolder(false) +{ + +} + +QString MigrateInfo::type() const +{ + return mType; +} + +void MigrateInfo::setType(const QString &type) +{ + mType = type; +} + +QString MigrateInfo::path() const +{ + return mPath; +} + +void MigrateInfo::setPath(const QString &path) +{ + mPath = path; +} + +bool MigrateInfo::folder() const +{ + return mFolder; +} + +void MigrateInfo::setFolder(bool folder) +{ + mFolder = folder; +} + + + + diff --git a/migration/migrateinfo.h b/migration/migrateinfo.h new file mode 100644 index 000000000..c4aaaed50 --- /dev/null +++ b/migration/migrateinfo.h @@ -0,0 +1,43 @@ +/* + Copyright (c) 2015 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MIGRATEINFO_H +#define MIGRATEINFO_H + +#include + +class MigrateInfo +{ +public: + MigrateInfo(); + + QString type() const; + void setType(const QString &type); + + QString path() const; + void setPath(const QString &path); + + bool folder() const; + void setFolder(bool folder); + +private: + QString mType; + QString mPath; + bool mFolder; +}; + +#endif // MIGRATEINFO_H