Loading...
Searching...
No Matches
CxxTest::Win32Gui Class Reference

`#include <Win32Gui.h>`

## Public Member Functions

void | enterGui (int &argc, char **argv)
void | enterWorld (const WorldDescription &wd)
void | guiEnterSuite (const char *suiteName)
void | guiEnterTest (const char *suiteName, const char *testName)
void | yellowBar ()
void | redBar ()
void | leaveGui ()
Public Member Functions inherited from CxxTest::GuiListener
| GuiListener ()
virtual | ~GuiListener ()
virtual void | runGui (int &argc, char **argv, TestListener &listener)
virtual void | guiEnterWorld (unsigned)
void | enterSuite (const SuiteDescription &d)
void | enterTest (const TestDescription &d)
void | leaveTest (const TestDescription &)
void | leaveSuite (const SuiteDescription &)
void | leaveWorld (const WorldDescription &)
void | warning (const char *, unsigned, const char *)
void | failedTest (const char *, unsigned, const char *)
void | failedAssert (const char *, unsigned, const char *)
void | failedAssertEquals (const char *, unsigned, const char *, const char *, const char *, const char *)
void | failedAssertSameData (const char *, unsigned, const char *, const char *, const char *, const void *, const void *, unsigned)
void | failedAssertDelta (const char *, unsigned, const char *, const char *, const char *, const char *, const char *, const char *)
void | failedAssertDiffers (const char *, unsigned, const char *, const char *, const char *)
void | failedAssertLessThan (const char *, unsigned, const char *, const char *, const char *, const char *)
void | failedAssertLessThanEquals (const char *, unsigned, const char *, const char *, const char *, const char *)
void | failedAssertPredicate (const char *, unsigned, const char *, const char *, const char *)
void | failedAssertRelation (const char *, unsigned, const char *, const char *, const char *, const char *, const char *)
void | failedAssertThrows (const char *, unsigned, const char *, const char *, bool)
void | failedAssertThrowsNot (const char *, unsigned, const char *)
Public Member Functions inherited from CxxTest::TestListener
| TestListener ()
virtual | ~TestListener ()
virtual void | trace (const char *, unsigned, const char *)

## Private Types

enum | { STATUS_SUITE_NAME , STATUS_SUITE_TIME , STATUS_TEST_NAME , STATUS_TEST_TIME , STATUS_TESTS_DONE , STATUS_WORLD_TIME , STATUS_TOTAL_PARTS }
enum | { TIMER_ID = 1 , TIMER_DELAY = 1000 }

## Private Member Functions

void | parseCommandLine (int argc, char **argv)
void | getTotalTests ()
void | getTotalTests (const WorldDescription &wd)
void | startGuiThread ()
void | gui ()
void | registerWindowClass ()
void | createMainWindow ()
void | initCommonControls ()
void | createProgressBar ()
void | createStatusBar ()
void | setRatios (unsigned suiteNameRatio, unsigned suiteTimeRatio, unsigned testNameRatio, unsigned testTimeRatio, unsigned testsDoneRatio, unsigned worldTimeRatio)
HWND | createWindow (LPCTSTR className, DWORD style, HWND parent=(HWND) NULL)
void | progressBarMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
void | centerMainWindow ()
void | getScreenArea (RECT &area)
bool | getScreenAreaWithoutTaskbar (RECT &area)
void | getWholeScreenArea (RECT &area)
void | showMainWindow ()
void | showMainWindow (int mode)
void | startTimer ()
void | reset (DWORD &tick)
void | startTests ()
void | messageLoop ()
LRESULT | handle (HWND window, UINT message, WPARAM wParam, LPARAM lParam)
void | resizeControls ()
void | setStatusParts (LONG width)
void | statusBarMessage (UINT message, WPARAM wParam=0, const void *lParam=0)
void | greenBar ()
void | setColor (BYTE, BYTE, BYTE)
void | setIcon (LPCTSTR icon)
HICON | loadStandardIcon (LPCTSTR icon)
void | setTestCaption (const char *suiteName, const char *testName)
void | setCaption (const char *a="", const char *b="", const char *c="", const char *d="")
void | showSuiteName (const char *suiteName)
void | showTestName (const char *testName)
void | showTestsDone ()
void | updateTime ()
void | setStatusTime (unsigned part, DWORD start)
bool | keep ()
void | showSummary ()
void | setStatusPart (unsigned part, const char *text)
void | stopTimer ()
void | setSummaryStatusBar ()
void | setSummaryCaption ()
char * | allocate (unsigned length)
void | deallocate (char *data)

## Static Private Member Functions

static DWORD WINAPI | guiThread (LPVOID parameter)
static LRESULT CALLBACK | windowProcedure (HWND window, UINT message, WPARAM wParam, LPARAM lParam)
static void | setUp (HWND window, LPCREATESTRUCT create)

## Private Attributes

