1
0
Fork 0
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:
tpoole 2016-11-28 20:11:03 +00:00
parent 12256536a3
commit 2f00cb1b75

View file

@ -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]);