TuttleOFX  1
TuttleOFX/libraries/tuttle/tests/ofx/clone/main.cpp
Go to the documentation of this file.
00001 #include <tuttle/common/utils/global.hpp>
00002 #include <tuttle/host/exceptions.hpp>
00003 #include <tuttle/host/Core.hpp>
00004 #include <tuttle/host/ImageEffectNode.hpp>
00005 
00006 #include <iostream>
00007 
00008 #define BOOST_TEST_MODULE properties_tests
00009 #include <tuttle/test/unit_test.hpp>
00010 #include <boost/smart_ptr/scoped_ptr.hpp>
00011 
00012 using namespace boost::unit_test;
00013 
00014 BOOST_AUTO_TEST_SUITE( ofx_tests_suite01 )
00015 
00016 BOOST_AUTO_TEST_CASE( ofx_imageEffect_clones )
00017 {
00018         using namespace std;
00019         using namespace tuttle::host;
00020 
00021         core().getPluginCache().addDirectoryToPath( BOOST_PP_STRINGIZE(TUTTLE_PLUGIN_PATH) );
00022         tuttle::host::core().preload();
00023 
00024         // get some plugins examples
00025         tuttle::host::ofx::imageEffect::OfxhImageEffectPlugin* plugin = tuttle::host::core().getImageEffectPluginById( "tuttle.pngreader" );
00026         BOOST_CHECK( plugin != NULL );
00027 
00028         //      BOOST_CHECK_THROW( plugin->getProperties().fetchPointerProperty( kOfxPropInstanceData ), exception::LogicError );
00029 
00030         boost::scoped_ptr<tuttle::host::ImageEffectNode> ofxinst( dynamic_cast< tuttle::host::ImageEffectNode* >( plugin->createInstance( kOfxImageEffectContextReader ) ) );
00031         ofxinst->setName( "pluginTest" );
00032         BOOST_CHECK( ofxinst->getProperties().fetchPointerProperty( kOfxPropInstanceData ).getValue() != NULL );
00033 
00034         boost::scoped_ptr<tuttle::host::ImageEffectNode> ofxinstclone( ofxinst->clone() );
00035 
00036         BOOST_CHECK_NE( ofxinst.get(), ofxinstclone.get() );
00037         BOOST_CHECK( ( *ofxinst == *ofxinstclone ) );
00038         BOOST_CHECK( ofxinst->getProperties().fetchPointerProperty( kOfxPropInstanceData ).getValue() != NULL );
00039         BOOST_CHECK( ofxinstclone->getProperties().fetchPointerProperty( kOfxPropInstanceData ).getValue() != NULL );
00040         BOOST_CHECK( ofxinst->getProperties().fetchPointerProperty( kOfxPropInstanceData ).getValue() != ofxinstclone->getProperties().fetchPointerProperty( kOfxPropInstanceData ).getValue() );
00041 }
00042 
00043 BOOST_AUTO_TEST_SUITE_END()
00044