1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00
astra/autotests/processwatchertest.cpp

34 lines
718 B
C++
Raw Normal View History

2024-08-22 17:59:05 -04:00
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include <QtTest/QtTest>
#include "processwatcher.h"
class ProcessWatcherTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testWatcher()
{
QProcess process;
process.setProgram(QStringLiteral("echo"));
process.start();
const auto watcher = new ProcessWatcher(process.processId());
const QSignalSpy spy(watcher, &ProcessWatcher::finished);
QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 0);
process.kill();
QTRY_COMPARE(spy.count(), 1);
}
};
QTEST_MAIN(ProcessWatcherTest)
#include "processwatchertest.moc"