Skip to content

Commit fe9e713

Browse files
committed
add regression test for #389
1 parent 3201329 commit fe9e713

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

models/issue-389-comment.obj

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
g Part 1
2+
v 0.0576127 0.0488792 0.0423
3+
v 0.0576127 0.0488792 0
4+
v -0.0483158 0.0488792 0
5+
v -0.0483158 0.0488792 0.0423
6+
v -0.0483158 -0.0139454 0
7+
v -0.0483158 -0.0139454 0.0423
8+
v 0.0576127 -0.0139454 0
9+
v 0.0576127 -0.0139454 0.0423
10+
vn 0 1 0
11+
vn -1 0 0
12+
vn 0 -1 0
13+
vn 1 0 0
14+
vn 0 0 1
15+
vn 0 0 -1
16+
o mesh0
17+
f 1//1 2//1 3//1
18+
f 3//1 4//1 1//1
19+
o mesh1
20+
f 4//2 3//2 5//2
21+
f 5//2 6//2 4//2
22+
o mesh2
23+
f 6//3 5//3 7//3
24+
f 7//3 8//3 6//3
25+
o mesh3
26+
f 8//4 7//4 2//4
27+
f 2//4 1//4 8//4
28+
o mesh4
29+
f 8//5 1//5 4//5
30+
f 4//5 6//5 8//5
31+
o mesh5
32+
f 5//6 3//6 2//6
33+
f 2//6 7//6 5//6
34+
35+
# Zusätzliche Linien (aus der Oberseite)
36+
o lines
37+
v 0.0576127 0.0488792 0.0423 # Startpunkt Linie 1 (Ecke 1 Oberseite)
38+
v 0.0576127 0.0488792 0.2423 # Endpunkt Linie 1 (2m Höhe)
39+
v -0.0483158 -0.0139454 0.0423 # Startpunkt Linie 2 (Ecke 6 Oberseite)
40+
v -0.0483158 -0.0139454 0.2423 # Endpunkt Linie 2 (2m Höhe)
41+
42+
# Linien
43+
l 1 9 # Linie 1
44+
l 6 10 # Linie 2

tests/tester.cc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,31 @@ void test_face_missing_issue295() {
14081408
TEST_CHECK((3 * 28) == shapes[0].mesh.indices.size()); // 28 triangle faces x 3
14091409
}
14101410

1411+
void test_comment_issue389() {
1412+
tinyobj::attrib_t attrib;
1413+
std::vector<tinyobj::shape_t> shapes;
1414+
std::vector<tinyobj::material_t> materials;
1415+
1416+
std::string warn;
1417+
std::string err;
1418+
bool ret = tinyobj::LoadObj(
1419+
&attrib, &shapes, &materials, &warn, &err,
1420+
"../models/issue-389-comment.obj",
1421+
gMtlBasePath, /* triangualte */false);
1422+
1423+
TEST_CHECK(warn.empty());
1424+
1425+
if (!warn.empty()) {
1426+
std::cout << "WARN: " << warn << std::endl;
1427+
}
1428+
1429+
if (!err.empty()) {
1430+
std::cerr << "ERR: " << err << std::endl;
1431+
}
1432+
1433+
TEST_CHECK(true == ret);
1434+
}
1435+
14111436
// Fuzzer test.
14121437
// Just check if it does not crash.
14131438
// Disable by default since Windows filesystem can't create filename of afl
@@ -1511,6 +1536,8 @@ TEST_LIST = {
15111536
test_mtl_filename_with_whitespace_issue46},
15121537
{"test_face_missing_issue295",
15131538
test_face_missing_issue295},
1539+
{"test_comment_issue389",
1540+
test_comment_issue389},
15141541
{"test_invalid_relative_vertex_index",
15151542
test_invalid_relative_vertex_index},
15161543
{"test_invalid_texture_vertex_index",

0 commit comments

Comments
 (0)