const char * | _title
bool | _startMinimized
bool | _keep
HANDLE | _gui
WNDCLASSEX | _windowClass
HWND | _mainWindow
HWND | _progressBar
HWND | _statusBar
HANDLE | _canStartTests
unsigned | _numTotalTests
unsigned | _testsDone
char | _strTotalTests [WorldDescription::MAX_STRLEN_TOTAL_TESTS]
int | _statusWidths [STATUS_TOTAL_PARTS]
unsigned | _statusOffsets [STATUS_TOTAL_PARTS]
unsigned | _statusTotal
char | _statusTestsDone [sizeof("1000000000 of (100%)")+WorldDescription::MAX_STRLEN_TOTAL_TESTS]
DWORD | _worldStart
DWORD | _suiteStart
DWORD | _testStart
char | _timeString [sizeof("00:00:00")]

## Additional Inherited Members

Protected Member Functions inherited from CxxTest::GuiListener
void | yellowBarSafe ()
void | redBarSafe ()

## Detailed Description

Definition at line 27 of file Win32Gui.h.

## Member Enumeration Documentation

## anonymous enum

anonymous enum

private

Enumerator
TIMER_ID |
TIMER_DELAY |

Definition at line 295 of file Win32Gui.h.

{ TIMER_ID = 1, TIMER_DELAY = 1000 };
CxxTest::Win32Gui::TIMER_DELAY
@ TIMER_DELAY
Definition Win32Gui.h:295
CxxTest::Win32Gui::TIMER_ID
@ TIMER_ID
Definition Win32Gui.h:295

## anonymous enum

anonymous enum

private

Enumerator
STATUS_SUITE_NAME |
STATUS_SUITE_TIME |
STATUS_TEST_NAME |
STATUS_TEST_TIME |
STATUS_TESTS_DONE |
STATUS_WORLD_TIME |
STATUS_TOTAL_PARTS |

Definition at line 93 of file Win32Gui.h.

{
STATUS_SUITE_NAME, STATUS_SUITE_TIME,
STATUS_TEST_NAME, STATUS_TEST_TIME,
STATUS_TESTS_DONE, STATUS_WORLD_TIME,
STATUS_TOTAL_PARTS
};
CxxTest::Win32Gui::STATUS_SUITE_NAME
@ STATUS_SUITE_NAME
Definition Win32Gui.h:94
CxxTest::Win32Gui::STATUS_TEST_NAME
@ STATUS_TEST_NAME
Definition Win32Gui.h:95
CxxTest::Win32Gui::STATUS_SUITE_TIME
@ STATUS_SUITE_TIME
Definition Win32Gui.h:94
CxxTest::Win32Gui::STATUS_TOTAL_PARTS
@ STATUS_TOTAL_PARTS
Definition Win32Gui.h:97
CxxTest::Win32Gui::STATUS_TEST_TIME
@ STATUS_TEST_TIME
Definition Win32Gui.h:95
CxxTest::Win32Gui::STATUS_TESTS_DONE
@ STATUS_TESTS_DONE
Definition Win32Gui.h:96
CxxTest::Win32Gui::STATUS_WORLD_TIME
@ STATUS_WORLD_TIME
Definition Win32Gui.h:96

## Member Function Documentation

## allocate()

char * CxxTest::Win32Gui::allocate | ( | unsigned | length | ) |

inline private

Definition at line 519 of file Win32Gui.h.

{
return (char *)HeapAlloc( GetProcessHeap(), 0, length );
}
length
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257

## centerMainWindow()

void CxxTest::Win32Gui::centerMainWindow | ( |  | ) |

inline private

Definition at line 244 of file Win32Gui.h.

{
RECT screen;
getScreenArea( screen );
LONG screenWidth = screen.right - screen.left;
LONG screenHeight = screen.bottom - screen.top;
LONG xCenter = (screen.right + screen.left) / 2;
LONG yCenter = (screen.bottom + screen.top) / 2;
LONG windowWidth = (screenWidth * 4) / 5;
LONG windowHeight = screenHeight / 10;
LONG minimumHeight = 2 * (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYFRAME ));
if ( windowHeight < minimumHeight )
windowHeight = minimumHeight;
SetWindowPos( _mainWindow, HWND_TOP,
xCenter - (windowWidth / 2), yCenter - (windowHeight / 2),
windowWidth, windowHeight, 0 );
}
CxxTest::Win32Gui::_mainWindow
HWND _mainWindow
Definition Win32Gui.h:89
CxxTest::Win32Gui::getScreenArea
void getScreenArea(RECT &area)
Definition Win32Gui.h:266
LONG
#define LONG
Definition longrat.cc:105

## createMainWindow()

void CxxTest::Win32Gui::createMainWindow | ( |  | ) |

inline private

Definition at line 180 of file Win32Gui.h.

{
_mainWindow = createWindow( _windowClass.lpszClassName, WS_OVERLAPPEDWINDOW );
}
CxxTest::Win32Gui::createWindow
HWND createWindow(LPCTSTR className, DWORD style, HWND parent=(HWND) NULL)
Definition Win32Gui.h:233
CxxTest::Win32Gui::_windowClass
WNDCLASSEX _windowClass
Definition Win32Gui.h:88

## createProgressBar()

