25 #ifndef WGEGEODEUTILS_TEST_H
26 #define WGEGEODEUTILS_TEST_H
28 #include <cxxtest/ValueTraits.h>
29 #include <cxxtest/TestSuite.h>
31 #include <osg/io_utils>
33 #include "../../common/WStringUtils.h"
34 #include "WVec3Traits.h"
35 #include "../WGEGeodeUtils.h"
50 osg::Geometry *geo =
dynamic_cast< osg::Geometry*
>( g->getDrawable( 0 ) );
53 TS_FAIL(
"The drawable inside the WGESubdividedPlane geode is not a geometry" );
56 osg::Vec3Array* verts =
dynamic_cast< osg::Vec3Array*
>( geo->getVertexArray() );
59 TS_FAIL(
"The vertex array inside is not a osg::Vec3Array" );
61 osg::ref_ptr< osg::Vec3Array > expected = osg::ref_ptr< osg::Vec3Array >(
new osg::Vec3Array );
62 expected->push_back( osg::Vec3( 0.0, 0.0, 0.0 ) );
63 expected->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
64 expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
65 expected->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
66 expected->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
67 expected->push_back( osg::Vec3( 2.0, 0.0, 0.0 ) );
68 expected->push_back( osg::Vec3( 2.0, 1.0, 0.0 ) );
69 expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
70 expected->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
71 expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
72 expected->push_back( osg::Vec3( 1.0, 2.0, 0.0 ) );
73 expected->push_back( osg::Vec3( 0.0, 2.0, 0.0 ) );
74 expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
75 expected->push_back( osg::Vec3( 2.0, 1.0, 0.0 ) );
76 expected->push_back( osg::Vec3( 2.0, 2.0, 0.0 ) );
77 expected->push_back( osg::Vec3( 1.0, 2.0, 0.0 ) );
78 TS_ASSERT_EQUALS( verts->asVector(), expected->asVector() );
87 osg::ref_ptr< osg::Vec3Array > expected = osg::ref_ptr< osg::Vec3Array >(
new osg::Vec3Array );
88 expected->push_back( osg::Vec3( 0.5, 0.5, 0.0 ) );
89 expected->push_back( osg::Vec3( 1.5, 0.5, 0.0 ) );
90 expected->push_back( osg::Vec3( 0.5, 1.5, 0.0 ) );
91 expected->push_back( osg::Vec3( 1.5, 1.5, 0.0 ) );
92 TS_ASSERT_EQUALS( g->getCenterArray()->asVector(), expected->asVector() );
96 #endif // WGEGEODEUTILS_TEST_H