add github issue reporing backend (#104)

This commit is contained in:
2016-08-20 12:14:22 +03:00
parent a9e3e3f087
commit 18c993c0d5
8 changed files with 242 additions and 7 deletions

View File

@ -16,7 +16,7 @@ include_directories(
${Kf5_INCLUDE}
)
## library
# library
set(AWTESTLIBRARY_HEADERS awtestlibrary.h)
set(AWTESTLIBRARY_SOURCES awtestlibrary.cpp)
add_library(${SUBPROJECT}-awtest STATIC ${AWTESTLIBRARY_SOURCES} ${AWTESTLIBRARY_HEADERS})
@ -24,18 +24,20 @@ target_link_libraries(${SUBPROJECT}-awtest ${Qt_LIBRARIES} ${Qt5Test_LIBRARIES})
set(LIBRARY_TEST_SET ${SUBPROJECT}-awtest ${PROJECT_LIBRARY} ${PROJECT_MONITORSOURCES}
${Qt_LIBRARIES} ${Kf5_LIBRARIES} ${Qt5Test_LIBRARIES})
## modules
# modules
set(TEST_MODULES
abstractextitem extquotes extscript extupgrade extweather
abstractformatter datetimeformatter floatformatter listformatter noformatter scriptformatter stringformatter
extitemaggregator
batterysource desktopsource gpuloadsource gputempsource hddtempsource networksource playersource processessource
awconfighelper awkeycache awkeys awpatternfunctions awupdatehelper
awbugreporter awconfighelper awkeycache awkeys awpatternfunctions awupdatehelper
dpplugin)
foreach (TEST_MODULE ${TEST_MODULES})
set(${TEST_MODULE}_HEADERS test${TEST_MODULE}.h)
set(${TEST_MODULE}_SOURCES test${TEST_MODULE}.cpp)
if (TEST_MODULE MATCHES "awconfighelper")
if (TEST_MODULE MATCHES "awbugreporter")
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awbugreporter.cpp)
elseif (TEST_MODULE MATCHES "awconfighelper")
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awconfighelper.cpp)
elseif (TEST_MODULE MATCHES "awkeycache")
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awkeycache.cpp)
@ -60,8 +62,10 @@ foreach (TEST_MODULE ${TEST_MODULES})
elseif (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)
endif (TEST_MODULE MATCHES "awconfighelper")
endif (TEST_MODULE MATCHES "awbugreporter")
add_executable(${SUBPROJECT}-${TEST_MODULE} ${${TEST_MODULE}_HEADERS} ${${TEST_MODULE}_SOURCES})
target_link_libraries(${SUBPROJECT}-${TEST_MODULE} ${LIBRARY_TEST_SET})
add_test(NAME ${TEST_MODULE} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT}-${TEST_MODULE})
if (NOT TEST_MODULE MATCHES "awbugreporter")
add_test(NAME ${TEST_MODULE} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT}-${TEST_MODULE})
endif (NOT TEST_MODULE MATCHES "awbugreporter")
endforeach (TEST_MODULE)

View File

@ -0,0 +1,53 @@
/***************************************************************************
* 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 "testawbugreporter.h"
#include <QtTest>
#include "awbugreporter.h"
#include "awtestlibrary.h"
void TestAWBugReporter::initTestCase()
{
plugin = new AWBugReporter(this);
}
void TestAWBugReporter::cleanupTestCase()
{
delete plugin;
}
void TestAWBugReporter::test_sendBugReport()
{
QSignalSpy spy(plugin, SIGNAL(replyReceived(bool, QString)));
plugin->sendBugReport(AWTestLibrary::randomString(),
AWTestLibrary::randomString());
QVERIFY(spy.wait(5000));
QVariantList arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toBool());
QVERIFY(!arguments.at(1).toString().isEmpty());
}
QTEST_MAIN(TestAWBugReporter);

View File

@ -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 TESTAWBUGREPORTER_H
#define TESTAWBUGREPORTER_H
#include <QObject>
class AWBugReporter;
class TestAWBugReporter : public QObject
{
Q_OBJECT
private slots:
// initialization
void initTestCase();
void cleanupTestCase();
// test
void test_sendBugReport();
private:
AWBugReporter *plugin = nullptr;
};
#endif /* TESTAWBUGREPORTER_H */