| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2017 Ford Motor Company |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtRemoteObjects module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | #include "../../../../shared/testutils.h" |
| 30 | |
| 31 | #include <QtTest/QtTest> |
| 32 | #include <QMetaType> |
| 33 | #include <QProcess> |
| 34 | #include <QStandardPaths> |
| 35 | |
| 36 | typedef QLatin1String _; |
| 37 | class tst_Signature: public QObject |
| 38 | { |
| 39 | Q_OBJECT |
| 40 | |
| 41 | private slots: |
| 42 | void initTestCase() |
| 43 | { |
| 44 | QLoggingCategory::setFilterRules("qt.remoteobjects.warning=false" ); |
| 45 | } |
| 46 | |
| 47 | void cleanup() |
| 48 | { |
| 49 | // wait for delivery of RemoveObject events to the source |
| 50 | QTest::qWait(ms: 200); |
| 51 | } |
| 52 | |
| 53 | void testRun() |
| 54 | { |
| 55 | qDebug() << "Starting signatureServer process" ; |
| 56 | QProcess serverProc; |
| 57 | serverProc.setProcessChannelMode(QProcess::ForwardedChannels); |
| 58 | serverProc.start(program: TestUtils::findExecutable(executableName: "signatureServer" , paths: { |
| 59 | QCoreApplication::applicationDirPath() + "/../signatureServer/" |
| 60 | }), arguments: QStringList()); |
| 61 | QVERIFY(serverProc.waitForStarted()); |
| 62 | |
| 63 | // wait for server start |
| 64 | QTest::qWait(ms: 200); |
| 65 | |
| 66 | const QLatin1String tests[] = { |
| 67 | _("differentGlobalEnum" ), |
| 68 | _("differentClassEnum" ), |
| 69 | _("differentPropertyCount" ), |
| 70 | _("differentPropertyType" ), |
| 71 | _("scrambledProperties" ), |
| 72 | _("differentSlotCount" ), |
| 73 | _("differentSlotType" ), |
| 74 | _("differentSlotParamCount" ), |
| 75 | _("differentSlotParamType" ), |
| 76 | _("scrambledSlots" ), |
| 77 | _("differentSignalCount" ), |
| 78 | _("differentSignalParamCount" ), |
| 79 | _("differentSignalParamType" ), |
| 80 | _("scrambledSignals" ), |
| 81 | _("state" ), |
| 82 | _("matchAndQuit" ), // matchAndQuit should be the last one |
| 83 | }; |
| 84 | |
| 85 | for (const auto &test : tests) { |
| 86 | qDebug() << "Starting" << test << "process" ; |
| 87 | QProcess testProc; |
| 88 | testProc.setProcessChannelMode(QProcess::ForwardedChannels); |
| 89 | testProc.start(program: TestUtils::findExecutable(executableName: test, paths: { |
| 90 | QCoreApplication::applicationDirPath() + _("/../" ) + test + _("/" ) |
| 91 | }), arguments: QStringList()); |
| 92 | QVERIFY(testProc.waitForStarted()); |
| 93 | QVERIFY(testProc.waitForFinished()); |
| 94 | QCOMPARE(testProc.exitCode(), 0); |
| 95 | } |
| 96 | |
| 97 | QVERIFY(serverProc.waitForFinished()); |
| 98 | QCOMPARE(serverProc.exitCode(), 0); |
| 99 | } |
| 100 | }; |
| 101 | |
| 102 | QTEST_MAIN(tst_Signature) |
| 103 | |
| 104 | #include "tst_signature.moc" |
| 105 | |