Change row-flipping logic for heightfields.
Move row-flipping logic from `mjCModel::CopyBack` to `mjXWriter`. PiperOrigin-RevId: 842220322 Change-Id: I6fb09db6c9e8689f6e435f82f58dd3e7c4314478
This commit is contained in:
committed by
Copybara-Service
parent
925c533580
commit
c064abc3da
@@ -38,10 +38,11 @@
|
||||
namespace mujoco {
|
||||
namespace {
|
||||
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::FloatEq;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::Not;
|
||||
using ::testing::NotNull;
|
||||
using ::testing::FloatEq;
|
||||
|
||||
using XMLWriterTest = PluginTest;
|
||||
|
||||
@@ -998,6 +999,10 @@ TEST_F(XMLWriterTest, WritesHfield) {
|
||||
int size = model->hfield_nrow[0]*model->hfield_ncol[0];
|
||||
EXPECT_EQ(size, 6);
|
||||
|
||||
// check that the data is normalized and in row-major, bottom-to-top order
|
||||
EXPECT_THAT(AsVector(model->hfield_data, 6),
|
||||
ElementsAre(.8, 1, .4, .6, 0, .2));
|
||||
|
||||
// save and read, compare data
|
||||
mjModel* mtemp = LoadModelFromString(SaveAndReadXml(model));
|
||||
ASSERT_THAT(mtemp, NotNull());
|
||||
|
||||
Reference in New Issue
Block a user