void CxxTest::Win32Gui::createProgressBar | ( |  | ) |

inline private

Definition at line 199 of file Win32Gui.h.

{
_progressBar = createWindow( PROGRESS_CLASS, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, _mainWindow );
#ifdef PBM_SETRANGE32
progressBarMessage( PBM_SETRANGE32, 0, _numTotalTests );
#else // No PBM_SETRANGE32, use PBM_SETRANGE
progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) );
#endif // PBM_SETRANGE32
progressBarMessage( PBM_SETPOS, 0 );
progressBarMessage( PBM_SETSTEP, 1 );
greenBar();
UpdateWindow( _progressBar );
}
CxxTest::Win32Gui::progressBarMessage
void progressBarMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition Win32Gui.h:239
CxxTest::Win32Gui::greenBar
void greenBar()
Definition Win32Gui.h:385
CxxTest::Win32Gui::_numTotalTests
unsigned _numTotalTests
Definition Win32Gui.h:91
CxxTest::Win32Gui::_progressBar
HWND _progressBar
Definition Win32Gui.h:89

## createStatusBar()

void CxxTest::Win32Gui::createStatusBar | ( |  | ) |

inline private

Definition at line 214 of file Win32Gui.h.

{
_statusBar = createWindow( STATUSCLASSNAME, WS_CHILD | WS_VISIBLE, _mainWindow );
setRatios( 4, 1, 3, 1, 3, 1 );
}
CxxTest::Win32Gui::setRatios
void setRatios(unsigned suiteNameRatio, unsigned suiteTimeRatio, unsigned testNameRatio, unsigned testTimeRatio, unsigned testsDoneRatio, unsigned worldTimeRatio)
Definition Win32Gui.h:220
CxxTest::Win32Gui::_statusBar
HWND _statusBar
Definition Win32Gui.h:89

## createWindow()

HWND CxxTest::Win32Gui::createWindow | ( | LPCTSTR | className,
|  | DWORD | style,
|  | HWND | parent = (HWND)NULL )

inline private

Definition at line 233 of file Win32Gui.h.

{
return CreateWindow( className, NULL, style, 0, 0, 0, 0, parent,
(HMENU)NULL, (HINSTANCE)NULL, (LPVOID)this );
}
NULL
#define NULL
Definition omList.c:12

## deallocate()

void CxxTest::Win32Gui::deallocate | ( | char * | data | ) |

inline private

Definition at line 524 of file Win32Gui.h.

{
HeapFree( GetProcessHeap(), 0, data );
}

## enterGui()

void CxxTest::Win32Gui::enterGui | ( | int & | argc,
|  | char ** | argv )

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 30 of file Win32Gui.h.

{
parseCommandLine( argc, argv );
}
CxxTest::Win32Gui::parseCommandLine
void parseCommandLine(int argc, char **argv)
Definition Win32Gui.h:106

## enterWorld()

void CxxTest::Win32Gui::enterWorld | ( | const WorldDescription & | wd | ) |

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 35 of file Win32Gui.h.

{
getTotalTests( wd );
_testsDone = 0;
startGuiThread();
}
CxxTest::Win32Gui::getTotalTests
void getTotalTests()
Definition Win32Gui.h:122
CxxTest::Win32Gui::startGuiThread
void startGuiThread()
Definition Win32Gui.h:133
CxxTest::Win32Gui::_testsDone
unsigned _testsDone
Definition Win32Gui.h:91

## getScreenArea()

void CxxTest::Win32Gui::getScreenArea | ( | RECT & | area | ) |

inline private

Definition at line 266 of file Win32Gui.h.

{
if ( !getScreenAreaWithoutTaskbar( area ) )
getWholeScreenArea( area );
}
CxxTest::Win32Gui::getWholeScreenArea
void getWholeScreenArea(RECT &area)
Definition Win32Gui.h:277
CxxTest::Win32Gui::getScreenAreaWithoutTaskbar
bool getScreenAreaWithoutTaskbar(RECT &area)
Definition Win32Gui.h:272

## getScreenAreaWithoutTaskbar()

bool CxxTest::Win32Gui::getScreenAreaWithoutTaskbar | ( | RECT & | area | ) |

inline private

Definition at line 272 of file Win32Gui.h.

{
return (SystemParametersInfo( SPI_GETWORKAREA, sizeof(RECT), &area, 0 ) != 0);
}

## getTotalTests() [1/2]

void CxxTest::Win32Gui::getTotalTests | ( |  | ) |

inline private

Definition at line 122 of file Win32Gui.h.

{
getTotalTests( tracker().world() );
}
CxxTest::tracker
TestTracker & tracker()
Definition TestTracker.h:111

## getTotalTests() [2/2]

void CxxTest::Win32Gui::getTotalTests | ( | const WorldDescription & | wd | ) |

inline private

Definition at line 127 of file Win32Gui.h.

{
_numTotalTests = wd.numTotalTests();
wd.strTotalTests( _strTotalTests );
}
CxxTest::Win32Gui::_strTotalTests
char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]
Definition Win32Gui.h:92

## getWholeScreenArea()

