1 | // |
2 | // PriorityEventTest.h |
3 | // |
4 | // Definition of the PriorityEventTest class. |
5 | // |
6 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
7 | // and Contributors. |
8 | // |
9 | // SPDX-License-Identifier: BSL-1.0 |
10 | // |
11 | |
12 | |
13 | #ifndef PriorityEventTest_INCLUDED |
14 | #define PriorityEventTest_INCLUDED |
15 | |
16 | |
17 | #include "Poco/Foundation.h" |
18 | #include "Poco/CppUnit/TestCase.h" |
19 | #include "Poco/PriorityEvent.h" |
20 | #include "Poco/EventArgs.h" |
21 | |
22 | |
23 | class PriorityEventTest: public CppUnit::TestCase |
24 | { |
25 | Poco::PriorityEvent<void> Void; |
26 | Poco::PriorityEvent<int> Simple; |
27 | Poco::PriorityEvent<const int> ConstSimple; |
28 | Poco::PriorityEvent<Poco::EventArgs*> Complex; |
29 | Poco::PriorityEvent<Poco::EventArgs> Complex2; |
30 | Poco::PriorityEvent<const Poco::EventArgs*> ConstComplex; |
31 | Poco::PriorityEvent<const Poco::EventArgs * const> Const2Complex; |
32 | public: |
33 | PriorityEventTest(const std::string& name); |
34 | ~PriorityEventTest(); |
35 | |
36 | void testNoDelegate(); |
37 | void testSingleDelegate(); |
38 | void testDuplicateRegister(); |
39 | void testDuplicateUnregister(); |
40 | void testDisabling(); |
41 | void testPriorityOrder(); |
42 | void testPriorityOrderExpire(); |
43 | void testExpire(); |
44 | void testExpireReRegister(); |
45 | void testReturnParams(); |
46 | void testOverwriteDelegate(); |
47 | void testAsyncNotify(); |
48 | |
49 | void setUp(); |
50 | void tearDown(); |
51 | static CppUnit::Test* suite(); |
52 | |
53 | protected: |
54 | static void onStaticVoid(const void* pSender); |
55 | |
56 | void onVoid(const void* pSender); |
57 | |
58 | static void onStaticSimple(const void* pSender, int& i); |
59 | static void onStaticSimple2(void* pSender, int& i); |
60 | static void onStaticSimple3(int& i); |
61 | |
62 | void onSimpleNoSender(int& i); |
63 | void onSimple(const void* pSender, int& i); |
64 | void onSimpleOther(const void* pSender, int& i); |
65 | void onConstSimple(const void* pSender, const int& i); |
66 | void onComplex(const void* pSender, Poco::EventArgs* & i); |
67 | void onComplex2(const void* pSender, Poco::EventArgs & i); |
68 | void onConstComplex(const void* pSender, const Poco::EventArgs*& i); |
69 | void onConst2Complex(const void* pSender, const Poco::EventArgs * const & i); |
70 | void onAsync(const void* pSender, int& i); |
71 | |
72 | int getCount() const; |
73 | private: |
74 | int _count; |
75 | }; |
76 | |
77 | |
78 | #endif // PriorityEventTest_INCLUDED |
79 | |