From f6a6704fd24a5d101fba1ff3904c025e3e8e53ac Mon Sep 17 00:00:00 2001 From: arcan1s Date: Thu, 23 Jun 2016 10:56:55 +0300 Subject: [PATCH] add test for awupdatehelper and template for awkeycache --- sources/test/CMakeLists.txt | 5 ++++ sources/test/testawkeycache.cpp | 37 ++++++++++++++++++++++++ sources/test/testawkeycache.h | 39 +++++++++++++++++++++++++ sources/test/testawupdatehelper.cpp | 45 +++++++++++++++++++++++++++++ sources/test/testawupdatehelper.h | 43 +++++++++++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 sources/test/testawkeycache.cpp create mode 100644 sources/test/testawkeycache.h create mode 100644 sources/test/testawupdatehelper.cpp create mode 100644 sources/test/testawupdatehelper.h diff --git a/sources/test/CMakeLists.txt b/sources/test/CMakeLists.txt index ba199a9..e3febbb 100644 --- a/sources/test/CMakeLists.txt +++ b/sources/test/CMakeLists.txt @@ -30,6 +30,7 @@ set(TEST_MODULES abstractformatter datetimeformatter floatformatter noformatter scriptformatter extitemaggregator batterysource desktopsource gpuloadsource gputempsource hddtempsource networksource playersource processessource + awkeycache awupdatehelper dpplugin) foreach (TEST_MODULE ${TEST_MODULES}) set(${TEST_MODULE}_HEADERS test${TEST_MODULE}.h) @@ -37,6 +38,10 @@ foreach (TEST_MODULE ${TEST_MODULES}) if (TEST_MODULE MATCHES "dpplugin") set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../desktop-panel/plugin/dpadds.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/fontdialog.cpp) + elseif(TEST_MODULE MATCHES "awkeycache") + set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awkeycache.cpp) + elseif(TEST_MODULE MATCHES "awupdatehelper") + set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awupdatehelper.cpp) endif(TEST_MODULE MATCHES "dpplugin") add_executable(${SUBPROJECT}-${TEST_MODULE} ${${TEST_MODULE}_HEADERS} ${${TEST_MODULE}_SOURCES}) target_link_libraries(${SUBPROJECT}-${TEST_MODULE} ${LIBRARY_TEST_SET}) diff --git a/sources/test/testawkeycache.cpp b/sources/test/testawkeycache.cpp new file mode 100644 index 0000000..08979f6 --- /dev/null +++ b/sources/test/testawkeycache.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets 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 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#include "testawkeycache.h" + +#include + +#include "awtestlibrary.h" +#include "awkeycache.h" + + +void TestAWKeyCache::initTestCase() +{ +} + + +void TestAWKeyCache::cleanupTestCase() +{ +} + + +QTEST_MAIN(TestAWKeyCache); diff --git a/sources/test/testawkeycache.h b/sources/test/testawkeycache.h new file mode 100644 index 0000000..ec2ca37 --- /dev/null +++ b/sources/test/testawkeycache.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets 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 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef TESTAWKEYCACHE_H +#define TESTAWKEYCACHE_H + +#include + + +class TestAWKeyCache : public QObject +{ + Q_OBJECT + +private slots: + // initialization + void initTestCase(); + void cleanupTestCase(); + // test + +private: +}; + + +#endif /* TESTAWKEYCACHE_H */ diff --git a/sources/test/testawupdatehelper.cpp b/sources/test/testawupdatehelper.cpp new file mode 100644 index 0000000..4b96b56 --- /dev/null +++ b/sources/test/testawupdatehelper.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets 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 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#include "testawupdatehelper.h" + +#include + +#include "awtestlibrary.h" +#include "awupdatehelper.h" + + +void TestAWUpdateHelper::initTestCase() +{ + plugin = new AWUpdateHelper(this); +} + + +void TestAWUpdateHelper::cleanupTestCase() +{ + delete plugin; +} + + +void TestAWUpdateHelper::test_checkVersion() +{ + QVERIFY(!plugin->checkVersion()); +} + + +QTEST_MAIN(TestAWUpdateHelper); diff --git a/sources/test/testawupdatehelper.h b/sources/test/testawupdatehelper.h new file mode 100644 index 0000000..03db776 --- /dev/null +++ b/sources/test/testawupdatehelper.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets 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 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef TESTAWUPDATEHELPER_H +#define TESTAWUPDATEHELPER_H + +#include + + +class AWUpdateHelper; + +class TestAWUpdateHelper : public QObject +{ + Q_OBJECT + +private slots: + // initialization + void initTestCase(); + void cleanupTestCase(); + // test + void test_checkVersion(); + +private: + AWUpdateHelper *plugin = nullptr; +}; + + +#endif /* TESTAWUPDATEHELPER_H */