void CxxTest::Win32Gui::getWholeScreenArea | ( | RECT & | area | ) |

inline private

Definition at line 277 of file Win32Gui.h.

{
area.left = area.top = 0;
area.right = GetSystemMetrics( SM_CXSCREEN );
area.bottom = GetSystemMetrics( SM_CYSCREEN );
}

## greenBar()

void CxxTest::Win32Gui::greenBar | ( |  | ) |

inline private

Definition at line 385 of file Win32Gui.h.

{
setColor( 0, 255, 0 );
setIcon( IDI_INFORMATION );
}
CxxTest::Win32Gui::setIcon
void setIcon(LPCTSTR icon)
Definition Win32Gui.h:402
CxxTest::Win32Gui::setColor
void setColor(BYTE, BYTE, BYTE)
Definition Win32Gui.h:397

## gui()

void CxxTest::Win32Gui::gui | ( |  | ) |

inline private

Definition at line 147 of file Win32Gui.h.

{
registerWindowClass();
createMainWindow();
initCommonControls();
createProgressBar();
createStatusBar();
centerMainWindow();
showMainWindow();
startTimer();
startTests();
messageLoop();
}
CxxTest::Win32Gui::centerMainWindow
void centerMainWindow()
Definition Win32Gui.h:244
CxxTest::Win32Gui::createProgressBar
void createProgressBar()
Definition Win32Gui.h:199
CxxTest::Win32Gui::startTimer
void startTimer()
Definition Win32Gui.h:297
CxxTest::Win32Gui::messageLoop
void messageLoop()
Definition Win32Gui.h:315
CxxTest::Win32Gui::initCommonControls
void initCommonControls()
Definition Win32Gui.h:185
CxxTest::Win32Gui::createMainWindow
void createMainWindow()
Definition Win32Gui.h:180
CxxTest::Win32Gui::createStatusBar
void createStatusBar()
Definition Win32Gui.h:214
CxxTest::Win32Gui::registerWindowClass
void registerWindowClass()
Definition Win32Gui.h:162
CxxTest::Win32Gui::startTests
void startTests()
Definition Win32Gui.h:310
CxxTest::Win32Gui::showMainWindow
void showMainWindow()
Definition Win32Gui.h:284

## guiEnterSuite()

void CxxTest::Win32Gui::guiEnterSuite | ( | const char * | suiteName | ) |

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 42 of file Win32Gui.h.

{
showSuiteName( suiteName );
reset( _suiteStart );
}
CxxTest::Win32Gui::_suiteStart
DWORD _suiteStart
Definition Win32Gui.h:103
CxxTest::Win32Gui::reset
void reset(DWORD &tick)
Definition Win32Gui.h:305
CxxTest::Win32Gui::showSuiteName
void showSuiteName(const char *suiteName)
Definition Win32Gui.h:432

## guiEnterTest()

void CxxTest::Win32Gui::guiEnterTest | ( | const char * | suiteName,
|  | const char * | testName )

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 48 of file Win32Gui.h.

{
++ _testsDone;
setTestCaption( suiteName, testName );
showTestName( testName );
showTestsDone();
progressBarMessage( PBM_STEPIT );
reset( _testStart );
}
CxxTest::Win32Gui::_testStart
DWORD _testStart
Definition Win32Gui.h:103
CxxTest::Win32Gui::showTestName
void showTestName(const char *testName)
Definition Win32Gui.h:437
CxxTest::Win32Gui::showTestsDone
void showTestsDone()
Definition Win32Gui.h:442
CxxTest::Win32Gui::setTestCaption
void setTestCaption(const char *suiteName, const char *testName)
Definition Win32Gui.h:412

## guiThread()

DWORD WINAPI CxxTest::Win32Gui::guiThread | ( | LPVOID | parameter | ) |

inline static private

Definition at line 141 of file Win32Gui.h.

{
((Win32Gui *)parameter)->gui();
return 0;
}

## handle()

LRESULT CxxTest::Win32Gui::handle | ( | HWND | window,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam )

inline private

Definition at line 337 of file Win32Gui.h.

{
switch ( message )
{
case WM_SIZE: resizeControls(); break;
case WM_TIMER: updateTime(); break;
case WM_CLOSE:
case WM_DESTROY:
case WM_QUIT:
ExitProcess( 0 );
default: return DefWindowProc( window, message, wParam, lParam );
}
return 0;
}
CxxTest::Win32Gui::updateTime
void updateTime()
Definition Win32Gui.h:450
CxxTest::Win32Gui::resizeControls
void resizeControls()
Definition Win32Gui.h:355
message
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463

## initCommonControls()

void CxxTest::Win32Gui::initCommonControls | ( |  | ) |

inline private

Definition at line 185 of file Win32Gui.h.

{
HMODULE dll = LoadLibraryA( "comctl32.dll" );
if ( !dll )
return;
typedef void (WINAPI *FUNC)( void );
FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" );
if ( !func )
return;
func();
}

## keep()

bool CxxTest::Win32Gui::keep | ( |  | ) |

inline private

