mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-15 00:24:19 +00:00
Tidied up ListenerList tests
This commit is contained in:
parent
12256536a3
commit
2f00cb1b75
1 changed files with 4 additions and 20 deletions
|
|
@ -75,23 +75,15 @@ class ListenerListTests : public UnitTest
|
|||
public:
|
||||
ListenerListTests() : UnitTest ("ListenerList") {}
|
||||
|
||||
template <typename T>
|
||||
void callHelper (std::vector<int>& expectedCounterValues, T v)
|
||||
template <typename... Args>
|
||||
void callHelper (std::vector<int>& expectedCounterValues)
|
||||
{
|
||||
counter = 0;
|
||||
listeners.call (&ListenerBase::f, v);
|
||||
expect (counter == expectedCounterValues[1]);
|
||||
|
||||
counter = 0;
|
||||
listeners.call (&ListenerBase::f);
|
||||
expect (counter == expectedCounterValues[0]);
|
||||
|
||||
ListenerList<ListenerBase>::DummyBailOutChecker boc;
|
||||
|
||||
counter = 0;
|
||||
listeners.callChecked (boc, &ListenerBase::f, v);
|
||||
expect (counter == expectedCounterValues[1]);
|
||||
|
||||
counter = 0;
|
||||
listeners.callChecked (boc, &ListenerBase::f);
|
||||
expect (counter == expectedCounterValues[0]);
|
||||
|
|
@ -114,24 +106,16 @@ public:
|
|||
callHelper (expectedCounterValues, args...);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename... Args>
|
||||
void callExcludingHelper (ListenerBase& listenerToExclude,
|
||||
std::vector<int>& expectedCounterValues, T v)
|
||||
std::vector<int>& expectedCounterValues)
|
||||
{
|
||||
counter = 0;
|
||||
listeners.callExcluding (listenerToExclude, &ListenerBase::f, v);
|
||||
expect (counter == expectedCounterValues[1]);
|
||||
|
||||
counter = 0;
|
||||
listeners.callExcluding (listenerToExclude, &ListenerBase::f);
|
||||
expect (counter == expectedCounterValues[0]);
|
||||
|
||||
ListenerList<ListenerBase>::DummyBailOutChecker boc;
|
||||
|
||||
counter = 0;
|
||||
listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f, v);
|
||||
expect (counter == expectedCounterValues[1]);
|
||||
|
||||
counter = 0;
|
||||
listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f);
|
||||
expect (counter == expectedCounterValues[0]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue