diff --git a/tools/cutehmi.daemon.3/tests/test_cutehmi_daemon.cpp b/tools/cutehmi.daemon.3/tests/test_cutehmi_daemon.cpp index 1e6a8d49..24fba961 100644 --- a/tools/cutehmi.daemon.3/tests/test_cutehmi_daemon.cpp +++ b/tools/cutehmi.daemon.3/tests/test_cutehmi_daemon.cpp @@ -1,106 +1,106 @@ #include #include #include "../cutehmi.dirs.hpp" namespace cutehmi { namespace daemon { class test_cutehmi_daemon: public QObject { Q_OBJECT private slots: void initTestCase(); void helpOption(); void versionOption(); void countDaemonExample(); private: QString m_installDir; QString m_programPath; }; void test_cutehmi_daemon::initTestCase() { - QString m_installDir = qEnvironmentVariable("CUTEHMI_INSTALL_DIR"); + QString m_installDir = qEnvironmentVariable("CUTEHMI_INSTALL_DIR"); QVERIFY(!m_installDir.isEmpty()); QString toolsInstallSubdir = CUTEHMI_DIRS_TOOLS_INSTALL_SUBDIR; if (!toolsInstallSubdir.isEmpty()) - m_installDir += "/" + toolsInstallSubdir; + m_installDir += "/" + toolsInstallSubdir; m_programPath = m_installDir + "/cutehmi.daemon.3"; #ifndef CUTEHMI_NDEBUG m_programPath += ".debug"; #endif } void test_cutehmi_daemon::helpOption() { QList argumentsList; argumentsList << QStringList({"--help"}) << QStringList({"--h"}); for (auto arguments : argumentsList) { QProcess process; process.start(m_programPath, arguments); process.waitForFinished(1000); QCOMPARE(process.error(), QProcess::UnknownError); QVERIFY(!process.readAllStandardError().contains("Unknown option")); QVERIFY(!process.readAllStandardOutput().isEmpty()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), EXIT_SUCCESS); } } void test_cutehmi_daemon::versionOption() { QList argumentsList; argumentsList << QStringList({"--version"}) << QStringList({"--v"}); for (auto arguments : argumentsList) { QProcess process; process.start(m_programPath, arguments); process.waitForFinished(1000); QCOMPARE(process.error(), QProcess::UnknownError); QVERIFY(!process.readAllStandardError().contains("Unknown option")); QVERIFY(!process.readAllStandardOutput().isEmpty()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), EXIT_SUCCESS); } } void test_cutehmi_daemon::countDaemonExample() { QProcess process; - QStringList arguments { {"--app"}, {"CuteHMI.Examples.CountDaemon.3"} }; + QStringList arguments({"--app", "CuteHMI.Examples.CountDaemon.3"}); process.start(m_programPath, arguments); QVERIFY(process.waitForFinished()); QString stdOut = QString::fromLocal8Bit(process.readAllStandardOutput()); QString stdErr = QString::fromLocal8Bit(process.readAllStandardError()); QVERIFY(stdErr.contains("I can count")); QCOMPARE(process.error(), QProcess::UnknownError); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), EXIT_SUCCESS); } } } QTEST_MAIN(cutehmi::daemon::test_cutehmi_daemon) #include "test_cutehmi_daemon.moc" //(c)C: Copyright © 2020, Michał Policht . All rights reserved. //(c)C: This file is a part of CuteHMI. //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. //(c)C: CuteHMI 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 Lesser General Public License for more details. //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see . diff --git a/tools/cutehmi.daemon.3/tests/tests.qbs b/tools/cutehmi.daemon.3/tests/tests.qbs index ae0a975d..e8435cbe 100644 --- a/tools/cutehmi.daemon.3/tests/tests.qbs +++ b/tools/cutehmi.daemon.3/tests/tests.qbs @@ -1,23 +1,23 @@ import qbs import "Test.qbs" as Test Project { condition: !qbs.targetOS.contains("windows") Test { testName: "test_cutehmi_daemon" files: [ "test_cutehmi_daemon.cpp", ] - Depends { name: "CuteHMI.Examples.CountDaemon.2" } + Depends { name: "CuteHMI.Examples.CountDaemon.3" } } } //(c)C: Copyright © 2020, Michał Policht . All rights reserved. //(c)C: This file is a part of CuteHMI. //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. //(c)C: CuteHMI 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 Lesser General Public License for more details. //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see .