Definition at line 472 of file Win32Gui.h.

{
if ( !_keep )
return false;
if ( !_startMinimized )
return true;
return (_mainWindow == GetForegroundWindow());
}
CxxTest::Win32Gui::_keep
bool _keep
Definition Win32Gui.h:86
CxxTest::Win32Gui::_startMinimized
bool _startMinimized
Definition Win32Gui.h:86

## leaveGui()

void CxxTest::Win32Gui::leaveGui | ( |  | ) |

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 74 of file Win32Gui.h.

{
if ( keep() )
{
showSummary();
WaitForSingleObject( _gui, INFINITE );
}
DestroyWindow( _mainWindow );
}
CxxTest::Win32Gui::_gui
HANDLE _gui
Definition Win32Gui.h:87
CxxTest::Win32Gui::showSummary
void showSummary()
Definition Win32Gui.h:481
CxxTest::Win32Gui::keep
bool keep()
Definition Win32Gui.h:472

## loadStandardIcon()

HICON CxxTest::Win32Gui::loadStandardIcon | ( | LPCTSTR | icon | ) |

inline private

Definition at line 407 of file Win32Gui.h.

{
return LoadIcon( (HINSTANCE)NULL, icon );
}

## messageLoop()

void CxxTest::Win32Gui::messageLoop | ( |  | ) |

inline private

Definition at line 315 of file Win32Gui.h.

{
MSG message;
while ( BOOL haveMessage = GetMessage( &message, NULL, 0, 0 ) )
if ( haveMessage != -1 )
DispatchMessage( &message );
}

## parseCommandLine()

void CxxTest::Win32Gui::parseCommandLine | ( | int | argc,
|  | char ** | argv )

inline private

Definition at line 106 of file Win32Gui.h.

{
_startMinimized = _keep = false;
_title = argv[0];
for ( int i = 1; i < argc; ++ i )
{
if ( !lstrcmpA( argv[i], "-minimized" ) )
_startMinimized = true;
else if ( !lstrcmpA( argv[i], "-keep" ) )
_keep = true;
else if ( !lstrcmpA( argv[i], "-title" ) && (i + 1 < argc) )
_title = argv[++i];
}
}
i
int i
Definition cfEzgcd.cc:132
CxxTest::Win32Gui::_title
const char * _title
Definition Win32Gui.h:85

## progressBarMessage()

void CxxTest::Win32Gui::progressBarMessage | ( | UINT | message,
|  | WPARAM | wParam = 0,
|  | LPARAM | lParam = 0 )

inline private

Definition at line 239 of file Win32Gui.h.

{
SendMessage( _progressBar, message, wParam, lParam );
}

## redBar()

void CxxTest::Win32Gui::redBar | ( |  | ) |

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 65 of file Win32Gui.h.

{
if ( _startMinimized )
showMainWindow( SW_SHOWNORMAL );
setColor( 255, 0, 0 );
setIcon( IDI_ERROR );
getTotalTests();
}

## registerWindowClass()

void CxxTest::Win32Gui::registerWindowClass | ( |  | ) |

inline private

Definition at line 162 of file Win32Gui.h.

