Move OBJ handling to a mjpDecoder.
PiperOrigin-RevId: 875194599 Change-Id: I2cccc683d69a217f1817e70d16bc1815e366d00c
This commit is contained in:
committed by
Copybara-Service
parent
abdea379af
commit
b907ffedaa
@@ -71,6 +71,9 @@ static const char* const kMalformedFaceOBJPath =
|
||||
static const char* const kCubeSkinPath =
|
||||
"user/testdata/cube_skin.xml";
|
||||
|
||||
static const char* const kNoDecoderForMeshErrorMsh =
|
||||
"no decoder found for mesh";
|
||||
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::IsNull;
|
||||
@@ -110,7 +113,7 @@ TEST_F(MjCMeshTest, UnknownMeshFormat) {
|
||||
LoadModelFromString(xml.c_str(), error.data(), error.size(), &vfs);
|
||||
ASSERT_THAT(model, testing::IsNull())
|
||||
<< "Should fail to load a mesh named: " << name;
|
||||
EXPECT_THAT(error.data(), HasSubstr("unknown or unsupported mesh file: "));
|
||||
EXPECT_THAT(error.data(), HasSubstr(kNoDecoderForMeshErrorMsh));
|
||||
EXPECT_THAT(error.data(), HasSubstr(name));
|
||||
}
|
||||
|
||||
@@ -300,7 +303,7 @@ TEST_F(MjCMeshTest, LoadMSHWithContentTypeError) {
|
||||
// should error with unknown file type
|
||||
mjModel* model = LoadModelFromString(xml, error, error_sz, &vfs);
|
||||
EXPECT_THAT(model, IsNull());
|
||||
EXPECT_THAT(error, HasSubstr("unsupported mesh type: 'model/unknown'"));
|
||||
EXPECT_THAT(error, HasSubstr(kNoDecoderForMeshErrorMsh));
|
||||
mj_deleteVFS(&vfs);
|
||||
}
|
||||
|
||||
@@ -327,7 +330,7 @@ TEST_F(MjCMeshTest, LoadMSHWithInvalidContentType) {
|
||||
// should error with unknown file type
|
||||
mjModel* model = LoadModelFromString(xml, error, error_sz, &vfs);
|
||||
EXPECT_THAT(model, IsNull());
|
||||
EXPECT_THAT(error, HasSubstr("invalid content type: 'model'"));
|
||||
EXPECT_THAT(error, HasSubstr(kNoDecoderForMeshErrorMsh));
|
||||
mj_deleteVFS(&vfs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user