Simplify profile loading and handling of the loading screen

This commit is contained in:
Alexander Bock
2024-02-28 00:19:06 +01:00
parent 0203d723e8
commit 7a2efc66d6
9 changed files with 290 additions and 310 deletions
+94 -111
View File
@@ -146,30 +146,13 @@ namespace openspace {
using namespace openspace;
namespace {
/// Loads the contents of the file and creates a profile from it
Profile loadProfile(const std::filesystem::path& filename) {
if (!std::filesystem::exists(filename)) {
throw std::runtime_error("Could not find file)");
}
std::ifstream f(filename);
std::string content(
(std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>()
);
return Profile(content);
}
} // namespace
//
// Minimal
// The absolute minimal profile that can be loaded
//
TEST_CASE("Minimal", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/minimal.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -182,7 +165,7 @@ TEST_CASE("Minimal", "[profile]") {
//
TEST_CASE("Basic Meta (full)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_full.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -201,7 +184,7 @@ TEST_CASE("Basic Meta (full)", "[profile]") {
TEST_CASE("Basic Meta (empty)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_empty.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -214,7 +197,7 @@ TEST_CASE("Basic Meta (empty)", "[profile]") {
TEST_CASE("Basic Meta (no name)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_no_name.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -232,7 +215,7 @@ TEST_CASE("Basic Meta (no name)", "[profile]") {
TEST_CASE("Basic Meta (no version)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_no_version.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -250,7 +233,7 @@ TEST_CASE("Basic Meta (no version)", "[profile]") {
TEST_CASE("Basic Meta (no description)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_no_description.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -268,7 +251,7 @@ TEST_CASE("Basic Meta (no description)", "[profile]") {
TEST_CASE("Basic Meta (no author)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_no_author.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -286,7 +269,7 @@ TEST_CASE("Basic Meta (no author)", "[profile]") {
TEST_CASE("Basic Meta (no url)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_no_url.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -304,7 +287,7 @@ TEST_CASE("Basic Meta (no url)", "[profile]") {
TEST_CASE("Basic Meta (no license)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/meta_no_license.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -322,7 +305,7 @@ TEST_CASE("Basic Meta (no license)", "[profile]") {
TEST_CASE("Basic Module", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/modules.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -357,7 +340,7 @@ TEST_CASE("Basic Module", "[profile]") {
TEST_CASE("Basic Assets", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/assets.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -371,7 +354,7 @@ TEST_CASE("Basic Assets", "[profile]") {
TEST_CASE("Basic Properties", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/properties.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -424,7 +407,7 @@ TEST_CASE("Basic Properties", "[profile]") {
TEST_CASE("Basic Keybindings", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/keybindings.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -480,7 +463,7 @@ TEST_CASE("Basic Keybindings", "[profile]") {
TEST_CASE("Basic Time Relative", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/time_relative.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -495,7 +478,7 @@ TEST_CASE("Basic Time Relative", "[profile]") {
TEST_CASE("Basic Time Absolute", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/time_absolute.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -510,7 +493,7 @@ TEST_CASE("Basic Time Absolute", "[profile]") {
TEST_CASE("Basic Delta Times", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/deltatimes.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -526,7 +509,7 @@ TEST_CASE("Basic Delta Times", "[profile]") {
TEST_CASE("Basic Camera NavState (full)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/camera_navstate_full.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -547,7 +530,7 @@ TEST_CASE("Basic Camera NavState (full)", "[profile]") {
TEST_CASE("Basic Camera NavState (no aim)", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_navstate_no_aim.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -567,7 +550,7 @@ TEST_CASE("Basic Camera NavState (no aim)", "[profile]") {
TEST_CASE("Basic Camera NavState (no pitch)", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_navstate_no_pitch.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -587,7 +570,7 @@ TEST_CASE("Basic Camera NavState (no pitch)", "[profile]") {
TEST_CASE("Basic Camera NavState (no up)", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_navstate_no_up.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -607,7 +590,7 @@ TEST_CASE("Basic Camera NavState (no up)", "[profile]") {
TEST_CASE("Basic Camera NavState (no yaw)", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_navstate_no_yaw.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -626,7 +609,7 @@ TEST_CASE("Basic Camera NavState (no yaw)", "[profile]") {
TEST_CASE("Basic Camera GoToGeo (full)", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/camera_gotogeo.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -643,7 +626,7 @@ TEST_CASE("Basic Camera GoToGeo (full)", "[profile]") {
TEST_CASE("Basic Camera GoToGeo (with altitude)", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_gotogeo_altitude.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -661,7 +644,7 @@ TEST_CASE("Basic Camera GoToGeo (with altitude)", "[profile]") {
TEST_CASE("Basic Camera GoToNode", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_gotonode.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -676,7 +659,7 @@ TEST_CASE("Basic Camera GoToNode", "[profile]") {
TEST_CASE("Basic Camera GoToNode (with height)", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/camera_gotonode_height.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -691,7 +674,7 @@ TEST_CASE("Basic Camera GoToNode (with height)", "[profile]") {
TEST_CASE("Basic Mark Nodes", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/basic/mark_nodes.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -706,7 +689,7 @@ TEST_CASE("Basic Mark Nodes", "[profile]") {
TEST_CASE("Basic Additional Scripts", "[profile]") {
constexpr std::string_view File =
"${TESTDIR}/profile/basic/additional_scripts.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -723,7 +706,7 @@ TEST_CASE("Basic Additional Scripts", "[profile]") {
//
TEST_CASE("Integration Full Test", "[profile]") {
constexpr std::string_view File = "${TESTDIR}/profile/integration/full_test.profile";
Profile profile = loadProfile(absPath(File));
Profile profile = Profile(absPath(File));
Profile ref;
ref.version = Profile::CurrentVersion;
@@ -1074,7 +1057,7 @@ TEST_CASE("(Error) Version: Missing value 'major'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/version/missing_major.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'version.major' field is missing")
);
}
@@ -1083,7 +1066,7 @@ TEST_CASE("(Error) Version: Missing value 'minor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/version/missing_minor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'version.minor' field is missing")
);
}
@@ -1092,7 +1075,7 @@ TEST_CASE("(Error) Version: Wrong type 'major'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/version/wrongtype_major.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'version.major' must be a number")
);
}
@@ -1101,7 +1084,7 @@ TEST_CASE("(Error) Version: Wrong type 'minor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/version/wrongtype_minor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'version.minor' must be a number")
);
}
@@ -1110,7 +1093,7 @@ TEST_CASE("(Error) Version: Wrong type 'major' and 'minor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/version/wrongtype_major_minor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'version.major' must be a number")
);
}
@@ -1124,7 +1107,7 @@ TEST_CASE("(Error) Module: Missing value 'name'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/module/missing_name.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'module.name' field is missing")
);
}
@@ -1133,7 +1116,7 @@ TEST_CASE("(Error) Module: Wrong type 'name'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/module/wrongtype_name.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'module.name' must be a string")
);
}
@@ -1142,7 +1125,7 @@ TEST_CASE("(Error) Module: Wrong type 'loadedInstruction'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/module/wrongtype_loadedInstruction.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'module.loadedInstruction' must be a string")
);
}
@@ -1151,7 +1134,7 @@ TEST_CASE("(Error) Module: Wrong type 'notLoadedInstruction'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/module/wrongtype_notLoadedInstruction.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'module.notLoadedInstruction' must be a string")
);
}
@@ -1164,7 +1147,7 @@ TEST_CASE("(Error) Property: Missing value 'name'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/property/missing_name.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'property.name' field is missing")
);
}
@@ -1173,7 +1156,7 @@ TEST_CASE("(Error) Property: Missing value 'value'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/property/missing_value.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'property.value' field is missing")
);
}
@@ -1182,7 +1165,7 @@ TEST_CASE("(Error) Property: Missing value 'name' and 'value'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/property/missing_name_value.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'property.name' field is missing")
);
}
@@ -1191,7 +1174,7 @@ TEST_CASE("(Error) Property: Wrong value 'type'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/property/wrongvalue_type.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) Unknown property set type")
);
}
@@ -1200,7 +1183,7 @@ TEST_CASE("(Error) Property: Wrong type 'name'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/property/wrongtype_name.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'property.name' must be a string")
);
}
@@ -1209,7 +1192,7 @@ TEST_CASE("(Error) Property: Wrong type 'value'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/property/wrongtype_value.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'property.value' must be a string")
);
}
@@ -1222,7 +1205,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'key'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/missing_key.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.key' field is missing")
);
}
@@ -1231,7 +1214,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'documentation'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/missing_documentation.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.documentation' field is missing")
);
}
@@ -1240,7 +1223,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'name'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/missing_name.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.name' field is missing")
);
}
@@ -1249,7 +1232,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'gui_path'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/missing_guipath.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.gui_path' field is missing")
);
}
@@ -1258,7 +1241,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'is_local'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/missing_islocal.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.is_local' field is missing")
);
}
@@ -1267,7 +1250,7 @@ TEST_CASE("(Error) Keybinding: Wrong value 'key'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongvalue_key.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("Could not find key for 'F50'")
);
}
@@ -1276,7 +1259,7 @@ TEST_CASE("(Error) Keybinding: Wrong value 'key, modifier'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongvalue_modifier.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("Unknown modifier key 'KEYKEY'")
);
}
@@ -1285,7 +1268,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'documentation'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongtype_documentation.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.documentation' must be a string")
);
}
@@ -1294,7 +1277,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'gui_path'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongtype_guipath.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.gui_path' must be a string")
);
}
@@ -1303,7 +1286,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'is_local'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongtype_islocal.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.is_local' must be a boolean")
);
}
@@ -1312,7 +1295,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'name'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongtype_name.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.name' must be a string")
);
}
@@ -1321,7 +1304,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'script'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/keybinding/wrongtype_script.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'keybinding.script' must be a string")
);
}
@@ -1334,7 +1317,7 @@ TEST_CASE("(Error) Time: Wrong value 'type'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/time/wrongvalue_type.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) Unknown time type")
);
}
@@ -1343,7 +1326,7 @@ TEST_CASE("(Error) Time (absolute): Missing value 'type'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/time/missing_type.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'time.type' field is missing")
);
}
@@ -1352,7 +1335,7 @@ TEST_CASE("(Error) Time (relative): Missing value 'value'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/time/relative_missing_value.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'time.value' field is missing")
);
}
@@ -1364,7 +1347,7 @@ TEST_CASE("(Error) Deltatimes: Wrong type", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/deltatimes/wrongtype_value.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::ContainsSubstring("type must be number, but is string")
);
}
@@ -1376,7 +1359,7 @@ TEST_CASE("(Error) Camera: Wrong value 'type'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/wrongvalue_type.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) Unknown camera type")
);
}
@@ -1385,7 +1368,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'anchor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_anchor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.anchor' field is missing")
);
}
@@ -1394,7 +1377,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'frame'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_frame.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.frame' field is missing")
);
}
@@ -1403,7 +1386,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_position.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position' field is missing")
);
}
@@ -1412,7 +1395,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'anchor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_anchor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.anchor' must be a string")
);
}
@@ -1421,7 +1404,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'aim'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_aim.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.aim' must be a string")
);
}
@@ -1430,7 +1413,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'frame'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_frame.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.frame' must be a string")
);
}
@@ -1439,7 +1422,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_position.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position' must be an object")
);
}
@@ -1448,7 +1431,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position.x'", "[profile]")
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_position_x.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position.x' field is missing")
);
}
@@ -1457,7 +1440,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position.x'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_position_x.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position.x' must be a number")
);
}
@@ -1466,7 +1449,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position.y'", "[profile]")
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_position_y.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position.y' field is missing")
);
}
@@ -1475,7 +1458,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position.y'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_position_y.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position.y' must be a number")
);
}
@@ -1484,7 +1467,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position.z'", "[profile]")
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_position_z.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position.z' field is missing")
);
}
@@ -1493,7 +1476,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position.z'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_position_z.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.position.z' must be a number")
);
}
@@ -1502,7 +1485,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_up.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up' must be an object")
);
}
@@ -1511,7 +1494,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'up.x'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_up_x.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up.x' field is missing")
);
}
@@ -1520,7 +1503,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up.x'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_up_x.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up.x' must be a number")
);
}
@@ -1529,7 +1512,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'up.y'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_up_y.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up.y' field is missing")
);
}
@@ -1538,7 +1521,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up.y'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_up_y.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up.y' must be a number")
);
}
@@ -1547,7 +1530,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'up.z'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_missing_up_z.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up.z' field is missing")
);
}
@@ -1556,7 +1539,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up.z'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_up_z.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.up.z' must be a number")
);
}
@@ -1565,7 +1548,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'yaw'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_yaw.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.yaw' must be a number")
);
}
@@ -1574,7 +1557,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'pitch'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/navstate_wrongtype_pitch.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.pitch' must be a number")
);
}
@@ -1583,7 +1566,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Missing value 'anchor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_missing_anchor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.anchor' field is missing")
);
}
@@ -1592,7 +1575,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Missing value 'latitude'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_missing_latitude.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.latitude' field is missing")
);
}
@@ -1601,7 +1584,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Missing value 'longitude'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_missing_longitude.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.longitude' field is missing")
);
}
@@ -1610,7 +1593,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'anchor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_wrongtype_anchor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.anchor' must be a string")
);
}
@@ -1619,7 +1602,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'latitude'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_wrongtype_latitude.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.latitude' must be a number")
);
}
@@ -1628,7 +1611,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'longitude'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_wrongtype_longitude.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.longitude' must be a number")
);
}
@@ -1637,7 +1620,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'altitude'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotogeo_wrongtype_altitude.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.altitude' must be a number")
);
}
@@ -1646,7 +1629,7 @@ TEST_CASE("(Error) Camera (GoToNode): Wrong type 'anchor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotonode_wrongtype_anchor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.anchor' must be a string")
);
}
@@ -1655,7 +1638,7 @@ TEST_CASE("(Error) Camera (GoToNode): Wrong type 'height'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotonode_wrongtype_height.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.height' must be a number")
);
}
@@ -1664,7 +1647,7 @@ TEST_CASE("(Error) Camera (GoToNode): Missing value 'anchor'", "[profile]") {
constexpr std::string_view TestFile =
"${TESTDIR}/profile/error/camera/gotonode_missing_anchor.profile";
CHECK_THROWS_WITH(
loadProfile(absPath(TestFile)),
Profile(absPath(TestFile)),
Catch::Matchers::Equals("(profile) 'camera.anchor' field is missing")
);
}
@@ -1677,7 +1660,7 @@ TEST_CASE("(Error) Camera (GoToNode): Missing value 'anchor'", "[profile]") {
// constexpr std::string_view TestFile =
// "${TESTDIR}/profile/error/camera/gotonode_invalidvalue_negative_height.profile";
// CHECK_THROWS_WITH(
// loadProfile(absPath(TestFile)),
// Profile(absPath(TestFile)),
// Catch::Matchers::Equals("(profile) 'camera.height' must be a larger than zero")
// );
//}
@@ -1686,7 +1669,7 @@ TEST_CASE("(Error) Camera (GoToNode): Missing value 'anchor'", "[profile]") {
// constexpr std::string_view TestFile =
// "${TESTDIR}/profile/error/camera/gotonode_invalidvalue_zero_height.profile";
// CHECK_THROWS_WITH(
// loadProfile(absPath(TestFile)),
// Profile(absPath(TestFile)),
// Catch::Matchers::Equals("(profile) 'camera.height' must be a larger than zero")
// );
//}