File indexing completed on 2024-05-05 05:53:10

0001 /*
0002  * SPDX-License-Identifier: GPL-3.0-or-later
0003  * SPDX-FileCopyrightText: 2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
0004  */
0005 #include "spy.h"
0006 
0007 namespace test
0008 {
0009 
0010     bool signal_eventually_emitted_exactly(QSignalSpy &spy, int times, int timeout)
0011     {
0012         return (spy.count() >= times || spy.wait(timeout)) && spy.count() == times;
0013     }
0014 
0015     bool signal_eventually_emitted_once(QSignalSpy &spy, int timeout)
0016     {
0017         return signal_eventually_emitted_exactly(spy, 1, timeout);
0018     }
0019 
0020     bool signal_eventually_emitted_twice(QSignalSpy &spy, int timeout)
0021     {
0022         return signal_eventually_emitted_exactly(spy, 2, timeout);
0023     }
0024 }