From 2929a27edcefc48bb8ab35b3ded75b81ec676894 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 5 Nov 2017 17:41:26 +0100 Subject: [PATCH] add unittest for x3d-importer. --- code/OpenGEXImporter.cpp | 22 +++++++++---------- .../include/openddlparser/OpenDDLParser.h | 6 ++++- test/CMakeLists.txt | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 27d7b3e49..52e9ce501 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -431,7 +431,7 @@ void OpenGEXImporter::handleNodes( DDLNode *node, aiScene *pScene ) { } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleMetricNode( DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleMetricNode( DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == node || nullptr == m_ctx ) { return; } @@ -467,7 +467,7 @@ void OpenGEXImporter::handleMetricNode( DDLNode *node, aiScene */*pScene*/ ) { } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleNameNode( DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleNameNode( DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == m_currentNode ) { throw DeadlyImportError( "No current node for name." ); return; @@ -512,7 +512,7 @@ static void getRefNames( DDLNode *node, std::vector &names ) { } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == m_currentNode ) { throw DeadlyImportError( "No parent node for name." ); return; @@ -536,7 +536,7 @@ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene */*pScene*/ ) } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleMaterialRefNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleMaterialRefNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == m_currentNode ) { throw DeadlyImportError( "No parent node for name." ); return; @@ -674,7 +674,7 @@ static void setMatrix( aiNode *node, DataArrayList *transformData ) { } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == m_currentNode ) { throw DeadlyImportError( "No parent node for name." ); return; @@ -819,7 +819,7 @@ static void copyColor4DArray( size_t numItems, DataArrayList *vaList, aiColor4D } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == node ) { throw DeadlyImportError( "No parent node for name." ); return; @@ -862,7 +862,7 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == node ) { throw DeadlyImportError( "No parent node for name." ); return; @@ -1001,7 +1001,7 @@ void OpenGEXImporter::handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pS } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == node ) { return; } @@ -1040,7 +1040,7 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene */*pSc } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if( nullptr == node ) { return; } @@ -1074,7 +1074,7 @@ void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene */*p } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleParamNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleParamNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if ( nullptr == node ) { return; } @@ -1103,7 +1103,7 @@ void OpenGEXImporter::handleParamNode( ODDLParser::DDLNode *node, aiScene */*pSc } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleAttenNode( ODDLParser::DDLNode *node, aiScene */*pScene*/ ) { +void OpenGEXImporter::handleAttenNode( ODDLParser::DDLNode *node, aiScene * /*pScene*/ ) { if ( nullptr == node ) { return; } diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h index cdf6f7288..ef7f3a72e 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h @@ -41,7 +41,11 @@ struct Property; template inline -bool isEmbeddedCommentOpenTag( T *in, T */*end*/ ) { +bool isEmbeddedCommentOpenTag( T *in, T *end ) { + if ( in == end ) { + return false; + } + if ( in == '/' && in+1 == '*' ) { return true; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 62270b935..634ce5e15 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -129,6 +129,7 @@ SET( TEST_SRCS unit/utVersion.cpp unit/utVector3.cpp unit/utXImporterExporter.cpp + unit/utX3DImportExport.cpp unit/utD3MFImportExport.cpp unit/utQ3DImportExport.cpp unit/utProfiler.cpp