mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-11 21:09:07 +08:00
Add regression test for issue 321
This commit is contained in:
parent
d07b976d59
commit
688ba8a60e
267
models/regression/unassigned-skeleton.gltf
Normal file
267
models/regression/unassigned-skeleton.gltf
Normal file
File diff suppressed because one or more lines are too long
@ -436,6 +436,36 @@ TEST_CASE("serialize-empty-material", "[issue-294]") {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("empty-skeleton-id", "[issue-321]") {
|
||||||
|
|
||||||
|
tinygltf::Model model;
|
||||||
|
tinygltf::TinyGLTF ctx;
|
||||||
|
std::string err;
|
||||||
|
std::string warn;
|
||||||
|
|
||||||
|
bool ret = ctx.LoadASCIIFromFile(&model, &err, &warn, "../models/regression/unassigned-skeleton.gltf");
|
||||||
|
if (!err.empty()) {
|
||||||
|
std::cerr << err << std::endl;
|
||||||
|
}
|
||||||
|
REQUIRE(true == ret);
|
||||||
|
|
||||||
|
REQUIRE(model.skins.size() == 1);
|
||||||
|
REQUIRE(model.skins[0].skeleton == -1); // unassigned
|
||||||
|
|
||||||
|
std::stringstream os;
|
||||||
|
|
||||||
|
ctx.WriteGltfSceneToStream(&model, os, false, false);
|
||||||
|
|
||||||
|
// use nlohmann json
|
||||||
|
nlohmann::json j = nlohmann::json::parse(os.str());
|
||||||
|
|
||||||
|
// Ensure `skeleton` property is not written to .gltf(was serialized as -1)
|
||||||
|
REQUIRE(1 == j["skins"].size());
|
||||||
|
REQUIRE(j["skins"][0].is_object());
|
||||||
|
REQUIRE(j["skins"][0].count("skeleton") == 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef TINYGLTF_NO_FS
|
#ifndef TINYGLTF_NO_FS
|
||||||
TEST_CASE("expandpath-utf-8", "[pr-226]") {
|
TEST_CASE("expandpath-utf-8", "[pr-226]") {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user