aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNeeraj Kumar2010-06-28 20:55:28 +0000
committerNeeraj Kumar2010-06-28 20:55:28 +0000
commite022dd7013aaf007ba7594ecf1e15d4c27502704 (patch)
tree52f8e78885d0cbcf4dafe949845ae715abbebf22 /engines
parente3806003ed95d556c3cbe3f1a996d8e11b2a05f7 (diff)
downloadscummvm-rg350-e022dd7013aaf007ba7594ecf1e15d4c27502704.tar.gz
scummvm-rg350-e022dd7013aaf007ba7594ecf1e15d4c27502704.tar.bz2
scummvm-rg350-e022dd7013aaf007ba7594ecf1e15d4c27502704.zip
added template code for testing events
svn-id: r50459
Diffstat (limited to 'engines')
-rw-r--r--engines/testbed/events.cpp58
-rw-r--r--engines/testbed/events.h61
-rw-r--r--engines/testbed/misc.cpp2
-rw-r--r--engines/testbed/module.mk1
4 files changed, 121 insertions, 1 deletions
diff --git a/engines/testbed/events.cpp b/engines/testbed/events.cpp
new file mode 100644
index 0000000000..59521123ff
--- /dev/null
+++ b/engines/testbed/events.cpp
@@ -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
diff --git a/engines/testbed/events.h b/engines/testbed/events.h
new file mode 100644
index 0000000000..33cdb0eeee
--- /dev/null
+++ b/engines/testbed/events.h
@@ -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
diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp
index 471df49044..77614532a5 100644
--- a/engines/testbed/misc.cpp
+++ b/engines/testbed/misc.cpp
@@ -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) {
diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk
index d491f601a8..d14e5b551e 100644
--- a/engines/testbed/module.mk
+++ b/engines/testbed/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/testbed
MODULE_OBJS := \
detection.o \
+ events.o \
fs.o \
graphics.o \
misc.o \