File indexing completed on 2024-11-10 04:40:08

0001 /*
0002  * SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QProcess>
0011 #include <QStringList>
0012 
0013 class KProcess;
0014 
0015 class TestRunner : public QObject
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit TestRunner(const QStringList &args, QObject *parent = nullptr);
0021     int exitCode() const;
0022     void terminate();
0023 
0024 public Q_SLOTS:
0025     void run();
0026     void triggerTermination(int);
0027 
0028 Q_SIGNALS:
0029     void finished();
0030 
0031 private Q_SLOTS:
0032     void processFinished(int exitCode);
0033     void processError(QProcess::ProcessError error);
0034 
0035 private:
0036     QStringList mArguments;
0037     int mExitCode;
0038     KProcess *mProcess = nullptr;
0039 };