File indexing completed on 2024-04-21 15:05:27

0001 /*
0002     This file is part of the KDE Libraries
0003 
0004     SPDX-FileCopyrightText: 2009 Lubos Lunak <l.lunak@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #ifndef KMANAGERSELECTIONTESTTEST_H
0010 #define KMANAGERSELECTIONTESTTEST_H
0011 
0012 #include <QObject>
0013 #include <QTest>
0014 
0015 class KSelectionOwner;
0016 
0017 class KManagerSelectionTest : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021 private Q_SLOTS:
0022     void testAcquireRelease();
0023     void testInitiallyOwned();
0024     void testLostOwnership();
0025     void testWatching();
0026 
0027 private:
0028     void claim(KSelectionOwner *owner, bool force = false, bool forceKill = true);
0029     void xSync();
0030 };
0031 
0032 class KSelectionWatcher;
0033 
0034 // For checking whether several signal have or have not been emitted,
0035 // QSignalSpy::wait() is not powerful enough for that (it is still
0036 // needed to do the event processing though). TODO: check if this is still true.
0037 class SigCheckOwner : public QObject
0038 {
0039     Q_OBJECT
0040 public:
0041     SigCheckOwner(const KSelectionOwner &owner);
0042 private Q_SLOTS:
0043     void lostOwnership();
0044 
0045 public:
0046     bool lostownership;
0047 };
0048 
0049 class SigCheckWatcher : public QObject
0050 {
0051     Q_OBJECT
0052 public:
0053     SigCheckWatcher(const KSelectionWatcher &watcher);
0054 private Q_SLOTS:
0055     void newOwner();
0056     void lostOwner();
0057 
0058 public:
0059     bool newowner;
0060     bool lostowner;
0061 };
0062 
0063 #endif