Parse multiple group names. Fixes #146

This commit is contained in:
Syoyo Fujita
2018-08-11 15:21:17 +09:00
parent fd06fa49e4
commit 1a7bdc6192
3 changed files with 47 additions and 15 deletions

View File

@@ -807,6 +807,24 @@ TEST_CASE("line-primitive", "[line]") {
REQUIRE(6 == shapes[0].path.indices.size());
}
TEST_CASE("multiple-group-names", "[group]") {
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/cube.obj", gMtlBasePath);
if (!err.empty()) {
std::cerr << "[group] " << err << std::endl;
}
REQUIRE(true == ret);
REQUIRE(6 == shapes.size());
REQUIRE(0 == shapes[0].name.compare("front cube"));
REQUIRE(0 == shapes[1].name.compare("back cube")); // multiple whitespaces are aggregated as single white space.
}
// Fuzzer test.
// Just check if it does not crash.
// Disable by default since Windows filesystem can't create filename of afl testdata