mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
added template code for testing events
svn-id: r50459
This commit is contained in:
parent
e3806003ed
commit
e022dd7013
58
engines/testbed/events.cpp
Normal file
58
engines/testbed/events.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "common/events.h"
|
||||
|
||||
#include "testbed/events.h"
|
||||
|
||||
namespace Testbed {
|
||||
|
||||
bool EventTests::mouseEvents() {
|
||||
Common::EventManager *eventMan = g_system->getEventManager();
|
||||
|
||||
bool quitLoop = false;
|
||||
Common::Event event;
|
||||
while (!quitLoop) {
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
// handle all mouse events
|
||||
// TODO: tommorrow
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EventTestSuite::EventTestSuite() {
|
||||
addTest("Mouse Events", &EventTests::mouseEvents);
|
||||
}
|
||||
const char *EventTestSuite::getName() const {
|
||||
return "Events";
|
||||
}
|
||||
|
||||
} // End of namespace Testbed
|
61
engines/testbed/events.h
Normal file
61
engines/testbed/events.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TESTBED_EVENTS_H
|
||||
#define TESTBED_EVENTS_H
|
||||
|
||||
#include "testbed/testsuite.h"
|
||||
|
||||
|
||||
namespace Testbed {
|
||||
|
||||
namespace EventTests {
|
||||
|
||||
// Helper functions for Event tests
|
||||
|
||||
// will contain function declarations for Event tests
|
||||
bool mouseEvents();
|
||||
bool keybdEvents();
|
||||
// add more here
|
||||
}
|
||||
|
||||
class EventTestSuite : public Testsuite {
|
||||
public:
|
||||
/**
|
||||
* The constructor for the EventTestSuite
|
||||
* For every test to be executed one must:
|
||||
* 1) Create a function that would invoke the test
|
||||
* 2) Add that test to list by executing addTest()
|
||||
*
|
||||
* @see addTest()
|
||||
*/
|
||||
EventTestSuite();
|
||||
~EventTestSuite(){}
|
||||
const char *getName() const;
|
||||
|
||||
};
|
||||
|
||||
} // End of namespace Testbed
|
||||
|
||||
#endif
|
@ -39,7 +39,7 @@ void MiscTests::timerCallback(void *arg) {
|
||||
// Increment arg which actually points to an int
|
||||
// arg must point to a static data, threads otherwise have their own stack
|
||||
int &valToModify = *((int *) arg);
|
||||
valToModify = 999; // some arrbit value
|
||||
valToModify = 999; // some arbitrary value
|
||||
}
|
||||
|
||||
void MiscTests::criticalSection(void *arg) {
|
||||
|
@ -2,6 +2,7 @@ MODULE := engines/testbed
|
||||
|
||||
MODULE_OBJS := \
|
||||
detection.o \
|
||||
events.o \
|
||||
fs.o \
|
||||
graphics.o \
|
||||
misc.o \
|
||||
|
Loading…
x
Reference in New Issue
Block a user