Mudbox/UnitTest.h Source File
Go to the documentation of this file.
28 virtual void RunAllTests();
29 virtual void Go(
bool ,
const QString& );
61 #define MB_START_TEST_OBJECT( testObjName ) \
62 class testObjName : public UnitTest \
64 static testObjName* s_pThis; \
67 testObjName() : m_sCommand(this, "cmd") { \
68 m_sCommand.Connect(Kernel()->NextCommand); \
72 virtual ~testObjName() { \
73 if( s_pThis == this ) \
76 void OnNodeEvent( const Attribute &cAttribute, NodeEventType eType ) { \
77 if( cAttribute == m_sCommand && eType == etValueChanged ) { \
78 QString sOp = m_sCommand.Value().section( ' ', 0, 0 ); \
79 if( sOp == "PluginTest" ) \
80 Go(false, m_sCommand.Value().section( ' ', 1, 1 )); \
83 static void RunAll() { \
85 s_pThis->Go( false, "" ); \
87 static QString ClassName() { \
88 return #testObjName; \
91 #define MB_END_TEST_OBJECT( testObjName ) \
92 }; IMPLEMENT_CLASS( testObjName, UnitTest, #testObjName ); \
93 testObjName* testObjName::s_pThis = 0;
95 #define MB_START_DEF_TESTS \
96 virtual void Go(bool bInit, const QString& sTest) { \
99 Kernel()->Interface()->AddCallbackMenuItem( NTR("UnitTest"), ClassName(), NTR("Run all tests"), RunAll ); \
102 #define MB_END_DEF_TESTS \
107 #define MB_DECL_TEST(name) \
110 Kernel()->RecordCommand( NTRQ("PluginTest %1%2").arg(ClassName()).arg(#name) ); \
112 s_pThis->Go(false, ClassName() + QString(#name)); \
113 QString sMsg = NTRQ("Completed Test: %1").arg(ClassName() + QString(#name)); \
114 Kernel()->Log( sMsg ); \
115 Kernel()->Interface()->SetStatus( mudbox::Interface::stNormal, sMsg ); \
121 #define MB_DEF_TEST(name) \
123 Kernel()->Interface()->AddCallbackMenuItem( NTR("UnitTest"), ClassName(), #name, name); \
124 else if ( sTest == ClassName() + QString(#name) || sTest.isEmpty() ) \
126 #define MB_CHECK(condition) \
127 if( !(condition) ) { \
129 Kernel()->Log( NTRQ("UnitTest assert failed: %1").arg( #condition ) ); \
130 MB_ERROR( NTRQ("UnitTest assert failed: %1").arg( #condition ) ); \
Base class for unit test objects.
This is the base class for most classes in the Mudbox SDK.
Class: ConvolutionKernel.
#define DECLARE_CLASS
This macro should be used in declaration of classes which are inherited from the Node class (or any d...