LeechCraft 0.6.70-19214-g121e5318a7
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
corosignaltest.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QMetaMethod>
12#include <QObject>
13
14namespace LC::Util
15{
16 class SignalEmitter : public QObject
17 {
18 Q_OBJECT
19 public:
20 using QObject::QObject;
21
22 template<typename Sig>
23 bool IsConnected (Sig signal) const
24 {
25 return isSignalConnected (QMetaMethod::fromSignal (signal));
26 }
27 signals:
28 void NoArgs ();
29 void OneArg (int);
30 void RefArg (const QString&);
31 void TwoArgs (int, QString);
32 void Overloaded (int);
33 void Overloaded (const QString&);
34 };
35
36 class CoroSignalTest : public QObject
37 {
38 Q_OBJECT
39 private slots:
40 void testNoArgs ();
41 void testOneArg ();
42 void testTwoArgsYieldTuple ();
43 void testRefArgYieldsOwnedValue ();
44 void testOverloaded ();
45 void testPrivateTagStripped ();
46 void testBaseClassThroughDerived ();
47
48 void testResumesAfterEmitReturns ();
49 void testContinuationMayDestroySender ();
50 void testFirstEmissionWins ();
51 void testConnectedOnlyWhileSuspended ();
52 void testManyAwaitersOneEmission ();
53 void testReawaitSame ();
54
55 void testHandlerResultIsAwaited ();
56 void testHandlerRunsInsideEmit ();
57 void testHandlerSnapshotsDyingSender ();
58 void testHandlerTupleArgs ();
59 void testHandlerPrivateTagStripped ();
60 void testHandlerRunsOnce ();
61 void testHandlerSenderDeathYieldsNullopt ();
62 void testHandlerExceptionRethrownAtAwait ();
63 void testHandlerCopiedPerAwait ();
64
65 void testSenderDeathYieldsNullopt ();
66 void testEmissionBeforeDeathKeepsValue ();
67 void testContextDeathDisconnects ();
68 void testEmittedFromAnotherThread ();
69 };
70}
void RefArg(const QString &)
void Overloaded(const QString &)
void TwoArgs(int, QString)
bool IsConnected(Sig signal) const