|
9 | 9 |
|
10 | 10 |
|
11 | 11 | class TestParsers(unittest.TestCase): |
| 12 | + |
12 | 13 | def setUp(self): |
13 | 14 | # Append current path to locate files |
14 | 15 | meshes = pywavefront.Wavefront(fixture('simple.obj')) |
15 | 16 | self.mesh1 = meshes.mesh_list[0] |
16 | 17 | self.mesh2 = meshes.mesh_list[1] |
| 18 | + self.maxDiff = None |
17 | 19 |
|
18 | 20 | def testObjName(self): |
19 | 21 | """Parsing an obj file with known names should set those names.""" |
@@ -43,6 +45,7 @@ def testObjMaterials(self): |
43 | 45 | self.assertEqual(material1.name, 'Material.simple') |
44 | 46 | self.assertEqual(material2.name, 'Material2.simple') |
45 | 47 |
|
| 48 | + |
46 | 49 | class TestParserCollectFaces(unittest.TestCase): |
47 | 50 | """Test collecting (possibly triangulated) faces""" |
48 | 51 | def setUp(self): |
@@ -102,6 +105,7 @@ def test_missing_material_create(self): |
102 | 105 |
|
103 | 106 |
|
104 | 107 | class TestParserVertexVariants(unittest.TestCase): |
| 108 | + maxDiff = None |
105 | 109 |
|
106 | 110 | def testObjNoNormals(self): |
107 | 111 | """Parse obj without normals""" |
@@ -174,6 +178,27 @@ def testObjColors(self): |
174 | 178 |
|
175 | 179 | self.assertEqual(self.mesh2.materials[0].vertex_format, "T2F_C3F_N3F_V3F") |
176 | 180 |
|
| 181 | + def test_undefined_uvs(self): |
| 182 | + """obj file were some uv entries are undefiend""" |
| 183 | + meshes = pywavefront.Wavefront(fixture('simple_missing_uv.obj')) |
| 184 | + self.mesh2 = meshes.mesh_list[1] |
| 185 | + |
| 186 | + self.assertEqual(self.mesh2.materials[0].vertices, [ |
| 187 | + 1.0, 0.0, 0.0, 1.0, -0.0, -1.0, 0.0, 1.0, |
| 188 | + 0.0, 0.0, 0.0, 1.0, -0.0, 1.0, 0.0, 1.0, |
| 189 | + 0.0, 1.0, 0.0, 1.0, -0.0, 1.0, 0.0, -1.0, |
| 190 | + |
| 191 | + 10.0, 11.0, 0.0, 1.0, -0.0, -1.0, 0.0, 1.0, |
| 192 | + 10.0, 11.0, 0.0, 1.0, -0.0, 1.0, 0.0, 1.0, |
| 193 | + 10.0, 11.0, 0.0, 1.0, -0.0, 1.0, 0.0, -1.0, |
| 194 | + |
| 195 | + 1.0, 0.0, 0.0, 1.0, -0.0, -1.0, 0.0, 1.0, |
| 196 | + 0.0, 0.0, 0.0, 1.0, -0.0, 1.0, 0.0, 1.0, |
| 197 | + 0.0, 1.0, 0.0, 1.0, -0.0, 1.0, 0.0, -1.0, |
| 198 | + ]) |
| 199 | + |
| 200 | + self.assertEqual(self.mesh2.materials[0].vertex_format, "T2F_N3F_V3F") |
| 201 | + |
177 | 202 |
|
178 | 203 | class TestMtlParser(unittest.TestCase): |
179 | 204 | def setUp(self): |
|
0 commit comments