Skip to content

Commit

Permalink
Add unit test for PointSetIO::readAGI, document feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dsieger committed May 27, 2018
1 parent ff8305a commit 2fe4220
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/pmp/io/PointSetIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ namespace pmp {

//! Class for reading and writing point sets from and to files.
//!
//! This class currently supports only the XYZ file format. Only ASCII mode is
//! supported. Only supports point coordinates and normals.
//! This class supports XYZ file format for reading and writing. Only ASCII mode
//! is supported. Only supports point coordinates and normals.
//!
//! The class also supports reading colored point clouds from Agisoft.
//! Format: point coordinates, RGB colors, and normals per line. ASCII only,
//! file extension ".agi"
class PointSetIO
{
public:
Expand Down
12 changes: 11 additions & 1 deletion tests/PointSetIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,22 @@ TEST_F(PointSetIOTest, write)
EXPECT_FALSE(ps.write("testxxyyzz"));
}

TEST_F(PointSetIOTest, read)
TEST_F(PointSetIOTest, readXYZ)
{
ps.read("test.xyz"); // bad test dependency
EXPECT_EQ(ps.nVertices(), size_t(2));
}

TEST_F(PointSetIOTest, readAGI)
{
ps.read("pmp-data/agi/test.agi");
EXPECT_EQ(ps.nVertices(), size_t(4));
auto vcolors = ps.getVertexProperty<Color>("v:color");
EXPECT_TRUE(vcolors);
auto vnormals = ps.getVertexProperty<Normal>("v:normal");
EXPECT_TRUE(vnormals);
}

TEST_F(PointSetIOTest, readFailure)
{
ASSERT_FALSE(ps.read("test.off"));
Expand Down

0 comments on commit 2fe4220

Please sign in to comment.