mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-13 20:20:37 +00:00
TESTBED: Give achievements for completed testsuites
This commit is contained in:
parent
2df0675fbf
commit
24c34a1fe8
@ -26,6 +26,7 @@
|
||||
#include "base/plugins.h"
|
||||
|
||||
#include "testbed/testbed.h"
|
||||
#include "testbed/testsuite.h"
|
||||
|
||||
static const PlainGameDescriptor testbed_setting[] = {
|
||||
{ "testbed", "Testbed: The Backend Testing Framework" },
|
||||
@ -69,6 +70,24 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
const Common::AchievementsInfo getAchievementsInfo(const Common::String &target) const override {
|
||||
Common::AchievementsInfo result;
|
||||
result.platform = Common::UNK_ACHIEVEMENTS;
|
||||
result.appId = "testbed";
|
||||
Common::AchievementDescription final = {"EVERYTHINGWORKS", true, "Everything works!", "Completed all available testsuites"};
|
||||
result.descriptions.push_back(final);
|
||||
|
||||
Common::Array<Testbed::Testsuite *> testsuiteList;
|
||||
Testbed::TestbedEngine::pushTestsuites(testsuiteList);
|
||||
for (Common::Array<Testbed::Testsuite *>::const_iterator i = testsuiteList.begin(); i != testsuiteList.end(); ++i) {
|
||||
Common::AchievementDescription it = {(*i)->getName(), false, (*i)->getDescription(), 0};
|
||||
result.descriptions.push_back(it);
|
||||
delete (*i);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool hasFeature(MetaEngineFeature f) const override {
|
||||
return false;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/achievements.h"
|
||||
#include "common/debug-channels.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "common/archive.h"
|
||||
@ -196,13 +197,30 @@ void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) {
|
||||
Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, numSuitesEnabled, pt);
|
||||
(*iter)->execute();
|
||||
}
|
||||
if ((*iter)->getNumTests() == (*iter)->getNumTestsPassed()) {
|
||||
AchMan.setAchievement((*iter)->getName(), (*iter)->getDescription());
|
||||
checkForAllAchievements();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestbedEngine::checkForAllAchievements() {
|
||||
Common::Array<Testsuite *>::const_iterator iter;
|
||||
for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) {
|
||||
if (!AchMan.isAchieved((*iter)->getName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
AchMan.setAchievement("EVERYTHINGWORKS", "Everything works!");
|
||||
}
|
||||
|
||||
Common::Error TestbedEngine::run() {
|
||||
// Initialize graphics using following:
|
||||
initGraphics(320, 200);
|
||||
|
||||
// Initialize achievements manager
|
||||
AchMan.setActiveDomain(Common::UNK_ACHIEVEMENTS, "testbed");
|
||||
|
||||
// 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
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
bool hasFeature(EngineFeature f) const override;
|
||||
|
||||
private:
|
||||
void checkForAllAchievements();
|
||||
Common::Array<Testsuite *> _testsuiteList;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user