diff --git a/tests/profile/conversion/version_10.profile b/tests/profile/conversion/version_10.profile new file mode 100644 index 0000000000..9d2393e51f --- /dev/null +++ b/tests/profile/conversion/version_10.profile @@ -0,0 +1,116 @@ +{ + "version": { "major": 1, "minor": 0 }, + "meta": { + "name": "name", + "version": "version", + "description": "description", + "author": "author", + "url": "url", + "license": "license" + }, + "modules": [ + { "name": "abs-module" }, + { + "name": "def-module", + "loadedInstruction": "instr" + }, + { + "name": "ghi-module", + "notLoadedInstruction": "not_instr" + }, + { + "name": "jkl-module", + "loadedInstruction": "instr", + "notLoadedInstruction": "not_instr" + } + ], + "assets": [ + "scene/solarsystem/planets/earth/earth", + "scene/solarsystem/planets/earth/satellites/satellites", + "folder1/folder2/asset", + "folder3/folder4/asset2", + "folder5/folder6/asset3" + ], + "properties": [ + { + "type": "setPropertyValue", + "name": "{earth_satellites}.Renderable.Enabled", + "value": "false" + }, + { + "type": "setPropertyValue", + "name": "property_name_1", + "value": "property_value_1" + }, + { + "type": "setPropertyValue", + "name": "property_name_2", + "value": "property_value_2" + }, + { + "type": "setPropertyValue", + "name": "property_name_3", + "value": "property_value_3" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_4", + "value": "property_value_4" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_5", + "value": "property_value_5" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_6", + "value": "property_value_6" + } + ], + "keybindings": [ + { + "key": "T", + "documentation": "T documentation", + "name": "T name", + "gui_path": "T Gui-Path", + "is_local": true, + "script": "T script" + }, + { + "key": "U", + "documentation": "U documentation", + "name": "U name", + "gui_path": "U Gui-Path", + "is_local": false, + "script": "U script" + }, + { + "key": "CTRL+V", + "documentation": "CTRL+V documentation", + "name": "CTRL+V name", + "gui_path": "CTRL+V Gui-Path", + "is_local": false, + "script": "CTRL+V script" + } + ], + "time": { + "type": "relative", + "value": "-1d" + }, + "camera": { + "type": "goToGeo", + "anchor": "Earth", + "latitude": 58.5877, + "longitude": 16.1924, + "altitude": 2.0e+07 + }, + "mark_nodes": [ + "Earth", "Mars", "Moon", "Sun" + ], + "additional_scripts": [ + "script-1", + "script-2", + "script-3" + ] +} diff --git a/tests/profile/conversion/version_11.profile b/tests/profile/conversion/version_11.profile new file mode 100644 index 0000000000..594593dea5 --- /dev/null +++ b/tests/profile/conversion/version_11.profile @@ -0,0 +1,130 @@ +{ + "version": { "major": 1, "minor": 1 }, + "meta": { + "name": "name", + "version": "version", + "description": "description", + "author": "author", + "url": "url", + "license": "license" + }, + "modules": [ + { "name": "abs-module" }, + { + "name": "def-module", + "loadedInstruction": "instr" + }, + { + "name": "ghi-module", + "notLoadedInstruction": "not_instr" + }, + { + "name": "jkl-module", + "loadedInstruction": "instr", + "notLoadedInstruction": "not_instr" + } + ], + "assets": [ + "scene/solarsystem/planets/earth/earth", + "scene/solarsystem/planets/earth/satellites/satellites", + "folder1/folder2/asset", + "folder3/folder4/asset2", + "folder5/folder6/asset3" + ], + "properties": [ + { + "type": "setPropertyValue", + "name": "{earth_satellites}.Renderable.Enabled", + "value": "false" + }, + { + "type": "setPropertyValue", + "name": "property_name_1", + "value": "property_value_1" + }, + { + "type": "setPropertyValue", + "name": "property_name_2", + "value": "property_value_2" + }, + { + "type": "setPropertyValue", + "name": "property_name_3", + "value": "property_value_3" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_4", + "value": "property_value_4" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_5", + "value": "property_value_5" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_6", + "value": "property_value_6" + } + ], + "actions": [ + { + "identifier": "profile.keybind.0", + "documentation": "T documentation", + "name": "T name", + "gui_path": "T Gui-Path", + "is_local": true, + "script": "T script" + }, + { + "identifier": "profile.keybind.1", + "documentation": "U documentation", + "name": "U name", + "gui_path": "U Gui-Path", + "is_local": false, + "script": "U script" + }, + { + "identifier": "profile.keybind.2", + "documentation": "CTRL+V documentation", + "name": "CTRL+V name", + "gui_path": "CTRL+V Gui-Path", + "is_local": false, + "script": "CTRL+V script" + } + ], + "keybindings": [ + { + "action": "profile.keybind.0", + "key": "T" + }, + { + "action": "profile.keybind.1", + "key": "U" + }, + { + "action": "profile.keybind.2", + "key": "CTRL+V" + } + ], + "time": { + "type": "relative", + "value": "-1d" + }, + "camera": { + "type": "goToGeo", + "anchor": "Earth", + "latitude": 58.5877, + "longitude": 16.1924, + "altitude": 2.0e+07 + }, + "mark_nodes": [ + "Earth", "Mars", "Moon", "Sun" + ], + "additional_scripts": [ + "script-1", + "script-2", + "script-3" + ] +} diff --git a/tests/profile/conversion/version_12.profile b/tests/profile/conversion/version_12.profile new file mode 100644 index 0000000000..60bc75ff5f --- /dev/null +++ b/tests/profile/conversion/version_12.profile @@ -0,0 +1,131 @@ +{ + "version": { "major": 1, "minor": 2 }, + "meta": { + "name": "name", + "version": "version", + "description": "description", + "author": "author", + "url": "url", + "license": "license" + }, + "modules": [ + { "name": "abs-module" }, + { + "name": "def-module", + "loadedInstruction": "instr" + }, + { + "name": "ghi-module", + "notLoadedInstruction": "not_instr" + }, + { + "name": "jkl-module", + "loadedInstruction": "instr", + "notLoadedInstruction": "not_instr" + } + ], + "assets": [ + "scene/solarsystem/planets/earth/earth", + "scene/solarsystem/planets/earth/satellites/satellites", + "folder1/folder2/asset", + "folder3/folder4/asset2", + "folder5/folder6/asset3" + ], + "properties": [ + { + "type": "setPropertyValue", + "name": "{earth_satellites}.Renderable.Enabled", + "value": "false" + }, + { + "type": "setPropertyValue", + "name": "property_name_1", + "value": "property_value_1" + }, + { + "type": "setPropertyValue", + "name": "property_name_2", + "value": "property_value_2" + }, + { + "type": "setPropertyValue", + "name": "property_name_3", + "value": "property_value_3" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_4", + "value": "property_value_4" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_5", + "value": "property_value_5" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_6", + "value": "property_value_6" + } + ], + "actions": [ + { + "identifier": "profile.keybind.0", + "documentation": "T documentation", + "name": "T name", + "gui_path": "T Gui-Path", + "is_local": true, + "script": "T script" + }, + { + "identifier": "profile.keybind.1", + "documentation": "U documentation", + "name": "U name", + "gui_path": "U Gui-Path", + "is_local": false, + "script": "U script" + }, + { + "identifier": "profile.keybind.2", + "documentation": "CTRL+V documentation", + "name": "CTRL+V name", + "gui_path": "CTRL+V Gui-Path", + "is_local": false, + "script": "CTRL+V script" + } + ], + "keybindings": [ + { + "action": "profile.keybind.0", + "key": "T" + }, + { + "action": "profile.keybind.1", + "key": "U" + }, + { + "action": "profile.keybind.2", + "key": "CTRL+V" + } + ], + "time": { + "type": "relative", + "value": "-1d", + "is_paused": false + }, + "camera": { + "type": "goToGeo", + "anchor": "Earth", + "latitude": 58.5877, + "longitude": 16.1924, + "altitude": 2.0e+07 + }, + "mark_nodes": [ + "Earth", "Mars", "Moon", "Sun" + ], + "additional_scripts": [ + "script-1", + "script-2", + "script-3" + ] +} diff --git a/tests/profile/conversion/version_13.profile b/tests/profile/conversion/version_13.profile new file mode 100644 index 0000000000..0d97a97633 --- /dev/null +++ b/tests/profile/conversion/version_13.profile @@ -0,0 +1,131 @@ +{ + "version": { "major": 1, "minor": 3 }, + "meta": { + "name": "name", + "version": "version", + "description": "description", + "author": "author", + "url": "url", + "license": "license" + }, + "modules": [ + { "name": "abs-module" }, + { + "name": "def-module", + "loadedInstruction": "instr" + }, + { + "name": "ghi-module", + "notLoadedInstruction": "not_instr" + }, + { + "name": "jkl-module", + "loadedInstruction": "instr", + "notLoadedInstruction": "not_instr" + } + ], + "assets": [ + "scene/solarsystem/planets/earth/earth", + "scene/solarsystem/planets/earth/satellites/satellites", + "folder1/folder2/asset", + "folder3/folder4/asset2", + "folder5/folder6/asset3" + ], + "properties": [ + { + "type": "setPropertyValue", + "name": "{earth_satellites}.Renderable.Enabled", + "value": "false" + }, + { + "type": "setPropertyValue", + "name": "property_name_1", + "value": "property_value_1" + }, + { + "type": "setPropertyValue", + "name": "property_name_2", + "value": "property_value_2" + }, + { + "type": "setPropertyValue", + "name": "property_name_3", + "value": "property_value_3" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_4", + "value": "property_value_4" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_5", + "value": "property_value_5" + }, + { + "type": "setPropertyValueSingle", + "name": "property_name_6", + "value": "property_value_6" + } + ], + "actions": [ + { + "identifier": "profile.keybind.0", + "documentation": "T documentation", + "name": "T name", + "gui_path": "T Gui-Path", + "is_local": true, + "script": "T script" + }, + { + "identifier": "profile.keybind.1", + "documentation": "U documentation", + "name": "U name", + "gui_path": "U Gui-Path", + "is_local": false, + "script": "U script" + }, + { + "identifier": "profile.keybind.2", + "documentation": "CTRL+V documentation", + "name": "CTRL+V name", + "gui_path": "CTRL+V Gui-Path", + "is_local": false, + "script": "CTRL+V script" + } + ], + "keybindings": [ + { + "action": "profile.keybind.0", + "key": "T" + }, + { + "action": "profile.keybind.1", + "key": "U" + }, + { + "action": "profile.keybind.2", + "key": "CTRL+V" + } + ], + "time": { + "type": "relative", + "value": "-1d", + "is_paused": false + }, + "camera": { + "type": "goToGeo", + "anchor": "Earth", + "latitude": 58.5877, + "longitude": 16.1924, + "altitude": 2.0e+07 + }, + "mark_nodes": [ + "Earth", "Mars", "Moon", "Sun" + ], + "additional_scripts": [ + "script-1", + "script-2", + "script-3" + ] +} diff --git a/tests/test_profile.cpp b/tests/test_profile.cpp index 3da07cb636..a37dc2fff1 100644 --- a/tests/test_profile.cpp +++ b/tests/test_profile.cpp @@ -861,6 +861,62 @@ TEST_CASE("Save settings to profile", "[profile]") { CHECK(profile.time->value == "current-time"); } +TEST_CASE("Version 1.0 -> 1.1", "[profile]") { + constexpr std::string_view Src = "${TESTDIR}/profile/conversion/version_10.profile"; + constexpr std::string_view Dest = "${TESTDIR}/profile/conversion/version_11.profile"; + + Profile src = Profile(absPath(Src)); + Profile dst = Profile(absPath(Dest)); + CHECK(src == dst); +} + +TEST_CASE("Version 1.0 -> 1.2", "[profile]") { + constexpr std::string_view Src = "${TESTDIR}/profile/conversion/version_10.profile"; + constexpr std::string_view Dest = "${TESTDIR}/profile/conversion/version_12.profile"; + + Profile src = Profile(absPath(Src)); + Profile dst = Profile(absPath(Dest)); + CHECK(src == dst); +} + +TEST_CASE("Version 1.0 -> 1.3", "[profile]") { + constexpr std::string_view Src = "${TESTDIR}/profile/conversion/version_10.profile"; + constexpr std::string_view Dest = "${TESTDIR}/profile/conversion/version_13.profile"; + + Profile src = Profile(absPath(Src)); + Profile dst = Profile(absPath(Dest)); + CHECK(src == dst); +} + +TEST_CASE("Version 1.1 -> 1.2", "[profile]") { + constexpr std::string_view Src = "${TESTDIR}/profile/conversion/version_11.profile"; + constexpr std::string_view Dest = "${TESTDIR}/profile/conversion/version_12.profile"; + + Profile src = Profile(absPath(Src)); + Profile dst = Profile(absPath(Dest)); + CHECK(src == dst); +} + +TEST_CASE("Version 1.1 -> 1.3", "[profile]") { + constexpr std::string_view Src = "${TESTDIR}/profile/conversion/version_11.profile"; + constexpr std::string_view Dest = "${TESTDIR}/profile/conversion/version_13.profile"; + + Profile src = Profile(absPath(Src)); + Profile dst = Profile(absPath(Dest)); + CHECK(src == dst); +} + +TEST_CASE("Version 1.2 -> 1.3", "[profile]") { + constexpr std::string_view Src = "${TESTDIR}/profile/conversion/version_12.profile"; + constexpr std::string_view Dest = "${TESTDIR}/profile/conversion/version_13.profile"; + + Profile src = Profile(absPath(Src)); + Profile dst = Profile(absPath(Dest)); + CHECK(src == dst); +} + + + // // Error states //