From 5d1ef1c26a9d150f9eb8f1a5beb5537f22c6ed48 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 18 Jun 2018 10:27:24 +0200 Subject: [PATCH] chore(CMakeLists.txt): remove app tests and target --- CMakeLists.txt | 23 +--- src/tests/TestUtils.cpp | 104 ----------------- src/tests/TestUtils.hpp | 59 ---------- .../assistant-view/AssistantViewTest.cpp | 51 -------- .../assistant-view/AssistantViewTest.hpp | 43 ------- src/tests/main-view/MainViewTest.cpp | 110 ------------------ src/tests/main-view/MainViewTest.hpp | 48 -------- src/tests/main.cpp | 103 ---------------- src/tests/self-test/SelfTest.cpp | 49 -------- src/tests/self-test/SelfTest.hpp | 40 ------- 10 files changed, 1 insertion(+), 629 deletions(-) delete mode 100644 src/tests/TestUtils.cpp delete mode 100644 src/tests/TestUtils.hpp delete mode 100644 src/tests/assistant-view/AssistantViewTest.cpp delete mode 100644 src/tests/assistant-view/AssistantViewTest.hpp delete mode 100644 src/tests/main-view/MainViewTest.cpp delete mode 100644 src/tests/main-view/MainViewTest.hpp delete mode 100644 src/tests/main.cpp delete mode 100644 src/tests/self-test/SelfTest.cpp delete mode 100644 src/tests/self-test/SelfTest.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3566143e5..9ecefa124 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,10 +26,7 @@ project(linphoneqt VERSION 4.1.1) set(APP_LIBRARY app-library) set(EXECUTABLE_NAME linphone) -set(TESTER_EXECUTABLE_NAME "${EXECUTABLE_NAME}-tester") - set(TARGET_NAME linphone-qt) -set(TESTER_TARGET_NAME "${TARGET_NAME}-tester") set(CMAKE_CXX_STANDARD 11) @@ -226,19 +223,7 @@ set(HEADERS src/utils/Utils.hpp ) -set(TESTS - src/tests/assistant-view/AssistantViewTest.cpp - src/tests/assistant-view/AssistantViewTest.hpp - src/tests/main-view/MainViewTest.cpp - src/tests/main-view/MainViewTest.hpp - src/tests/self-test/SelfTest.cpp - src/tests/self-test/SelfTest.hpp - src/tests/TestUtils.cpp - src/tests/TestUtils.hpp -) - set(MAIN_FILE src/app/main.cpp) -set(TESTER_MAIN_FILE src/tests/main.cpp) if (UNIX AND NOT APPLE) list(APPEND SOURCES src/components/core/messages-count-notifier/MessagesCountNotifierLinux.cpp) @@ -337,7 +322,6 @@ include_directories(src/) find_package(Qt5 COMPONENTS ${QT5_PACKAGES} REQUIRED) find_package(Qt5 COMPONENTS ${QT5_PACKAGES_OPTIONAL} QUIET) -find_package(Qt5 COMPONENTS Test REQUIRED) if (CMAKE_INSTALL_RPATH) get_target_property(LUPDATE_PATH Qt5::lupdate LOCATION) @@ -363,17 +347,14 @@ add_dependencies(${APP_LIBRARY} update_translations) if (WIN32) add_executable(${TARGET_NAME} WIN32 $ assets/linphone.rc ${MAIN_FILE}) - add_executable(${TESTER_TARGET_NAME} WIN32 $ assets/linphone.rc ${TESTER_MAIN_FILE} ${TESTS}) else () add_executable(${TARGET_NAME} $ ${MAIN_FILE}) - add_executable(${TESTER_TARGET_NAME} $ ${TESTER_MAIN_FILE} ${TESTS}) endif () if (NOT WIN32) add_dependencies(update_translations check_qml) endif () set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "${EXECUTABLE_NAME}") -set_target_properties(${TESTER_TARGET_NAME} PROPERTIES OUTPUT_NAME "${TESTER_EXECUTABLE_NAME}") set(INCLUDED_DIRECTORIES "${LINPHONECXX_INCLUDE_DIRS}" "${BELCARD_INCLUDE_DIRS}" "${BCTOOLBOX_INCLUDE_DIRS}" "${MEDIASTREAMER2_INCLUDE_DIRS}" "${MINIZIP_INCLUDE_DIRS}") set(LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONECXX_LIBRARIES} ${MINIZIP_LIBRARIES}) @@ -406,12 +387,10 @@ endif () target_include_directories(${APP_LIBRARY} SYSTEM PRIVATE ${INCLUDED_DIRECTORIES}) target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${INCLUDED_DIRECTORIES}) -target_include_directories(${TESTER_TARGET_NAME} SYSTEM PRIVATE ${INCLUDED_DIRECTORIES}) target_link_libraries(${TARGET_NAME} ${LIBRARIES}) -target_link_libraries(${TESTER_TARGET_NAME} ${LIBRARIES} Qt5::Test) -foreach (target ${TARGET_NAME} ${TESTER_TARGET_NAME}) +foreach (target ${TARGET_NAME}) install(TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/src/tests/TestUtils.cpp b/src/tests/TestUtils.cpp deleted file mode 100644 index 183497f40..000000000 --- a/src/tests/TestUtils.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * TestUtils.cpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 18, 2017 - * Author: Ronan Abhamon - */ - -#ifdef QT_NO_DEBUG - #undef QT_NO_DEBUG -#endif // ifdef QT_NO_DEBUG - -#include -#include - -#include "../app/App.hpp" - -#include "TestUtils.hpp" - -// ============================================================================= - -void TestUtils::executeKeySequence (QQuickWindow *window, QKeySequence sequence) { - for (int i = 0; i < sequence.count(); ++i) { - uint key = uint(sequence[uint(i)]); - QTest::keyClick( - window, - Qt::Key(key & ~Qt::KeyboardModifierMask), - Qt::KeyboardModifiers(key & Qt::KeyboardModifierMask) - ); - } -} - -// ----------------------------------------------------------------------------- - -static void printItemTree (const QQuickItem *item, QString &output, int spaces) { - output.append(QString().leftJustified(spaces, ' ')); - output.append(item->metaObject()->className()); - output.append("\n"); - - for (const auto &childItem : item->childItems()) - printItemTree(childItem, output, spaces + 2); -} - -void TestUtils::printItemTree (const QQuickItem *item) { - QString output; - ::printItemTree(item, output, 0); - qInfo().noquote() << output; -} - -// ----------------------------------------------------------------------------- - -QQuickItem *TestUtils::getMainLoaderFromMainWindow () { - QList items = App::getInstance()->getMainWindow()->contentItem()->childItems(); - Q_ASSERT(!items.empty()); - - for (int i = 0; i < 3; ++i) { - items = items.at(0)->childItems(); - Q_ASSERT(!items.empty()); - } - - QQuickItem *loader = items.at(0); - Q_ASSERT(!strcmp(loader->metaObject()->className(), "QQuickLoader")); - - return loader; -} - -// ----------------------------------------------------------------------------- - -QQuickItem *TestUtils::getVirtualWindowContent (const QQuickWindow *window) { - Q_CHECK_PTR(window); - - QList items = window->contentItem()->childItems(); - Q_ASSERT(!items.empty()); - - items = items.at(0)->childItems(); - Q_ASSERT(!items.empty()); - - items = items.at(0)->childItems(); - Q_ASSERT(items.size() == 2); - - const char name[] = "VirtualWindow_QMLTYPE_"; - QQuickItem *virtualWindow = items.at(1); - Q_ASSERT(!strncmp(virtualWindow->metaObject()->className(), name, sizeof name - 1)); - - items = virtualWindow->childItems(); - Q_ASSERT(items.size() == 2); - - items = items.at(1)->childItems(); - return items.empty() ? nullptr : items.at(0); -} diff --git a/src/tests/TestUtils.hpp b/src/tests/TestUtils.hpp deleted file mode 100644 index 9f325987e..000000000 --- a/src/tests/TestUtils.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * TestUtils.hpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 18, 2017 - * Author: Ronan Abhamon - */ - -#ifndef TEST_UTILS_H_ -#define TEST_UTILS_H_ - -#include -#include - -// ============================================================================= - -#define CHECK_VIRTUAL_WINDOW_CONTENT_INFO(WINDOW, TYPE, NAME) \ - do { \ - QQuickItem *virtualWindowContent = TestUtils::getVirtualWindowContent(WINDOW); \ - QVERIFY(virtualWindowContent); \ - QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), TYPE, sizeof TYPE - 1)); \ - QCOMPARE(virtualWindowContent->objectName(), QStringLiteral(NAME)); \ - } while (0); - -#define INIT_GUI_TEST() \ - do { \ - QQuickWindow *mainWindow = App::getInstance()->getMainWindow(); \ - App::smartShowWindow(mainWindow); \ - QTest::qWait(100); \ - QQuickItem *contentLoader = mainWindow->findChild("__contentLoader"); \ - QVERIFY(contentLoader); \ - QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(110, 100)); \ - } while (0); - -namespace TestUtils { - void executeKeySequence (QQuickWindow *window, QKeySequence sequence); - - void printItemTree (const QQuickItem *item); - - QQuickItem *getMainLoaderFromMainWindow (); - - QQuickItem *getVirtualWindowContent (const QQuickWindow *window); -} - -#endif // ifndef TEST_UTILS_H_ diff --git a/src/tests/assistant-view/AssistantViewTest.cpp b/src/tests/assistant-view/AssistantViewTest.cpp deleted file mode 100644 index 586957f3f..000000000 --- a/src/tests/assistant-view/AssistantViewTest.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * AssistantViewTest.cpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 20, 2017 - * Author: Ronan Abhamon - */ - -#include -#include -#include - -#include "../../app/App.hpp" -#include "../TestUtils.hpp" - -#include "AssistantViewTest.hpp" - -// ============================================================================= - -void AssistantViewTest::init () { - INIT_GUI_TEST(); -} - -void AssistantViewTest::showAssistantView () { - QQuickWindow *mainWindow = App::getInstance()->getMainWindow(); - QQuickItem *contentLoader = mainWindow->findChild("__contentLoader"); - - // Show assistant view. - QSignalSpy spyLoaderReady(contentLoader, SIGNAL(loaded())); - QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(705, 485)); - - QVERIFY(spyLoaderReady.count() == 1); - QCOMPARE( - QQmlProperty::read(contentLoader, "source").toString(), - QStringLiteral("qrc:/ui/views/App/Main/Assistant.qml") - ); -} diff --git a/src/tests/assistant-view/AssistantViewTest.hpp b/src/tests/assistant-view/AssistantViewTest.hpp deleted file mode 100644 index 6325c1639..000000000 --- a/src/tests/assistant-view/AssistantViewTest.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * AssistantViewTest.hpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 20, 2017 - * Author: Ronan Abhamon - */ - -#ifndef ASSISTANT_VIEW_TEST_H_ -#define ASSISTANT_VIEW_TEST_H_ - -#include - -// ============================================================================= - -class AssistantViewTest : public QObject { - Q_OBJECT; - -public: - AssistantViewTest () = default; - ~AssistantViewTest () = default; - -private slots: - void init (); - - void showAssistantView (); -}; - -#endif // ifndef ASSISTANT_VIEW_TEST_H_ diff --git a/src/tests/main-view/MainViewTest.cpp b/src/tests/main-view/MainViewTest.cpp deleted file mode 100644 index 74b52d1a1..000000000 --- a/src/tests/main-view/MainViewTest.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * MainViewTest.cpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 18, 2017 - * Author: Ronan Abhamon - */ - -#include -#include -#include - -#include "../../app/App.hpp" -#include "../TestUtils.hpp" - -#include "MainViewTest.hpp" - -// ============================================================================= - -void MainViewTest::init () { - INIT_GUI_TEST(); -} - -// ----------------------------------------------------------------------------- - -void MainViewTest::showAboutPopup () { - QQuickWindow *mainWindow = App::getInstance()->getMainWindow(); - - // Open popup. - TestUtils::executeKeySequence(mainWindow, QKeySequence::HelpContents); - - CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__about"); - - // Close popup. - QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392)); - QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow)); -} - -// ----------------------------------------------------------------------------- - -void MainViewTest::showManageAccountsPopup () { - QQuickWindow *mainWindow = App::getInstance()->getMainWindow(); - - // Open popup. - QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(100, 35)); - - CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__manageAccounts"); - - // Close popup. - QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392)); - QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow)); -} - -// ----------------------------------------------------------------------------- - -void MainViewTest::showSettingsWindow () { - App *app = App::getInstance(); - - // Open window. - QTest::keyClick(app->getMainWindow(), Qt::Key_P, Qt::ControlModifier); - QQuickWindow *settingsWindow = app->getSettingsWindow(); - - QVERIFY(QTest::qWaitForWindowExposed(settingsWindow)); - - // Hide window. - TestUtils::executeKeySequence(settingsWindow, QKeySequence::Close); - QVERIFY(!settingsWindow->isVisible()); -} - -// ----------------------------------------------------------------------------- - -void MainViewTest::testMainMenuEntries_data () { - QTest::addColumn("y"); - QTest::addColumn("source"); - - QTest::newRow("home view 1") << 100 << "qrc:/ui/views/App/Main/Home.qml"; - QTest::newRow("contacts view 1") << 150 << "qrc:/ui/views/App/Main/Contacts.qml"; - QTest::newRow("home view 2") << 100 << "qrc:/ui/views/App/Main/Home.qml"; - QTest::newRow("contacts view 2") << 150 << "qrc:/ui/views/App/Main/Contacts.qml"; -} - -void MainViewTest::testMainMenuEntries () { - QQuickWindow *mainWindow = App::getInstance()->getMainWindow(); - - QQuickItem *contentLoader = mainWindow->findChild("__contentLoader"); - QVERIFY(contentLoader); - - QSignalSpy spyLoaderReady(contentLoader, SIGNAL(loaded())); - - QFETCH(int, y); - QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(110, y)); - QVERIFY(spyLoaderReady.count() == 1); - - QFETCH(QString, source); - QCOMPARE(QQmlProperty::read(contentLoader, "source").toString(), source); -} diff --git a/src/tests/main-view/MainViewTest.hpp b/src/tests/main-view/MainViewTest.hpp deleted file mode 100644 index bc3a4a498..000000000 --- a/src/tests/main-view/MainViewTest.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * MainViewTest.hpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 18, 2017 - * Author: Ronan Abhamon - */ - -#ifndef MAIN_VIEW_TEST_H_ -#define MAIN_VIEW_TEST_H_ - -#include - -// ============================================================================= - -class MainViewTest : public QObject { - Q_OBJECT; - -public: - MainViewTest () = default; - ~MainViewTest () = default; - -private slots: - void init (); - - void showAboutPopup (); - void showManageAccountsPopup (); - void showSettingsWindow (); - - void testMainMenuEntries_data (); - void testMainMenuEntries (); -}; - -#endif // ifndef MAIN_VIEW_TEST_H_ diff --git a/src/tests/main.cpp b/src/tests/main.cpp deleted file mode 100644 index 3fbf12309..000000000 --- a/src/tests/main.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * main.cpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 17, 2017 - * Author: Ronan Abhamon - */ - -#include -#include - -#include "../app/AppController.hpp" -#include "../utils/Utils.hpp" - -#include "assistant-view/AssistantViewTest.hpp" -#include "main-view/MainViewTest.hpp" -#include "self-test/SelfTest.hpp" - -// ============================================================================= - -static QHash initializeTests () { - QHash hash; - hash["assistant-view"] = new AssistantViewTest(); - hash["main-view"] = new MainViewTest(); - return hash; -} - -// ----------------------------------------------------------------------------- - -int main (int argc, char *argv[]) { - int fakeArgc = 1; - AppController controller(fakeArgc, argv); - App *app = controller.getApp(); - if (app->isSecondary()) - qFatal("Unable to run test with secondary app."); - - int testsRet = 0; - - const QHash tests = initializeTests(); - - QObject *test = nullptr; - if (argc > 1) { - if (!strcmp(argv[1], "self-test")) - // Execute only self-test. - QTimer::singleShot(0, [app, &testsRet] { - testsRet = QTest::qExec(new SelfTest(app)); - QCoreApplication::quit(); - }); - else { - // Execute only one test. - const QString testName = ::Utils::coreStringToAppString(argv[1]); - test = tests[testName]; - if (!test) { - qWarning() << QStringLiteral("Unable to run invalid test: `%1`.").arg(testName); - return EXIT_FAILURE; - } - - QTimer::singleShot(0, [app, &testsRet, test, argc, argv] { - testsRet = QTest::qExec(new SelfTest(app)); - if (!testsRet) - QTest::qExec(test, argc - 1, argv + 1); - QCoreApplication::quit(); - }); - } - } else - // Execute all tests. - QTimer::singleShot(0, [app, &testsRet, &tests] { - testsRet = QTest::qExec(new SelfTest(app)); - if (!testsRet) - for (const auto &test : tests) { - testsRet |= QTest::qExec(test); - } - - QCoreApplication::quit(); - }); - - app->initContentApp(); - int ret = app->exec(); - - for (auto &test : tests) - delete test; - - if (testsRet) - qWarning() << QStringLiteral("One or many tests are failed. :("); - else - qInfo() << QStringLiteral("Tests seems OK. :)"); - - return testsRet || ret; -} diff --git a/src/tests/self-test/SelfTest.cpp b/src/tests/self-test/SelfTest.cpp deleted file mode 100644 index 21e9e22ed..000000000 --- a/src/tests/self-test/SelfTest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SelfTest.cpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 17, 2017 - * Author: Ronan Abhamon - */ - -#include -#include -#include - -#include "../../app/App.hpp" -#include "../../components/core/CoreManager.hpp" -#include "../TestUtils.hpp" - -#include "SelfTest.hpp" - -// ============================================================================= - -void SelfTest::checkAppStartup () { - CoreManager *coreManager = CoreManager::getInstance(); - QQuickItem *mainLoader = TestUtils::getMainLoaderFromMainWindow(); - - QSignalSpy spyCoreStarted(coreManager->getHandlers().get(), &CoreHandlers::coreStarted); - QSignalSpy spyLoaderReady(mainLoader, SIGNAL(loaded())); - - if (!coreManager->started()) - QVERIFY(spyCoreStarted.wait(5000)); - - if (!QQmlProperty::read(mainLoader, "item").value()) - QVERIFY(spyLoaderReady.wait(1000)); - - QVERIFY(QTest::qWaitForWindowExposed(App::getInstance()->getMainWindow())); -} diff --git a/src/tests/self-test/SelfTest.hpp b/src/tests/self-test/SelfTest.hpp deleted file mode 100644 index dd56697fe..000000000 --- a/src/tests/self-test/SelfTest.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SelfTest.hpp - * Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France - * - * 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) any later version. - * - * 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. - * - * Created on: July 17, 2017 - * Author: Ronan Abhamon - */ - -#ifndef SELF_TEST_H_ -#define SELF_TEST_H_ - -#include - -// ============================================================================= - -class SelfTest : public QObject { - Q_OBJECT; - -public: - SelfTest (QObject *parent = Q_NULLPTR) : QObject(parent) {} - -private slots: - void checkAppStartup (); -}; - -#endif // ifndef SELF_TEST_H_