Browse Source

ObjImporter: use human readable names for invalid meshes.

NoReasonToMakeThoseCrypticCamelCase.
pull/578/head
Vladimír Vondruš 4 years ago
parent
commit
1226c9506b
  1. 46
      src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp
  2. 12
      src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj
  3. 4
      src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj
  4. 20
      src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj
  5. 10
      src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj
  6. 4
      src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj

46
src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp

@ -98,53 +98,53 @@ const struct {
const char* name;
const char* message;
} InvalidNumbersData[]{
{"WrongFloat", "error while converting numeric data"},
{"WrongInteger", "error while converting numeric data"},
{"PositionIndexOutOfRange", "index 1 out of range for 1 vertices"},
{"TextureIndexOutOfRange", "index 2 out of range for 1 vertices"},
{"ZeroIndex", "index 0 out of range for 1 vertices"}
{"invalid float literal", "error while converting numeric data"},
{"invalid integer literal", "error while converting numeric data"},
{"position index out of range", "index 1 out of range for 1 vertices"},
{"texture index out of range", "index 2 out of range for 1 vertices"},
{"zero index", "index 0 out of range for 1 vertices"}
};
const struct {
const char* name;
const char* message;
} InvalidNumberCountData[]{
{"ShortFloat", "invalid float array size"},
{"LongFloat", "invalid float array size"},
{"LongOptionalFloat", "invalid float array size"},
{"InvalidIndices", "invalid index data"},
{"WrongPointIndices", "wrong index count for point"},
{"WrongLineIndices", "wrong index count for line"},
{"WrongTriangleIndices", "wrong index count for triangle"},
{"PolygonIndices", "polygons are not supported"}
{"two-component position", "invalid float array size"},
{"five-component position with optional fourth component", "invalid float array size"},
{"four-component normal", "invalid float array size"},
{"four-component index tuple", "invalid index data"},
{"point with two indices", "wrong index count for point"},
{"line with one index", "wrong index count for line"},
{"triangle with two indices", "wrong index count for triangle"},
{"quad", "polygons are not supported"}
};
const struct {
const char* name;
const char* message;
} InvalidInconsistentIndexTupleData[]{
{"ShortNormalIndices", "some normal indices are missing"},
{"ShortTextureIndices", "some texture coordinate indices are missing"},
{"missing normal reference", "some normal indices are missing"},
{"missing texture reference", "some texture coordinate indices are missing"},
};
const struct {
const char* name;
const char* message;
} InvalidIncompleteDataData[]{
{"MissingPositionData", "incomplete position data"},
{"MissingPositionIndices", "incomplete position data"},
{"MissingNormalData", "incomplete normal data"},
{"MissingNormalIndices", "incomplete normal data"},
{"MissingTextureData", "incomplete texture coordinate data"},
{"MissingTextureIndices", "incomplete texture coordinate data"},
{"missing position data", "incomplete position data"},
{"missing position indices", "incomplete position data"},
{"missing normal data", "incomplete normal data"},
{"missing normal indices", "incomplete normal data"},
{"missing texture coordinate data", "incomplete texture coordinate data"},
{"missing texture coordinate indices", "incomplete texture coordinate data"},
};
const struct {
const char* name;
const char* message;
} InvalidOptionalCoordinateData[]{
{"UnsupportedPositionW", "homogeneous coordinates are not supported"},
{"UnsupportedTextureW", "3D texture coordinates are not supported"}
{"position with optional fourth component not one", "homogeneous coordinates are not supported"},
{"texture with optional third component not zero", "3D texture coordinates are not supported"}
};
ObjImporterTest::ObjImporterTest() {

12
src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj

@ -1,23 +1,23 @@
o MissingPositionData
o missing position data
p 1
o MissingPositionIndices
o missing position indices
v 1 2 3
o MissingNormalData
o missing normal data
v 1 2 3
p 3//3
o MissingNormalIndices
o missing normal indices
v 1 2 3
vn 1 2 3
p 4
o MissingTextureData
o missing texture coordinate data
v 1 2 3
p 5/1
o MissingTextureIndices
o missing texture coordinate indices
v 1 2 3
vt 1 2
p 6

4
src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj

@ -1,11 +1,11 @@
o ShortNormalIndices
o missing normal reference
v 1 2 3
vn 1 2 3
p 1//1
p 1
p 1//1
o ShortTextureIndices
o missing texture reference
v 1 2 3
vt 1 2
p 2/2

20
src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj

@ -1,29 +1,29 @@
o ShortFloat
o two-component position
v 0.5 1.0
o LongFloat
o five-component position with optional fourth component
v 0.5 1 2 0.0 3.5
o four-component normal
v 0.5 1 2
vn 0.5 1.0 2.3 7.4
o LongOptionalFloat
v 0.5 1 2 0.0 3.5
o InvalidIndices
o four-component index tuple
v 1 2 3
p 4/1/1/1
o WrongPointIndices
o point with two indices
v 1 2 3
p 5 5
o WrongLineIndices
o line with one index
v 1 2 3
l 6
o WrongTriangleIndices
o triangle with two indices
v 1 2 3
f 7 7
o PolygonIndices
o quad
v 1 2 3
f 8 8 8 8

10
src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj

@ -1,22 +1,22 @@
o WrongFloat
o invalid float literal
v 1 bleh 2
p 1
o WrongInteger
o invalid integer literal
v 1 0 2
p bleh
o PositionIndexOutOfRange
o position index out of range
v 1 0 2
# Should be 3
p 1
o TextureIndexOutOfRange
o texture index out of range
v 1 0 2
vt 0 1
# Should be 4/1
p 4/2
o ZeroIndex
o zero index
v 1 0 2
p 0

4
src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj

@ -1,8 +1,8 @@
o UnsupportedPositionW
o position with optional fourth component not one
v 1.5 2 3 0.8
p 1
o UnsupportedTextureW
o texture with optional third component not zero
v 1.5 2 3
vt 0.5 0.7 0.5
p 2/1

Loading…
Cancel
Save