Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(763)

Unified Diff: lib/Alembic/AbcGeom/Tests/PlayGround.cpp

Issue 4662068: Alembic 1.0rc1, changes since 0.9.3
Patch Set: Created 12 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Alembic/AbcGeom/Tests/NurbsTest.cpp ('k') | lib/Alembic/AbcGeom/Tests/PolyMeshTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Alembic/AbcGeom/Tests/PlayGround.cpp
===================================================================
--- a/lib/Alembic/AbcGeom/Tests/PlayGround.cpp
+++ b/lib/Alembic/AbcGeom/Tests/PlayGround.cpp
@@ -37,6 +37,8 @@
#include <Alembic/AbcGeom/All.h>
#include <Alembic/AbcCoreHDF5/All.h>
+#include "Assert.h"
+
using namespace Alembic::AbcGeom;
using Alembic::AbcCoreAbstract::chrono_t;
@@ -167,9 +169,83 @@
}
//-*****************************************************************************
+void StupidData()
+{
+ std::string archiveName( "stupiddata.abc" );
+
+ // out
+ {
+ OArchive archive( Alembic::AbcCoreHDF5::WriteArchive(),
+ archiveName );
+
+ OObject myobject( archive.getTop(), "myobject" );
+
+ // a compound property to use as the parent for data-containing properties
+ OCompoundProperty props = myobject.getProperties();
+
+ OInt32ArrayProperty intArrayProp( props, "intArrayProp" );
+
+ for ( int32_t i = 0 ; i < 10 ; ++i )
+ {
+ std::vector<int32_t> v( i, i );
+ intArrayProp.set( v );
+ TESTING_ASSERT( intArrayProp.getNumSamples() == i + 1 );
+ }
+ std::cout << std::endl << "Writing " << archiveName << std::endl;
+ }
+
+ // in
+ {
+ std::cout << std::endl << "Reading " << archiveName << std::endl;
+
+ IArchive archive( Alembic::AbcCoreHDF5::ReadArchive(),
+ archiveName );
+
+ IObject myobject( archive.getTop(), "myobject" );
+
+ // a compound property to use as the parent for data-containing properties
+ ICompoundProperty props = myobject.getProperties();
+
+ IInt32ArrayProperty intArrayProp( props, "intArrayProp" );
+
+ TESTING_ASSERT( intArrayProp.getNumSamples() == 10 );
+
+ // try to create a non-existent property
+ IFloatArrayProperty nonProp( props, "doesntexist",
+ ErrorHandler::kQuietNoopPolicy );
+
+ if ( nonProp )
+ { std::cout << "this should not be printed" << std::endl; }
+ else
+ { std::cout << "non-existent Property doesn't exist." << std::endl; }
+
+ for ( int32_t i = 0 ; i < 10 ; ++i )
+ {
+ std::vector<int32_t> v( i, i );
+ Int32ArraySamplePtr samp = intArrayProp.getValue( i );
+ size_t numpoints = samp->size();
+
+ TESTING_ASSERT( numpoints == i );
+
+ std::cout << "sample " << i << ": ";
+
+ for ( size_t j = 0 ; j < numpoints ; ++j )
+ {
+ std::cout << (*samp)[j];
+ if ( numpoints > 0 && j < numpoints - 1 )
+ { std::cout << ", "; }
+ }
+ std::cout << std::endl;
+ }
+ }
+
+}
+
+//-*****************************************************************************
int main( int, char** )
{
//OWrapExisting();
PolyMorphicAbstractPtrs();
+ StupidData();
return 0;
}
« no previous file with comments | « lib/Alembic/AbcGeom/Tests/NurbsTest.cpp ('k') | lib/Alembic/AbcGeom/Tests/PolyMeshTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b