2010-06-26 13:07:13 +00:00
|
|
|
/* 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$
|
|
|
|
*/
|
|
|
|
|
2010-06-29 22:46:56 +00:00
|
|
|
#include "common/debug-channels.h"
|
2010-05-24 17:43:55 +00:00
|
|
|
#include "common/scummsys.h"
|
2010-05-31 04:58:19 +00:00
|
|
|
#include "common/system.h"
|
2010-06-29 22:46:56 +00:00
|
|
|
|
2010-05-24 17:43:55 +00:00
|
|
|
#include "engines/util.h"
|
2010-07-13 19:26:45 +00:00
|
|
|
|
2010-07-15 18:51:56 +00:00
|
|
|
#include "testbed/config.h"
|
2010-07-03 21:14:44 +00:00
|
|
|
#include "testbed/events.h"
|
2010-06-17 11:23:51 +00:00
|
|
|
#include "testbed/fs.h"
|
2010-06-02 13:56:04 +00:00
|
|
|
#include "testbed/graphics.h"
|
2010-06-27 21:09:57 +00:00
|
|
|
#include "testbed/misc.h"
|
2010-06-25 21:03:53 +00:00
|
|
|
#include "testbed/savegame.h"
|
|
|
|
#include "testbed/testbed.h"
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-05-31 04:58:19 +00:00
|
|
|
namespace Testbed {
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-07-05 21:29:15 +00:00
|
|
|
bool TestbedEngine::hasFeature(EngineFeature f) const {
|
|
|
|
return (f == kSupportsRTL) ? true : false;
|
|
|
|
}
|
|
|
|
|
2010-07-14 14:12:42 +00:00
|
|
|
TestbedEngine::TestbedEngine(OSystem *syst)
|
2010-05-24 17:43:55 +00:00
|
|
|
: Engine(syst) {
|
|
|
|
// Put your engine in a sane state, but do nothing big yet;
|
|
|
|
// in particular, do not load data from files; rather, if you
|
|
|
|
// need to do such things, do them from init().
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-05-24 17:43:55 +00:00
|
|
|
// Do not initialize graphics here
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-05-24 17:43:55 +00:00
|
|
|
// However this is the place to specify all default directories
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-06-29 22:46:56 +00:00
|
|
|
DebugMan.addDebugChannel(kTestbedLogOutput, "LOG", "Log of test results generated by testbed");
|
|
|
|
DebugMan.addDebugChannel(kTestbedEngineDebug, "Debug", "Engine-specific debug statements");
|
|
|
|
DebugMan.enableDebugChannel("LOG");
|
2010-07-01 12:30:56 +00:00
|
|
|
|
|
|
|
// Initialize testsuites here
|
|
|
|
// GFX
|
|
|
|
Testsuite *ts = new GFXTestSuite();
|
|
|
|
_testsuiteList.push_back(ts);
|
|
|
|
// FS
|
|
|
|
ts = new FSTestSuite();
|
|
|
|
_testsuiteList.push_back(ts);
|
|
|
|
// Savegames
|
|
|
|
ts = new SaveGameTestSuite();
|
|
|
|
_testsuiteList.push_back(ts);
|
|
|
|
// Misc.
|
|
|
|
ts = new MiscTestSuite();
|
|
|
|
_testsuiteList.push_back(ts);
|
2010-07-03 21:14:44 +00:00
|
|
|
// Events
|
|
|
|
ts = new EventTestSuite();
|
|
|
|
_testsuiteList.push_back(ts);
|
2010-05-24 17:43:55 +00:00
|
|
|
}
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-05-31 04:58:19 +00:00
|
|
|
TestbedEngine::~TestbedEngine() {
|
2010-06-29 22:46:56 +00:00
|
|
|
Testsuite::deleteWriteStream();
|
2010-05-24 17:43:55 +00:00
|
|
|
// Remove all of our debug levels here
|
2010-06-29 22:46:56 +00:00
|
|
|
DebugMan.clearAllDebugChannels();
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-07-14 19:44:51 +00:00
|
|
|
for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) {
|
2010-07-01 12:30:56 +00:00
|
|
|
delete (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestbedEngine::invokeTestsuites() {
|
2010-07-14 19:44:51 +00:00
|
|
|
Common::Array<Testsuite *>::const_iterator iter;
|
2010-07-19 21:12:17 +00:00
|
|
|
uint count = 1;
|
|
|
|
Common::Point pt = Testsuite::getDisplayRegionCoordinates();
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-07-01 12:30:56 +00:00
|
|
|
for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) {
|
|
|
|
if ((*iter)->isEnabled()) {
|
2010-07-19 21:12:17 +00:00
|
|
|
Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, _testsuiteList.size(), pt);
|
2010-07-01 12:30:56 +00:00
|
|
|
(*iter)->execute();
|
|
|
|
}
|
2010-07-14 19:44:51 +00:00
|
|
|
}
|
2010-05-24 17:43:55 +00:00
|
|
|
}
|
2010-05-31 04:58:19 +00:00
|
|
|
|
|
|
|
Common::Error TestbedEngine::run() {
|
2010-05-24 17:43:55 +00:00
|
|
|
// Initialize graphics using following:
|
|
|
|
initGraphics(320, 200, false);
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-06-06 14:06:51 +00:00
|
|
|
// As of now we are using GUI::MessageDialog for interaction, Test if it works.
|
|
|
|
// interactive mode could also be modified by a config parameter "non-interactive=1"
|
|
|
|
// TODO: Implement that
|
2010-06-02 13:56:04 +00:00
|
|
|
|
2010-07-15 18:51:56 +00:00
|
|
|
TestbedConfigManager cfMan(_testsuiteList);
|
|
|
|
cfMan.selectTestsuites();
|
2010-07-18 07:53:05 +00:00
|
|
|
|
|
|
|
// check if user wanted to exit.
|
|
|
|
if (Engine::shouldQuit()) {
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2010-07-01 12:30:56 +00:00
|
|
|
invokeTestsuites();
|
2010-05-24 17:43:55 +00:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
2010-07-14 14:12:42 +00:00
|
|
|
|
2010-05-31 04:58:19 +00:00
|
|
|
} // End of namespace Testbed
|