2013-07-16 19:02:30 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2016-09-07 14:24:00 +00:00
|
|
|
* Copyright (C) 2013-2016 Symless Ltd.
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2013-07-16 19:02:30 +00:00
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2013-07-16 19:02:30 +00:00
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-07-17 08:22:46 +00:00
|
|
|
#include "test/shared/TestEventQueue.h"
|
2014-02-28 12:36:45 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
#include "base/TMethodEventJob.h"
|
2014-03-14 20:33:18 +00:00
|
|
|
#include "common/stdexcept.h"
|
2013-07-16 19:02:30 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void TestEventQueue::raiseQuitEvent()
|
|
|
|
|
{
|
|
|
|
|
addEvent(Event(Event::kQuit));
|
|
|
|
|
}
|
2013-07-16 19:02:30 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void TestEventQueue::initQuitTimeout(double timeout)
|
|
|
|
|
{
|
2024-08-01 00:13:01 +00:00
|
|
|
assert(m_pQuitTimeoutTimer == nullptr);
|
|
|
|
|
m_pQuitTimeoutTimer = newOneShotTimer(timeout, NULL);
|
2024-07-16 13:36:44 +00:00
|
|
|
adoptHandler(
|
2024-10-17 18:04:35 +00:00
|
|
|
Event::kTimer, m_pQuitTimeoutTimer, new TMethodEventJob<TestEventQueue>(this, &TestEventQueue::handleQuitTimeout)
|
|
|
|
|
);
|
2013-07-16 19:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void TestEventQueue::cleanupQuitTimeout()
|
|
|
|
|
{
|
2024-08-01 00:13:01 +00:00
|
|
|
removeHandler(Event::kTimer, m_pQuitTimeoutTimer);
|
2024-08-07 14:05:18 +00:00
|
|
|
deleteTimer(m_pQuitTimeoutTimer);
|
2024-08-01 00:13:01 +00:00
|
|
|
m_pQuitTimeoutTimer = nullptr;
|
2013-07-16 19:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void TestEventQueue::handleQuitTimeout(const Event &, void *vclient)
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
throw std::runtime_error("test event queue timeout");
|
2013-07-16 19:02:30 +00:00
|
|
|
}
|