Showing the changes to interface/src/scripting/TestScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <DependencyManager.h> |
| 15 | 15 | #include <Trace.h> |
| 16 | 16 | #include <StatTracker.h> |
| 17 | +#include <OffscreenUi.h> | |
| 17 | 18 | |
| 18 | 19 | #include "Application.h" |
| 19 | 20 | |
| @@ -54,24 +55,20 @@ void TestScriptingInterface::waitIdle() { · 34 unmodified lines | ||
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | bool TestScriptingInterface::loadTestScene(QString scene) { |
| 57 | − // FIXME implement | |
| 58 | − // qApp->postLambdaEvent([isClient] { | |
| 59 | − // auto tree = qApp->getEntityClipboard(); | |
| 60 | − // tree->setIsClient(isClient); | |
| 61 | − // }); | |
| 62 | − /* | |
| 63 | − Test.setClientTree(false); | |
| 64 | − Resources.overrideUrlPrefix("atp:/", TEST_BINARY_ROOT + scene + ".atp/"); | |
| 65 | − if (!Clipboard.importEntities(TEST_SCENES_ROOT + scene + ".json")) { | |
| 66 | − return false; | |
| 67 | − } | |
| 68 | − var position = { x: 0, y: 0, z: 0 }; | |
| 69 | − var pastedEntityIDs = Clipboard.pasteEntities(position); | |
| 70 | − for (var id in pastedEntityIDs) { | |
| 71 | − print("QQQ ID imported " + id); | |
| 72 | − } | |
| 73 | − */ | |
| 74 | − return false; | |
| 58 | + static const QString TEST_ROOT = "https://raw.githubusercontent.com/highfidelity/hifi_tests/master/"; | |
| 59 | + static const QString TEST_BINARY_ROOT = "https://hifi-public.s3.amazonaws.com/test_scene_data/"; | |
| 60 | + static const QString TEST_SCRIPTS_ROOT = TEST_ROOT + "scripts/"; | |
| 61 | + static const QString TEST_SCENES_ROOT = TEST_ROOT + "scenes/"; | |
| 62 | + return DependencyManager::get<OffscreenUi>()->returnFromUiThread([scene]()->QVariant { | |
| 63 | + ResourceManager::setUrlPrefixOverride("atp:/", TEST_BINARY_ROOT + scene + ".atp/"); | |
| 64 | + auto tree = qApp->getEntities()->getTree(); | |
| 65 | + auto treeIsClient = tree->getIsClient(); | |
| 66 | + // Force the tree to accept the load regardless of permissions | |
| 67 | + tree->setIsClient(false); | |
| 68 | + auto result = tree->readFromURL(TEST_SCENES_ROOT + scene + ".json"); | |
| 69 | + tree->setIsClient(treeIsClient); | |
| 70 | + return result; | |
| 71 | + }).toBool(); | |
| 75 | 72 | } |
| 76 | 73 | |
| 77 | 74 | bool TestScriptingInterface::startTracing(QString logrules) { |