⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activetest.h

📁 This software aims to create an applet and panel tools to manage a wireless interface card, such as
💻 H
字号:
//
// ActiveTest.h
//
// $Id: //poco/Main/CppUnit/WinTestRunner/src/ActiveTest.h#5 $
//


#ifndef ActiveTest_INCLUDED
#define ActiveTest_INCLUDED


#ifndef CppUnit_CppUnit_INCLUDED
#include "CppUnit/CppUnit.h"
#endif
#ifndef CppUnit_TestDecorator_INCLUDED
#include "CppUnit/TestDecorator.h"
#endif
#include <afxmt.h>


CppUnit_BEGIN


/* A Microsoft-specific active test
 *
 * An active test manages its own
 * thread of execution.  This one
 * is very simple and only sufficient
 * for the limited use we put it through
 * in the TestRunner.  It spawns a thread
 * on run (TestResult *) and signals
 * completion of the test.
 *
 * We assume that only one thread
 * will be active at once for each
 * instance.
 *
 */
class ActiveTest: public TestDecorator
{
public:
	ActiveTest(Test* test);
	~ActiveTest();

    void run(TestResult* result);

protected:
    HANDLE      _threadHandle;
    CEvent      _runCompleted;
    TestResult* _currentTestResult;

    void run ();
    void setTestResult(TestResult* result);
    static UINT threadFunction(LPVOID thisInstance);
};


// Construct the active test
inline ActiveTest::ActiveTest(Test *test): TestDecorator(test)
{
	_currentTestResult = NULL; 
	_threadHandle = INVALID_HANDLE_VALUE;
}


// Pend until the test has completed
inline ActiveTest::~ActiveTest()
{
	CSingleLock(&_runCompleted, TRUE); 
}


// Set the test result that we are to run
inline void ActiveTest::setTestResult(TestResult* result)
{
	_currentTestResult = result; 
}


// Run our test result
inline void ActiveTest::run()
{
	TestDecorator::run(_currentTestResult);
}


CppUnit_END


#endif // ActiveTest_INCLUDED


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -