File indexing completed on 2024-04-14 14:19:06

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2013 Kevin Funk <kevin@kfunk.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KCOMPOSITEJOBTEST_H
0009 #define KCOMPOSITEJOBTEST_H
0010 
0011 #include <QEventLoop>
0012 #include <QObject>
0013 
0014 #include "kcompositejob.h"
0015 
0016 class TestJob : public KJob
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit TestJob(QObject *parent = nullptr);
0022 
0023     /// Takes 1 second to finish
0024     void start() override;
0025 
0026 private Q_SLOTS:
0027     void doEmit();
0028 };
0029 
0030 class CompositeJob : public KCompositeJob
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit CompositeJob(QObject *parent = nullptr)
0036         : KCompositeJob(parent)
0037     {
0038     }
0039 
0040     void start() override;
0041     bool addSubjob(KJob *job) override;
0042 
0043 protected Q_SLOTS:
0044     void slotResult(KJob *job) override;
0045 };
0046 
0047 class KCompositeJobTest : public QObject
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052     KCompositeJobTest();
0053 
0054 private Q_SLOTS:
0055     void testDeletionDuringExecution();
0056 
0057 private:
0058     QEventLoop loop;
0059 };
0060 
0061 #endif // KCOMPOSITEJOBTEST_H