VOXELFORMAT: removed comparison operator for volumes

master
Martin Gerhardy 2022-05-19 19:58:34 +02:00
parent 8806f7bae4
commit 051ed06deb
9 changed files with 12 additions and 15 deletions

View File

@ -90,10 +90,6 @@ inline bool volumeComparator(const voxel::RawVolume& volume1, const voxel::RawVo
return true;
}
inline bool operator==(const voxel::RawVolume& volume1, const voxel::RawVolume& volume2) {
return volumeComparator(volume1, volume2, true, true);
}
inline ::std::ostream& operator<<(::std::ostream& os, const voxel::Region& region) {
return os << "region["
<< "mins(" << glm::to_string(region.getLowerCorner()) << "), "

View File

@ -239,7 +239,7 @@ void AbstractVoxFormatTest::testSaveLoadVoxel(const core::String &filename, Form
readStream->seek(0);
std::unique_ptr<voxel::RawVolume> loaded(load(filename, *readStream, *format));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(original, *loaded);
EXPECT_TRUE(volumeComparator(original, *loaded, true, true)) << "Volumes differ: " << original << *loaded;
}
} // namespace voxel

View File

@ -47,7 +47,7 @@ TEST_F(QBFormatTest, testSaveSingleVoxel) {
f = QBFormat();
std::unique_ptr<voxel::RawVolume> loaded(load("qubicle-singlevoxelsavetest.qb", f));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(original, *loaded);
EXPECT_TRUE(volumeComparator(original, *loaded, true, true)) << "Volumes differ: " << original << *loaded;
}
TEST_F(QBFormatTest, testSaveSmallVoxel) {
@ -71,6 +71,6 @@ TEST_F(QBFormatTest, testLoadSave) {
f = QBFormat();
std::unique_ptr<voxel::RawVolume> loaded(load("qubicle-savetest.qb", f));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(*original, *loaded);
EXPECT_TRUE(volumeComparator(*original, *loaded, true, true)) << "Volumes differ: " << *original << *loaded;
}
}

View File

@ -29,7 +29,7 @@ TEST_F(QBTFormatTest, testSaveSingleVoxel) {
f = QBTFormat();
std::unique_ptr<voxel::RawVolume> loaded(load("qubicle-singlevoxelsavetest.qbt", f));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(original, *loaded);
EXPECT_TRUE(volumeComparator(original, *loaded, true, true)) << "Volumes differ: " << original << *loaded;
}
TEST_F(QBTFormatTest, testSaveSmallVoxel) {
@ -53,7 +53,7 @@ TEST_F(QBTFormatTest, testSave) {
f = QBTFormat();
std::unique_ptr<voxel::RawVolume> loaded(load("qubicle-savetest.qbt", f));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(*original, *loaded);
EXPECT_TRUE(volumeComparator(*original, *loaded, true, true)) << "Volumes differ: " << *original << *loaded;
}
TEST_F(QBTFormatTest, testResaveMultipleLayers) {

View File

@ -35,7 +35,7 @@ TEST_F(VXLFormatTest, testSave) {
voxel::RawVolume *savedVolume = load("cc-save.vxl", f);
EXPECT_NE(nullptr, savedVolume) << "Could not load saved vxl file " << file->name();
if (savedVolume) {
EXPECT_EQ(*savedVolume, *loadedVolume);
EXPECT_TRUE(volumeComparator(*savedVolume, *loadedVolume, true, true)) << "Volumes differ: " << *savedVolume << *loadedVolume;
delete savedVolume;
}
delete loadedVolume;

View File

@ -43,7 +43,7 @@ TEST_F(VXMFormatTest, testSaveVerySmallVoxel) {
f = VXMFormat();
std::unique_ptr<voxel::RawVolume> loaded(load("verysmallvolumesavetest.vxm", f));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(original, *loaded);
EXPECT_TRUE(volumeComparator(original, *loaded, true, true)) << "Volumes differ: " << original << *loaded;
}
TEST_F(VXMFormatTest, testSaveSmallVoxel) {
@ -65,7 +65,7 @@ TEST_F(VXMFormatTest, testSaveRLE) {
f = VXMFormat();
std::unique_ptr<voxel::RawVolume> loaded(load("smallvolumesavetest.vxm", f));
ASSERT_NE(nullptr, loaded);
EXPECT_EQ(original, *loaded);
EXPECT_TRUE(volumeComparator(original, *loaded, true, true)) << "Volumes differ: " << original << *loaded;
}
}

View File

@ -157,7 +157,7 @@ TEST_F(VoxFormatTest, testSave) {
voxel::RawVolume *savedVolume = load(fileLoadAfterSave->name(), stream2, f);
EXPECT_NE(nullptr, savedVolume) << "Could not load saved vox file";
if (savedVolume) {
EXPECT_EQ(*savedVolume, *loadedVolume);
EXPECT_TRUE(volumeComparator(*savedVolume, *loadedVolume, true, true)) << "Volumes differ: " << *savedVolume << *loadedVolume;
delete savedVolume;
}
delete loadedVolume;

View File

@ -40,7 +40,7 @@ protected:
voxelformat::SceneGraph::MergedVolumePalette merged = sceneGraph.merge();
voxel::RawVolume* v = merged.first;
ASSERT_NE(nullptr, v) << "Can't load " << filename;
EXPECT_EQ(*v, *_volume);
EXPECT_TRUE(volumeComparator(v, *_volume, true, true)) << "Volumes differ: " << v << *_volume;
delete v;
}
public:

View File

@ -86,7 +86,8 @@ TEST_F(VolumeRotatorTest, DISABLED_testRotate90_FourTimes) {
EXPECT_EQ(rotatedRegion, region) << "Rotating by 360 degree should increase the size of the volume "
<< str(rotatedRegion) << " " << str(region);
EXPECT_EQ(*rotated, smallVolume) << "Expected to get the same volume after 360 degree rotation";
EXPECT_TRUE(volumeComparator(*rotated, smallVolume, true, true))
<< "Expected to get the same volume after 360 degree rotation, but volumes differ: " << *rotated << smallVolume;
delete rotated;
}
}