{
_windowClass.cbSize = sizeof(_windowClass);
_windowClass.style = CS_HREDRAW | CS_VREDRAW;
_windowClass.lpfnWndProc = &(Win32Gui::windowProcedure);
_windowClass.cbClsExtra = 0;
_windowClass.cbWndExtra = sizeof(LONG);
_windowClass.hInstance = (HINSTANCE)NULL;
_windowClass.hIcon = (HICON)NULL;
_windowClass.hCursor = (HCURSOR)NULL;
_windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
_windowClass.lpszMenuName = NULL;
_windowClass.lpszClassName = TEXT("CxxTest Window Class");
_windowClass.hIconSm = (HICON)NULL;
RegisterClassEx( &_windowClass );
}
CxxTest::Win32Gui::windowProcedure
static LRESULT CALLBACK windowProcedure(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
Definition Win32Gui.h:323

## reset()

void CxxTest::Win32Gui::reset | ( | DWORD & | tick | ) |

inline private

Definition at line 305 of file Win32Gui.h.

{
tick = GetTickCount();
}

## resizeControls()

void CxxTest::Win32Gui::resizeControls | ( |  | ) |

inline private

Definition at line 355 of file Win32Gui.h.

{
RECT r;
GetClientRect( _mainWindow, &r );
LONG width = r.right - r.left;
LONG height = r.bottom - r.top;
GetClientRect( _statusBar, &r );
LONG statusHeight = r.bottom - r.top;
LONG resizeGripWidth = statusHeight;
LONG progressHeight = height - statusHeight;
SetWindowPos( _progressBar, HWND_TOP, 0, 0, width, progressHeight, 0 );
SetWindowPos( _statusBar, HWND_TOP, 0, progressHeight, width, statusHeight, 0 );
setStatusParts( width - resizeGripWidth );
}
CxxTest::Win32Gui::setStatusParts
void setStatusParts(LONG width)
Definition Win32Gui.h:372

## setCaption()

void CxxTest::Win32Gui::setCaption | ( | const char * | a = "",
|  | const char * | b = "",
|  | const char * | c = "",
|  | const char * | d = "" )

inline private

Definition at line 417 of file Win32Gui.h.

{
unsigned length = lstrlenA( _title ) + sizeof( " - " ) +
lstrlenA( a ) + lstrlenA( b ) + lstrlenA( c ) + lstrlenA( d );
char *name = allocate( length );
lstrcpyA( name, _title );
lstrcatA( name, " - " );
lstrcatA( name, a );
lstrcatA( name, b );
lstrcatA( name, c );
lstrcatA( name, d );
SetWindowTextA( _mainWindow, name );
deallocate( name );
}
b
CanonicalForm b
Definition cfModGcd.cc:4111
CxxTest::Win32Gui::allocate
char * allocate(unsigned length)
Definition Win32Gui.h:519
CxxTest::Win32Gui::deallocate
void deallocate(char *data)
Definition Win32Gui.h:524
name
char name(const Variable &v)
Definition factory.h:189

## setColor()

void CxxTest::Win32Gui::setColor | ( | BYTE | ,
|  | BYTE | ,
|  | BYTE | )

inline private

Definition at line 397 of file Win32Gui.h.

{
}

## setIcon()

void CxxTest::Win32Gui::setIcon | ( | LPCTSTR | icon | ) |

inline private

Definition at line 402 of file Win32Gui.h.

{
SendMessage( _mainWindow, WM_SETICON, ICON_BIG, (LPARAM)loadStandardIcon( icon ) );
}
CxxTest::Win32Gui::loadStandardIcon
HICON loadStandardIcon(LPCTSTR icon)
Definition Win32Gui.h:407

## setRatios()

void CxxTest::Win32Gui::setRatios | ( | unsigned | suiteNameRatio,
|  | unsigned | suiteTimeRatio,
|  | unsigned | testNameRatio,
|  | unsigned | testTimeRatio,
|  | unsigned | testsDoneRatio,
|  | unsigned | worldTimeRatio )

inline private

Definition at line 220 of file Win32Gui.h.

{
_statusTotal = 0;
_statusOffsets[STATUS_SUITE_NAME] = (_statusTotal += suiteNameRatio);
_statusOffsets[STATUS_SUITE_TIME] = (_statusTotal += suiteTimeRatio);
_statusOffsets[STATUS_TEST_NAME] = (_statusTotal += testNameRatio);
_statusOffsets[STATUS_TEST_TIME] = (_statusTotal += testTimeRatio);
_statusOffsets[STATUS_TESTS_DONE] = (_statusTotal += testsDoneRatio);
_statusOffsets[STATUS_WORLD_TIME] = (_statusTotal += worldTimeRatio);
}
CxxTest::Win32Gui::_statusTotal
unsigned _statusTotal
Definition Win32Gui.h:101
CxxTest::Win32Gui::_statusOffsets
unsigned _statusOffsets[STATUS_TOTAL_PARTS]
Definition Win32Gui.h:100

## setStatusPart()

void CxxTest::Win32Gui::setStatusPart | ( | unsigned | part,
|  | const char * | text )

inline private

Definition at line 488 of file Win32Gui.h.

{
statusBarMessage( SB_SETTEXTA, part, text );
}
CxxTest::Win32Gui::statusBarMessage
void statusBarMessage(UINT message, WPARAM wParam=0, const void *lParam=0)
Definition Win32Gui.h:380

## setStatusParts()

void CxxTest::Win32Gui::setStatusParts | ( | LONG | width | ) |

inline private

Definition at line 372 of file Win32Gui.h.

{
for ( unsigned i = 0; i < STATUS_TOTAL_PARTS; ++ i )
_statusWidths[i] = (width * _statusOffsets[i]) / _statusTotal;
statusBarMessage( SB_SETPARTS, STATUS_TOTAL_PARTS, _statusWidths );
}
CxxTest::Win32Gui::_statusWidths
int _statusWidths[STATUS_TOTAL_PARTS]
Definition Win32Gui.h:99

## setStatusTime()

void CxxTest::Win32Gui::setStatusTime | ( | unsigned | part,
|  | DWORD | start )

inline private

Definition at line 457 of file Win32Gui.h.

{
unsigned total = (GetTickCount() - start) / 1000;
unsigned hours = total / 3600;
unsigned minutes = (total / 60) % 60;
unsigned seconds = total % 60;
if ( hours )
wsprintfA( _timeString, "%u:%02u:%02u", hours, minutes, seconds );
else
wsprintfA( _timeString, "%02u:%02u", minutes, seconds );
setStatusPart( part, _timeString );
}
CxxTest::Win32Gui::_timeString
char _timeString[sizeof("00:00:00")]
Definition Win32Gui.h:104
CxxTest::Win32Gui::setStatusPart
void setStatusPart(unsigned part, const char *text)
Definition Win32Gui.h:488

## setSummaryCaption()

void CxxTest::Win32Gui::setSummaryCaption | ( |  | ) |

inline private

Definition at line 514 of file Win32Gui.h.

{
setCaption( _statusTestsDone );
}
CxxTest::Win32Gui::setCaption
void setCaption(const char *a="", const char *b="", const char *c="", const char *d="")
Definition Win32Gui.h:417
CxxTest::Win32Gui::_statusTestsDone
char _statusTestsDone[sizeof("1000000000 of (100%)")+WorldDescription::MAX_STRLEN_TOTAL_TESTS]
Definition Win32Gui.h:102

## setSummaryStatusBar()

void CxxTest::Win32Gui::setSummaryStatusBar | ( |  | ) |

inline private

Definition at line 499 of file Win32Gui.h.

{
setRatios( 0, 0, 0, 0, 1, 1 );
resizeControls();
const char *tests = (_numTotalTests == 1) ? "test" : "tests";
if ( tracker().failedTests() )
wsprintfA( _statusTestsDone, "Failed %u of %s %s",
tracker().failedTests(), _strTotalTests, tests );
else
wsprintfA( _statusTestsDone, "%s %s passed", _strTotalTests, tests );
setStatusPart( STATUS_TESTS_DONE, _statusTestsDone );
}

## setTestCaption()

void CxxTest::Win32Gui::setTestCaption | ( | const char * | suiteName,
|  | const char * | testName )

inline private

Definition at line 412 of file Win32Gui.h.

{
setCaption( suiteName, "::", testName, "()" );
}

## setUp()

void CxxTest::Win32Gui::setUp | ( | HWND | window,
|  | LPCREATESTRUCT | create )

inline static private

Definition at line 332 of file Win32Gui.h.

{
SetWindowLong( window, GWL_USERDATA, (LONG)create->lpCreateParams );
}
create
NodeM * create()
Definition janet.cc:757

## showMainWindow() [1/2]

void CxxTest::Win32Gui::showMainWindow | ( |  | ) |

inline private

Definition at line 284 of file Win32Gui.h.

{
showMainWindow( _startMinimized ? SW_MINIMIZE : SW_SHOWNORMAL );
UpdateWindow( _mainWindow );
}

## showMainWindow() [2/2]

void CxxTest::Win32Gui::showMainWindow | ( | int | mode | ) |

inline private

Definition at line 290 of file Win32Gui.h.

{
ShowWindow( _mainWindow, mode );
}

## showSuiteName()

void CxxTest::Win32Gui::showSuiteName | ( | const char * | suiteName | ) |

inline private

Definition at line 432 of file Win32Gui.h.

{
setStatusPart( STATUS_SUITE_NAME, suiteName );
}

## showSummary()

void CxxTest::Win32Gui::showSummary | ( |  | ) |

inline private

Definition at line 481 of file Win32Gui.h.

{
stopTimer();
setSummaryStatusBar();
setSummaryCaption();
}
CxxTest::Win32Gui::setSummaryStatusBar
void setSummaryStatusBar()
Definition Win32Gui.h:499
CxxTest::Win32Gui::setSummaryCaption
void setSummaryCaption()
Definition Win32Gui.h:514
CxxTest::Win32Gui::stopTimer
void stopTimer()
Definition Win32Gui.h:493

## showTestName()

void CxxTest::Win32Gui::showTestName | ( | const char * | testName | ) |

inline private

Definition at line 437 of file Win32Gui.h.

{
setStatusPart( STATUS_TEST_NAME, testName );
}

## showTestsDone()

void CxxTest::Win32Gui::showTestsDone | ( |  | ) |

inline private

Definition at line 442 of file Win32Gui.h.

{
wsprintfA( _statusTestsDone, "%u of %s (%u%%)",
_testsDone, _strTotalTests,
(_testsDone * 100) / _numTotalTests );
setStatusPart( STATUS_TESTS_DONE, _statusTestsDone );
}

## startGuiThread()

void CxxTest::Win32Gui::startGuiThread | ( |  | ) |

inline private

Definition at line 133 of file Win32Gui.h.

{
_canStartTests = CreateEvent( NULL, TRUE, FALSE, NULL );
DWORD threadId;
_gui = CreateThread( NULL, 0, &(Win32Gui::guiThread), (LPVOID)this, 0, &threadId );
WaitForSingleObject( _canStartTests, INFINITE );
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
CxxTest::Win32Gui::_canStartTests
HANDLE _canStartTests
Definition Win32Gui.h:90
CxxTest::Win32Gui::guiThread
static DWORD WINAPI guiThread(LPVOID parameter)
Definition Win32Gui.h:141

## startTests()

void CxxTest::Win32Gui::startTests | ( |  | ) |

inline private

Definition at line 310 of file Win32Gui.h.

{
SetEvent( _canStartTests );
}

## startTimer()

void CxxTest::Win32Gui::startTimer | ( |  | ) |

inline private

Definition at line 297 of file Win32Gui.h.

{
reset( _worldStart );
reset( _suiteStart );
reset( _testStart );
SetTimer( _mainWindow, TIMER_ID, TIMER_DELAY, 0 );
}
CxxTest::Win32Gui::_worldStart
DWORD _worldStart
Definition Win32Gui.h:103

## statusBarMessage()

void CxxTest::Win32Gui::statusBarMessage | ( | UINT | message,
|  | WPARAM | wParam = 0,
|  | const void * | lParam = 0 )

inline private

Definition at line 380 of file Win32Gui.h.

{
SendMessage( _statusBar, message, wParam, (LPARAM)lParam );
}

## stopTimer()

void CxxTest::Win32Gui::stopTimer | ( |  | ) |

inline private

Definition at line 493 of file Win32Gui.h.

{
KillTimer( _mainWindow, TIMER_ID );
setStatusTime( STATUS_WORLD_TIME, _worldStart );
}
CxxTest::Win32Gui::setStatusTime
void setStatusTime(unsigned part, DWORD start)
Definition Win32Gui.h:457

## updateTime()

void CxxTest::Win32Gui::updateTime | ( |  | ) |

inline private

Definition at line 450 of file Win32Gui.h.

{
setStatusTime( STATUS_WORLD_TIME, _worldStart );
setStatusTime( STATUS_SUITE_TIME, _suiteStart );
setStatusTime( STATUS_TEST_TIME, _testStart );
}

## windowProcedure()

LRESULT CALLBACK CxxTest::Win32Gui::windowProcedure | ( | HWND | window,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam )

inline static private

Definition at line 323 of file Win32Gui.h.

{
if ( message == WM_CREATE )
setUp( window, (LPCREATESTRUCT)lParam );
Win32Gui *that = (Win32Gui *)GetWindowLong( window, GWL_USERDATA );
return that->handle( window, message, wParam, lParam );
}
CxxTest::Win32Gui::setUp
static void setUp(HWND window, LPCREATESTRUCT create)
Definition Win32Gui.h:332

## yellowBar()

void CxxTest::Win32Gui::yellowBar | ( |  | ) |

inline virtual

Reimplemented from CxxTest::GuiListener.

Definition at line 58 of file Win32Gui.h.

{
setColor( 255, 255, 0 );
setIcon( IDI_WARNING );
getTotalTests();
}

## Field Documentation

## _canStartTests

HANDLE CxxTest::Win32Gui::_canStartTests

private

Definition at line 90 of file Win32Gui.h.

## _gui

HANDLE CxxTest::Win32Gui::_gui

private

Definition at line 87 of file Win32Gui.h.

## _keep

bool CxxTest::Win32Gui::_keep

private

Definition at line 86 of file Win32Gui.h.

## _mainWindow

HWND CxxTest::Win32Gui::_mainWindow

private

Definition at line 89 of file Win32Gui.h.

## _numTotalTests

unsigned CxxTest::Win32Gui::_numTotalTests

private

Definition at line 91 of file Win32Gui.h.

## _progressBar

HWND CxxTest::Win32Gui::_progressBar

private

Definition at line 89 of file Win32Gui.h.

## _startMinimized

bool CxxTest::Win32Gui::_startMinimized

private

Definition at line 86 of file Win32Gui.h.

## _statusBar

HWND CxxTest::Win32Gui::_statusBar

private

Definition at line 89 of file Win32Gui.h.

## _statusOffsets

unsigned CxxTest::Win32Gui::_statusOffsets[STATUS_TOTAL_PARTS]

private

Definition at line 100 of file Win32Gui.h.

## _statusTestsDone

char CxxTest::Win32Gui::_statusTestsDone[sizeof("1000000000 of (100%)")+WorldDescription::MAX_STRLEN_TOTAL_TESTS]

private

Definition at line 102 of file Win32Gui.h.

## _statusTotal

unsigned CxxTest::Win32Gui::_statusTotal

private

Definition at line 101 of file Win32Gui.h.

## _statusWidths

int CxxTest::Win32Gui::_statusWidths[STATUS_TOTAL_PARTS]

private

Definition at line 99 of file Win32Gui.h.

## _strTotalTests

char CxxTest::Win32Gui::_strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]

private

Definition at line 92 of file Win32Gui.h.

## _suiteStart

DWORD CxxTest::Win32Gui::_suiteStart

private

Definition at line 103 of file Win32Gui.h.

## _testsDone

unsigned CxxTest::Win32Gui::_testsDone

private

Definition at line 91 of file Win32Gui.h.

## _testStart

DWORD CxxTest::Win32Gui::_testStart

private

Definition at line 103 of file Win32Gui.h.

## _timeString

char CxxTest::Win32Gui::_timeString[sizeof("00:00:00")]

private

Definition at line 104 of file Win32Gui.h.

## _title

const char* CxxTest::Win32Gui::_title

private

Definition at line 85 of file Win32Gui.h.

## _windowClass

WNDCLASSEX CxxTest::Win32Gui::_windowClass

private

Definition at line 88 of file Win32Gui.h.

## _worldStart

DWORD CxxTest::Win32Gui::_worldStart

private

Definition at line 103 of file Win32Gui.h.

The documentation for this class was generated from the following file:

- libpolys/tests/cxxtest/Win32Gui.h