2013-07-16 19:02:30 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- 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
|
|
|
|
|
|
|
|
#include "base/Log.h"
|
|
|
|
|
#include "base/SimpleEventQueueBuffer.h"
|
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-07-02 19:07:06 +00:00
|
|
|
void TestEventQueue::raiseQuitEvent() { addEvent(Event(Event::kQuit)); }
|
2013-07-16 19:02:30 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void TestEventQueue::initQuitTimeout(double timeout) {
|
|
|
|
|
assert(m_quitTimeoutTimer == nullptr);
|
|
|
|
|
m_quitTimeoutTimer = newOneShotTimer(timeout, NULL);
|
2024-07-16 13:36:44 +00:00
|
|
|
adoptHandler(
|
|
|
|
|
Event::kTimer, m_quitTimeoutTimer,
|
|
|
|
|
new TMethodEventJob<TestEventQueue>(
|
|
|
|
|
this, &TestEventQueue::handleQuitTimeout));
|
2013-07-16 19:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void TestEventQueue::cleanupQuitTimeout() {
|
|
|
|
|
removeHandler(Event::kTimer, m_quitTimeoutTimer);
|
|
|
|
|
delete m_quitTimeoutTimer;
|
|
|
|
|
m_quitTimeoutTimer = nullptr;
|
2013-07-16 19:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void TestEventQueue::handleQuitTimeout(const Event &, void *vclient) {
|
|
|
|
|
throw std::runtime_error("test event queue timeout");
|
2013-07-16 19:02:30 +00:00
|
|
|
}
|