diff --git a/interface/src/scripting/TestScriptingInterface.cpp b/interface/src/scripting/TestScriptingInterface.cpp index 8bc601ec83..3d9e84ce63 100644 --- a/interface/src/scripting/TestScriptingInterface.cpp +++ b/interface/src/scripting/TestScriptingInterface.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #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()->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) {