Click here to Skip to main content
15,895,256 members
Articles / Desktop Programming / MFC

Unit Test's Reporter

Rate me:
Please Sign up or sign in to vote.
4.86/5 (28 votes)
19 Feb 2006CPOL11 min read 64.8K   2.8K   58  
The article describes an application built to visualise testing processes for the unit test framework of CppUnitLite.
// DummySplitter.cpp : implementation file
//

#include "stdafx.h"
#include "DummySplitter.h"
#include ".\dummysplitter.h"
#include "EasyTestViewer.h"
#include "MainFrm.h"
#include "DummyForm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

IMPLEMENT_DYNAMIC(CTestSplitter, CSplitterWnd)

/////////////////////////////////////////////////////////////////////////////
// CTestSplitter
CWnd*	GetWinObject	(TCHAR*,int);

CTestSplitter::CTestSplitter()
{
}

CTestSplitter::~CTestSplitter()
{
}


BEGIN_MESSAGE_MAP(CTestSplitter, CSplitterWnd)
	//{{AFX_MSG_MAP(CTestSplitter)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
//	ON_WM_SIZE()
END_MESSAGE_MAP()

void CTestSplitter::SetActivePane( int row, int col, CWnd* pWnd)
{

  CSplitterWnd::SetActivePane(row,col,pWnd);
}

/////////////////////////////////////////////////////////////////////////////
// CTestSplitter message handlers

void CTestSplitter::OnLButtonDown(UINT nFlags, CPoint point)
{
	CSplitterWnd::OnLButtonDown(nFlags, point);
//@	CSplitterWnd::OnLButtonUp(nFlags, point);
}

void CTestSplitter::OnLButtonUp(UINT nFlags, CPoint point)
{
	CSplitterWnd::OnLButtonUp(nFlags, point);

	CTestPanel*	pTestPanel	= static_cast<CTestPanel*>(GetWinObject(TEXT("CTestPanel"),3));
	if (pTestPanel)
	{
		pTestPanel->Resize();
	}

}

CWnd*	GetWinObject(
		TCHAR*	pClassName,
		int		iNumber)
{
	CWnd		*result	= NULL,
				*pWnd	= NULL;
	CRuntimeClass
				*pObject= NULL;
	CMainFrame	*pParent= NULL
	;
	if (!pClassName
	||	!_tcslen(pClassName))
		return	result
	;
	pParent		= (static_cast<CTestViewer*>(AfxGetApp()))->pMainFrame;
	if (!pParent)
		return	result
	;
	if (!pParent->m_hWnd
	||	!IsWindow(pParent->m_hWnd))
		return	result
	;
	pWnd = pParent->m_Framework.GetObject(iNumber);
	if (!pWnd)
		return	result
	;
	if (!pWnd->m_hWnd
	||	!IsWindow(pWnd->m_hWnd))
		return	result
	;
	pObject	= pWnd->GetRuntimeClass();
	if (!pObject)
		return	result
	;
	if (_tcsicmp(pObject->m_lpszClassName,pClassName))
		return	result
	;
	result	= pWnd
	;
	return	result
	;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Israel Israel
MSc in System Engineering from Tallinn Technical University, Estonia. Currently, I work in a hitech enterprise in Israel.

Comments and Discussions