Implement test scene loading

This commit is contained in:
Brad Davis 2016-12-22 13:12:59 -08:00
parent e58623bcc0
commit be6b098e1b

View file

@ -14,6 +14,7 @@
#include <DependencyManager.h>
#include <Trace.h>
#include <StatTracker.h>
#include <OffscreenUi.h>
#include "Application.h"
@ -54,24 +55,20 @@ void TestScriptingInterface::waitIdle() {
}
bool TestScriptingInterface::loadTestScene(QString scene) {
// FIXME implement
// qApp->postLambdaEvent([isClient] {
// auto tree = qApp->getEntityClipboard();
// tree->setIsClient(isClient);
// });
/*
Test.setClientTree(false);
Resources.overrideUrlPrefix("atp:/", TEST_BINARY_ROOT + scene + ".atp/");
if (!Clipboard.importEntities(TEST_SCENES_ROOT + scene + ".json")) {
return false;
}
var position = { x: 0, y: 0, z: 0 };
var pastedEntityIDs = Clipboard.pasteEntities(position);
for (var id in pastedEntityIDs) {
print("QQQ ID imported " + id);
}
*/
return false;
static const QString TEST_ROOT = "https://raw.githubusercontent.com/highfidelity/hifi_tests/master/";
static const QString TEST_BINARY_ROOT = "https://hifi-public.s3.amazonaws.com/test_scene_data/";
static const QString TEST_SCRIPTS_ROOT = TEST_ROOT + "scripts/";
static const QString TEST_SCENES_ROOT = TEST_ROOT + "scenes/";
return DependencyManager::get<OffscreenUi>()->returnFromUiThread([scene]()->QVariant {
ResourceManager::setUrlPrefixOverride("atp:/", TEST_BINARY_ROOT + scene + ".atp/");
auto tree = qApp->getEntities()->getTree();
auto treeIsClient = tree->getIsClient();
// Force the tree to accept the load regardless of permissions
tree->setIsClient(false);
auto result = tree->readFromURL(TEST_SCENES_ROOT + scene + ".json");
tree->setIsClient(treeIsClient);
return result;
}).toBool();
}
bool TestScriptingInterface::startTracing(QString logrules) {