diff --git a/src/zanshin/migrator/zanshin021migrator.h b/src/zanshin/migrator/zanshin021migrator.h index 2802a9d8..868a4c1a 100644 --- a/src/zanshin/migrator/zanshin021migrator.h +++ b/src/zanshin/migrator/zanshin021migrator.h @@ -1,77 +1,81 @@ /* This file is part of Zanshin Copyright 2014 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 ZANSHIN021MIGRATOR_H +#define ZANSHIN021MIGRATOR_H + #include #include namespace Akonadi { class TransactionSequence; } class SeenItem { public: explicit SeenItem(const Akonadi::Item &theItem) : m_item(theItem), m_dirty(false) { } // invalid item, for QHash::value SeenItem() : m_item(Akonadi::Item()), m_dirty(false) { } bool isDirty() const { return m_dirty; } void setDirty() { m_dirty = true; } Akonadi::Item &item() { return m_item; } const Akonadi::Item &item() const { return m_item; } private: Akonadi::Item m_item; bool m_dirty; }; class Zanshin021Migrator { public: Zanshin021Migrator(); typedef QHash SeenItemHash; SeenItemHash fetchAllItems(); void migrateProjectComments(Zanshin021Migrator::SeenItemHash& items, Akonadi::TransactionSequence* sequence); void migrateProjectWithChildren(Zanshin021Migrator::SeenItemHash& items, Akonadi::TransactionSequence* sequence); bool migrateProjects(); // returns true if item is a "new style" project static bool isProject(const Akonadi::Item &item); private: void markAsProject(SeenItem &seenItem, Akonadi::TransactionSequence* sequence); Akonadi::Storage m_storage; }; +#endif // ZANSHIN021MIGRATOR_H diff --git a/tests/testlib/akonadidebug.h b/tests/testlib/akonadidebug.h index cc3141f9..d0b84bf0 100644 --- a/tests/testlib/akonadidebug.h +++ b/tests/testlib/akonadidebug.h @@ -1,30 +1,35 @@ /* This file is part of Zanshin Copyright 2014 Kevin Ottens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 AKONADIDEBUG_H +#define AKONADIDEBUG_H + #include "akonadi/akonadistorageinterface.h" namespace TestLib { namespace AkonadiDebug { void dumpTree(const Akonadi::StorageInterface::Ptr &storage); } } + +#endif // AKONADIDEBUG_H diff --git a/tests/testlib/qtest_gui_zanshin.h b/tests/testlib/qtest_gui_zanshin.h index cfbb82eb..d560ea19 100644 --- a/tests/testlib/qtest_gui_zanshin.h +++ b/tests/testlib/qtest_gui_zanshin.h @@ -1,26 +1,30 @@ /* This file is part of Zanshin Copyright 2016 Kevin Ottens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 QTEST_GUI_ZANSHIN_H +#define QTEST_GUI_ZANSHIN_H + #include #include +#endif // QTEST_GUI_ZANSHIN_H diff --git a/tests/testlib/qtest_zanshin.h b/tests/testlib/qtest_zanshin.h index 6ba021a7..f668ecf9 100644 --- a/tests/testlib/qtest_zanshin.h +++ b/tests/testlib/qtest_zanshin.h @@ -1,71 +1,76 @@ /* This file is part of Zanshin Copyright 2016 Kevin Ottens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 QTEST_ZANSHIN_H +#define QTEST_ZANSHIN_H + #include #include // We have our own test macro in order to: // * make sure QHash instances are not randomized // * avoid DrKonqi in case of crashes // * Use a much simpler style during tests to avoid // animations or such polluting the environment #ifdef QT_GUI_LIB #define _ZANSHIN_TESTLIB_INTERNAL_FORCE_GUI_ENVIRONMENT \ bool _zanshin_testlib_internal_forceGuiEnvironment() \ { \ QGuiApplication::setDesktopSettingsAware(false); \ qputenv("QT_STYLE_OVERRIDE", "fusion"); \ return true; \ } \ static bool _zanshin_testlib_internal_isGuiEnvironmentForced = _zanshin_testlib_internal_forceGuiEnvironment(); #else #define _ZANSHIN_TESTLIB_INTERNAL_FORCE_GUI_ENVIRONMENT #endif #define ZANSHIN_TEST_MAIN(TestCase) \ _ZANSHIN_TESTLIB_INTERNAL_FORCE_GUI_ENVIRONMENT \ \ bool _zanshin_testlib_internal_forceEnvironment() \ { \ qSetGlobalQHashSeed(0); \ qputenv("KDE_DEBUG", "1"); \ qunsetenv("LANG"); \ qunsetenv("LANGUAGE"); \ qputenv("LC_ALL", "en_US"); \ return true; \ } \ static bool _zanshin_testlib_internal_isEnvironmentForced = _zanshin_testlib_internal_forceEnvironment(); \ \ void _zanshin_testlib_internal_workaround_kxmlgui_startupfunc_leak() \ { \ QCoreApplication::processEvents(); \ QCoreApplication::processEvents(); \ } \ \ extern "C" void Q_CORE_EXPORT qt_startup_hook() \ { \ _zanshin_testlib_internal_workaround_kxmlgui_startupfunc_leak(); \ } \ \ QTEST_MAIN(TestCase) + +#endif // QTEST_ZANSHIN_H diff --git a/tests/testlib/testsafety.h b/tests/testlib/testsafety.h index b48097e4..76b56503 100644 --- a/tests/testlib/testsafety.h +++ b/tests/testlib/testsafety.h @@ -1,44 +1,48 @@ /* This file is part of Zanshin Copyright 2014 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 TESTSAFETY_H +#define TESTSAFETY_H + #include #include namespace TestLib { namespace TestSafety { /** * Checks that the test is running in the proper test environment (akonaditest) */ bool checkTestIsIsolated() { if (qEnvironmentVariableIsEmpty("AKONADI_TESTRUNNER_PID")) { qCritical() << "This test must be run using ctest, in order to use the testrunner environment. Aborting, to avoid messing up your real akonadi"; return false; } return true; } } } +#endif // TESTSAFETY_H