diff --git a/tests/script-engine/CMakeLists.txt b/tests/script-engine/CMakeLists.txt index 1dd863d727..1e4428239c 100644 --- a/tests/script-engine/CMakeLists.txt +++ b/tests/script-engine/CMakeLists.txt @@ -8,25 +8,6 @@ macro (setup_testcase_dependencies) link_hifi_libraries(shared test-utils script-engine networking octree avatars entities model-networking material-networking model-serializers graphics gpu ktx shaders hfm image procedural) package_libraries_for_deployment() - - - # The test system is a bit unusual in how it works, and generates targets on its own. - # This macro will be called for each of them, so we want to add stuff only to the - # right targets. - if("${TARGET_NAME}" STREQUAL "script-engine-ScriptEngineTests") - - # We're going with a symlink here for ease of development -- can change the test - # without recompiling. We probably never are going to package the tests, or use - # them outside of development. - # - # Symlinks should also work fine on Windows. They're a supported feature, though - # a very rarely used one. - add_custom_command(TARGET "${TARGET_NAME}" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink - "${CMAKE_CURRENT_SOURCE_DIR}/src/tests" - "${CMAKE_CURRENT_BINARY_DIR}/tests" - ) - endif() endmacro () setup_hifi_testcase(Network) diff --git a/tests/script-engine/src/ScriptEngineTests.cpp b/tests/script-engine/src/ScriptEngineTests.cpp index 318ea59ab3..8ad353f846 100644 --- a/tests/script-engine/src/ScriptEngineTests.cpp +++ b/tests/script-engine/src/ScriptEngineTests.cpp @@ -333,42 +333,3 @@ void ScriptEngineTests::testQuat() { sm->run(); } - -void ScriptEngineTests::scriptTest() { - return; - - QSharedPointer ac = DependencyManager::get(); - QVERIFY(!ac.isNull()); - - - QDir testScriptsDir("tests"); - QStringList testScripts = testScriptsDir.entryList(QStringList() << "*.js", QDir::Files); - testScripts.sort(); - - for(QString scriptFilename : testScripts) { - scriptFilename = "tests/" + scriptFilename; - qInfo() << "Running test script: " << scriptFilename; - - QString scriptSource; - - { - QFile scriptFile(scriptFilename); - scriptFile.open(QIODevice::ReadOnly); - QTextStream scriptStream(&scriptFile); - scriptSource.append(scriptStream.readAll()); - - // Scripts keep on running until Script.stop() is called. For our tests here, - // that's not desirable, so we append an automatic stop at the end of every - // script. - scriptSource.append("\nScript.stop(true);\n"); - } - - - //qDebug() << "Source: " << scriptSource; - - ScriptManagerPointer sm = makeManager(scriptSource, scriptFilename); - sm->run(); - } - - //TODO: Add a test for Script.require(JSON) -} diff --git a/tests/script-engine/src/ScriptEngineTests.h b/tests/script-engine/src/ScriptEngineTests.h index b37b0d6d5d..f20d6d0a7e 100644 --- a/tests/script-engine/src/ScriptEngineTests.h +++ b/tests/script-engine/src/ScriptEngineTests.h @@ -54,7 +54,6 @@ class ScriptEngineTests : public QObject { Q_OBJECT private slots: void initTestCase(); - void scriptTest(); void testTrivial(); void testSyntaxError(); void testRuntimeError(); diff --git a/tests/script-engine/src/networked_tests/004_require.js b/tests/script-engine/src/networked_tests/004_require.js deleted file mode 100644 index 10345ef596..0000000000 --- a/tests/script-engine/src/networked_tests/004_require.js +++ /dev/null @@ -1,11 +0,0 @@ -print("Script.require: " + JSON.stringify(Script.require)); -print("Script.require.cache: " + JSON.stringify(Script.require.cache)); -print(JSON.stringify("Script.require.test_prop before defining: " + Script.require.test_prop)); -Script.require.test_prop = "test property"; -print(JSON.stringify("Script.require.test_prop after defining: " + Script.require.test_prop)); -print("Before require"); -// TODO: find correct local path for the test module -requireTest = Script.require("http://oaktown.pl/scripts/004b_require_module.js"); -print("After require"); -requireTest.moduleFunction1(); -requireTest.moduleFunction2(); diff --git a/tests/script-engine/src/networked_tests/004b_require_module.js b/tests/script-engine/src/networked_tests/004b_require_module.js deleted file mode 100644 index 186746c9d1..0000000000 --- a/tests/script-engine/src/networked_tests/004b_require_module.js +++ /dev/null @@ -1,9 +0,0 @@ -print("Print inside module script"); -module.exports = { - moduleFunction1: function () { - print("moduleFunction1 works"); - }, - moduleFunction2: function () { - print("moduleFunction2 works"); - } -}; \ No newline at end of file diff --git a/tests/script-engine/src/networked_tests/005_include.js b/tests/script-engine/src/networked_tests/005_include.js deleted file mode 100644 index eb392b0067..0000000000 --- a/tests/script-engine/src/networked_tests/005_include.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Script.include("./005b_included.js"); - -//var requireTest = Script.require("http://oaktown.pl/scripts/004b_require_module.js"); - -var testObject = new TestObject(); - -function functionInMainFile () { - print("In main file"); -} - -functionInInclude(); \ No newline at end of file diff --git a/tests/script-engine/src/networked_tests/005b_included.js b/tests/script-engine/src/networked_tests/005b_included.js deleted file mode 100644 index a15b05697d..0000000000 --- a/tests/script-engine/src/networked_tests/005b_included.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -function functionInInclude() { - print("Function in include"); - functionInMainFile(); -} - -var TestObject = function(shouldUseEditTabletApp) { - var requireTest = Script.require("http://oaktown.pl/scripts/004b_require_module.js"); - - var onEvent = function(data) { - that.thatFunction(); - } - var that = {}; - that.thatFunction = function() { - functionInMainFile(); - } - Script.update.connect(onEvent); -} - -functionInMainFile(); - -//Script.setInterval(functionInInclude, 1000); diff --git a/tests/script-engine/src/tests/001_test_print.js b/tests/script-engine/src/tests/001_test_print.js deleted file mode 100644 index 66e8e97da4..0000000000 --- a/tests/script-engine/src/tests/001_test_print.js +++ /dev/null @@ -1,12 +0,0 @@ -// -// Copyright 2023 Overte e.V. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// SPDX-License-Identifier: Apache-2.0 -// - -var v = 1; -for (v = 1; v < 30; v++){ - print(v); -} diff --git a/tests/script-engine/src/tests/002_console_log.js b/tests/script-engine/src/tests/002_console_log.js deleted file mode 100644 index cd04ee57ab..0000000000 --- a/tests/script-engine/src/tests/002_console_log.js +++ /dev/null @@ -1,9 +0,0 @@ -// -// Copyright 2023 Overte e.V. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// SPDX-License-Identifier: Apache-2.0 -// - -console.log("I'm testing!"); diff --git a/tests/script-engine/src/tests/003_vector_math.js b/tests/script-engine/src/tests/003_vector_math.js deleted file mode 100644 index 7816844ea1..0000000000 --- a/tests/script-engine/src/tests/003_vector_math.js +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright 2023 Overte e.V. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// SPDX-License-Identifier: Apache-2.0 -// - -print(JSON.stringify(this)); -var v1 = { x: 1, y: 0, z: 3 }; -var v2 = { x: 1, y: 0, z: 1 }; -print(JSON.stringify(Vec3.sum(v1,v2))); -console.log("Test message"); -print(JSON.stringify(TREE_SCALE)); -print(JSON.stringify(Vec3.sum(v1,v2))); -print(JSON.stringify(TREE_SCALE)); diff --git a/tests/script-engine/src/tests/010_exception.js b/tests/script-engine/src/tests/010_exception.js deleted file mode 100644 index a280f9a5cc..0000000000 --- a/tests/script-engine/src/tests/010_exception.js +++ /dev/null @@ -1 +0,0 @@ -foo();