My Project  debian-1:4.1.1-p2+ds-4build3
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
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
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.

◆ anonymous enum

anonymous enum
private
Enumerator
TIMER_ID 
TIMER_DELAY 

Definition at line 295 of file Win32Gui.h.

295 { TIMER_ID = 1, TIMER_DELAY = 1000 };

Member Function Documentation

◆ allocate()

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

Definition at line 519 of file Win32Gui.h.

520  {
521  return (char *)HeapAlloc( GetProcessHeap(), 0, length );
522  }

◆ centerMainWindow()

void CxxTest::Win32Gui::centerMainWindow ( )
inlineprivate

Definition at line 244 of file Win32Gui.h.

245  {
246  RECT screen;
247  getScreenArea( screen );
248 
249  LONG screenWidth = screen.right - screen.left;
250  LONG screenHeight = screen.bottom - screen.top;
251 
252  LONG xCenter = (screen.right + screen.left) / 2;
253  LONG yCenter = (screen.bottom + screen.top) / 2;
254 
255  LONG windowWidth = (screenWidth * 4) / 5;
256  LONG windowHeight = screenHeight / 10;
257  LONG minimumHeight = 2 * (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYFRAME ));
258  if ( windowHeight < minimumHeight )
259  windowHeight = minimumHeight;
260 
261  SetWindowPos( _mainWindow, HWND_TOP,
262  xCenter - (windowWidth / 2), yCenter - (windowHeight / 2),
263  windowWidth, windowHeight, 0 );
264  }

◆ createMainWindow()

void CxxTest::Win32Gui::createMainWindow ( )
inlineprivate

Definition at line 180 of file Win32Gui.h.

181  {
182  _mainWindow = createWindow( _windowClass.lpszClassName, WS_OVERLAPPEDWINDOW );
183  }

◆ createProgressBar()

void CxxTest::Win32Gui::createProgressBar ( )
inlineprivate

Definition at line 199 of file Win32Gui.h.

200  {
201  _progressBar = createWindow( PROGRESS_CLASS, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, _mainWindow );
202 
203 #ifdef PBM_SETRANGE32
204  progressBarMessage( PBM_SETRANGE32, 0, _numTotalTests );
205 #else // No PBM_SETRANGE32, use PBM_SETRANGE
206  progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) );
207 #endif // PBM_SETRANGE32
208  progressBarMessage( PBM_SETPOS, 0 );
209  progressBarMessage( PBM_SETSTEP, 1 );
210  greenBar();
211  UpdateWindow( _progressBar );
212  }

◆ createStatusBar()

void CxxTest::Win32Gui::createStatusBar ( )
inlineprivate

Definition at line 214 of file Win32Gui.h.

215  {
216  _statusBar = createWindow( STATUSCLASSNAME, WS_CHILD | WS_VISIBLE, _mainWindow );
217  setRatios( 4, 1, 3, 1, 3, 1 );
218  }

◆ createWindow()

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

Definition at line 233 of file Win32Gui.h.

234  {
235  return CreateWindow( className, NULL, style, 0, 0, 0, 0, parent,
236  (HMENU)NULL, (HINSTANCE)NULL, (LPVOID)this );
237  }

◆ deallocate()

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

Definition at line 524 of file Win32Gui.h.

525  {
526  HeapFree( GetProcessHeap(), 0, data );
527  }

◆ enterGui()

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

Reimplemented from CxxTest::GuiListener.

Definition at line 30 of file Win32Gui.h.

31  {
32  parseCommandLine( argc, argv );
33  }

◆ enterWorld()

void CxxTest::Win32Gui::enterWorld ( const WorldDescription wd)
inlinevirtual

Reimplemented from CxxTest::GuiListener.

Definition at line 35 of file Win32Gui.h.

36  {
37  getTotalTests( wd );
38  _testsDone = 0;
40  }

◆ getScreenArea()

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

Definition at line 266 of file Win32Gui.h.

267  {
268  if ( !getScreenAreaWithoutTaskbar( area ) )
269  getWholeScreenArea( area );
270  }

◆ getScreenAreaWithoutTaskbar()

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

Definition at line 272 of file Win32Gui.h.

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

◆ getTotalTests() [1/2]

void CxxTest::Win32Gui::getTotalTests ( )
inlineprivate

Definition at line 122 of file Win32Gui.h.

123  {
124  getTotalTests( tracker().world() );
125  }

◆ getTotalTests() [2/2]

void CxxTest::Win32Gui::getTotalTests ( const WorldDescription wd)
inlineprivate

Definition at line 127 of file Win32Gui.h.

128  {
129  _numTotalTests = wd.numTotalTests();
130  wd.strTotalTests( _strTotalTests );
131  }

◆ getWholeScreenArea()

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

Definition at line 277 of file Win32Gui.h.

278  {
279  area.left = area.top = 0;
280  area.right = GetSystemMetrics( SM_CXSCREEN );
281  area.bottom = GetSystemMetrics( SM_CYSCREEN );
282  }

◆ greenBar()

void CxxTest::Win32Gui::greenBar ( )
inlineprivate

Definition at line 385 of file Win32Gui.h.

386  {
387  setColor( 0, 255, 0 );
388  setIcon( IDI_INFORMATION );
389  }

◆ gui()

void CxxTest::Win32Gui::gui ( )
inlineprivate

Definition at line 147 of file Win32Gui.h.

148  {
153  createStatusBar();
155  showMainWindow();
156  startTimer();
157  startTests();
158 
159  messageLoop();
160  }

◆ guiEnterSuite()

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

Reimplemented from CxxTest::GuiListener.

Definition at line 42 of file Win32Gui.h.

43  {
44  showSuiteName( suiteName );
45  reset( _suiteStart );
46  }

◆ guiEnterTest()

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

Reimplemented from CxxTest::GuiListener.

Definition at line 48 of file Win32Gui.h.

49  {
50  ++ _testsDone;
51  setTestCaption( suiteName, testName );
52  showTestName( testName );
53  showTestsDone();
54  progressBarMessage( PBM_STEPIT );
55  reset( _testStart );
56  }

◆ guiThread()

static DWORD WINAPI CxxTest::Win32Gui::guiThread ( LPVOID  parameter)
inlinestaticprivate

Definition at line 141 of file Win32Gui.h.

142  {
143  ((Win32Gui *)parameter)->gui();
144  return 0;
145  }

◆ handle()

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

Definition at line 337 of file Win32Gui.h.

338  {
339  switch ( message )
340  {
341  case WM_SIZE: resizeControls(); break;
342 
343  case WM_TIMER: updateTime(); break;
344 
345  case WM_CLOSE:
346  case WM_DESTROY:
347  case WM_QUIT:
348  ExitProcess( 0 );
349 
350  default: return DefWindowProc( window, message, wParam, lParam );
351  }
352  return 0;
353  }

◆ initCommonControls()

void CxxTest::Win32Gui::initCommonControls ( )
inlineprivate

Definition at line 185 of file Win32Gui.h.

186  {
187  HMODULE dll = LoadLibraryA( "comctl32.dll" );
188  if ( !dll )
189  return;
190 
191  typedef void (WINAPI *FUNC)( void );
192  FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" );
193  if ( !func )
194  return;
195 
196  func();
197  }

◆ keep()

bool CxxTest::Win32Gui::keep ( )
inlineprivate

Definition at line 472 of file Win32Gui.h.

473  {
474  if ( !_keep )
475  return false;
476  if ( !_startMinimized )
477  return true;
478  return (_mainWindow == GetForegroundWindow());
479  }

◆ leaveGui()

void CxxTest::Win32Gui::leaveGui ( )
inlinevirtual

Reimplemented from CxxTest::GuiListener.

Definition at line 74 of file Win32Gui.h.

75  {
76  if ( keep() )
77  {
78  showSummary();
79  WaitForSingleObject( _gui, INFINITE );
80  }
81  DestroyWindow( _mainWindow );
82  }

◆ loadStandardIcon()

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

Definition at line 407 of file Win32Gui.h.

408  {
409  return LoadIcon( (HINSTANCE)NULL, icon );
410  }

◆ messageLoop()

void CxxTest::Win32Gui::messageLoop ( )
inlineprivate

Definition at line 315 of file Win32Gui.h.

316  {
317  MSG message;
318  while ( BOOL haveMessage = GetMessage( &message, NULL, 0, 0 ) )
319  if ( haveMessage != -1 )
320  DispatchMessage( &message );
321  }

◆ parseCommandLine()

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

Definition at line 106 of file Win32Gui.h.

107  {
108  _startMinimized = _keep = false;
109  _title = argv[0];
110 
111  for ( int i = 1; i < argc; ++ i )
112  {
113  if ( !lstrcmpA( argv[i], "-minimized" ) )
114  _startMinimized = true;
115  else if ( !lstrcmpA( argv[i], "-keep" ) )
116  _keep = true;
117  else if ( !lstrcmpA( argv[i], "-title" ) && (i + 1 < argc) )
118  _title = argv[++i];
119  }
120  }

◆ progressBarMessage()

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

Definition at line 239 of file Win32Gui.h.

240  {
241  SendMessage( _progressBar, message, wParam, lParam );
242  }

◆ redBar()

void CxxTest::Win32Gui::redBar ( )
inlinevirtual

Reimplemented from CxxTest::GuiListener.

Definition at line 65 of file Win32Gui.h.

66  {
67  if ( _startMinimized )
68  showMainWindow( SW_SHOWNORMAL );
69  setColor( 255, 0, 0 );
70  setIcon( IDI_ERROR );
71  getTotalTests();
72  }

◆ registerWindowClass()

void CxxTest::Win32Gui::registerWindowClass ( )
inlineprivate

Definition at line 162 of file Win32Gui.h.

163  {
164  _windowClass.cbSize = sizeof(_windowClass);
165  _windowClass.style = CS_HREDRAW | CS_VREDRAW;
166  _windowClass.lpfnWndProc = &(Win32Gui::windowProcedure);
167  _windowClass.cbClsExtra = 0;
168  _windowClass.cbWndExtra = sizeof(LONG);
169  _windowClass.hInstance = (HINSTANCE)NULL;
170  _windowClass.hIcon = (HICON)NULL;
171  _windowClass.hCursor = (HCURSOR)NULL;
172  _windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
173  _windowClass.lpszMenuName = NULL;
174  _windowClass.lpszClassName = TEXT("CxxTest Window Class");
175  _windowClass.hIconSm = (HICON)NULL;
176 
177  RegisterClassEx( &_windowClass );
178  }

◆ reset()

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

Definition at line 305 of file Win32Gui.h.

306  {
307  tick = GetTickCount();
308  }

◆ resizeControls()

void CxxTest::Win32Gui::resizeControls ( )
inlineprivate

Definition at line 355 of file Win32Gui.h.

356  {
357  RECT r;
358  GetClientRect( _mainWindow, &r );
359  LONG width = r.right - r.left;
360  LONG height = r.bottom - r.top;
361 
362  GetClientRect( _statusBar, &r );
363  LONG statusHeight = r.bottom - r.top;
364  LONG resizeGripWidth = statusHeight;
365  LONG progressHeight = height - statusHeight;
366 
367  SetWindowPos( _progressBar, HWND_TOP, 0, 0, width, progressHeight, 0 );
368  SetWindowPos( _statusBar, HWND_TOP, 0, progressHeight, width, statusHeight, 0 );
369  setStatusParts( width - resizeGripWidth );
370  }

◆ setCaption()

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

Definition at line 417 of file Win32Gui.h.

418  {
419  unsigned length = lstrlenA( _title ) + sizeof( " - " ) +
420  lstrlenA( a ) + lstrlenA( b ) + lstrlenA( c ) + lstrlenA( d );
421  char *name = allocate( length );
422  lstrcpyA( name, _title );
423  lstrcatA( name, " - " );
424  lstrcatA( name, a );
425  lstrcatA( name, b );
426  lstrcatA( name, c );
427  lstrcatA( name, d );
428  SetWindowTextA( _mainWindow, name );
429  deallocate( name );
430  }

◆ setColor()

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

Definition at line 397 of file Win32Gui.h.

398  {
399  }

◆ setIcon()

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

Definition at line 402 of file Win32Gui.h.

403  {
404  SendMessage( _mainWindow, WM_SETICON, ICON_BIG, (LPARAM)loadStandardIcon( icon ) );
405  }

◆ setRatios()

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

Definition at line 220 of file Win32Gui.h.

223  {
224  _statusTotal = 0;
225  _statusOffsets[STATUS_SUITE_NAME] = (_statusTotal += suiteNameRatio);
226  _statusOffsets[STATUS_SUITE_TIME] = (_statusTotal += suiteTimeRatio);
227  _statusOffsets[STATUS_TEST_NAME] = (_statusTotal += testNameRatio);
228  _statusOffsets[STATUS_TEST_TIME] = (_statusTotal += testTimeRatio);
229  _statusOffsets[STATUS_TESTS_DONE] = (_statusTotal += testsDoneRatio);
230  _statusOffsets[STATUS_WORLD_TIME] = (_statusTotal += worldTimeRatio);
231  }

◆ setStatusPart()

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

Definition at line 488 of file Win32Gui.h.

489  {
490  statusBarMessage( SB_SETTEXTA, part, text );
491  }

◆ setStatusParts()

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

Definition at line 372 of file Win32Gui.h.

373  {
374  for ( unsigned i = 0; i < STATUS_TOTAL_PARTS; ++ i )
375  _statusWidths[i] = (width * _statusOffsets[i]) / _statusTotal;
376 
378  }

◆ setStatusTime()

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

Definition at line 457 of file Win32Gui.h.

458  {
459  unsigned total = (GetTickCount() - start) / 1000;
460  unsigned hours = total / 3600;
461  unsigned minutes = (total / 60) % 60;
462  unsigned seconds = total % 60;
463 
464  if ( hours )
465  wsprintfA( _timeString, "%u:%02u:%02u", hours, minutes, seconds );
466  else
467  wsprintfA( _timeString, "%02u:%02u", minutes, seconds );
468 
469  setStatusPart( part, _timeString );
470  }

◆ setSummaryCaption()

void CxxTest::Win32Gui::setSummaryCaption ( )
inlineprivate

Definition at line 514 of file Win32Gui.h.

515  {
517  }

◆ setSummaryStatusBar()

void CxxTest::Win32Gui::setSummaryStatusBar ( )
inlineprivate

Definition at line 499 of file Win32Gui.h.

500  {
501  setRatios( 0, 0, 0, 0, 1, 1 );
502  resizeControls();
503 
504  const char *tests = (_numTotalTests == 1) ? "test" : "tests";
505  if ( tracker().failedTests() )
506  wsprintfA( _statusTestsDone, "Failed %u of %s %s",
507  tracker().failedTests(), _strTotalTests, tests );
508  else
509  wsprintfA( _statusTestsDone, "%s %s passed", _strTotalTests, tests );
510 
512  }

◆ setTestCaption()

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

Definition at line 412 of file Win32Gui.h.

413  {
414  setCaption( suiteName, "::", testName, "()" );
415  }

◆ setUp()

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

Definition at line 332 of file Win32Gui.h.

333  {
334  SetWindowLong( window, GWL_USERDATA, (LONG)create->lpCreateParams );
335  }

◆ showMainWindow() [1/2]

void CxxTest::Win32Gui::showMainWindow ( )
inlineprivate

Definition at line 284 of file Win32Gui.h.

285  {
286  showMainWindow( _startMinimized ? SW_MINIMIZE : SW_SHOWNORMAL );
287  UpdateWindow( _mainWindow );
288  }

◆ showMainWindow() [2/2]

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

Definition at line 290 of file Win32Gui.h.

291  {
292  ShowWindow( _mainWindow, mode );
293  }

◆ showSuiteName()

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

Definition at line 432 of file Win32Gui.h.

433  {
434  setStatusPart( STATUS_SUITE_NAME, suiteName );
435  }

◆ showSummary()

void CxxTest::Win32Gui::showSummary ( )
inlineprivate

Definition at line 481 of file Win32Gui.h.

482  {
483  stopTimer();
486  }

◆ showTestName()

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

Definition at line 437 of file Win32Gui.h.

438  {
439  setStatusPart( STATUS_TEST_NAME, testName );
440  }

◆ showTestsDone()

void CxxTest::Win32Gui::showTestsDone ( )
inlineprivate

Definition at line 442 of file Win32Gui.h.

443  {
444  wsprintfA( _statusTestsDone, "%u of %s (%u%%)",
446  (_testsDone * 100) / _numTotalTests );
448  }

◆ startGuiThread()

void CxxTest::Win32Gui::startGuiThread ( )
inlineprivate

Definition at line 133 of file Win32Gui.h.

134  {
135  _canStartTests = CreateEvent( NULL, TRUE, FALSE, NULL );
136  DWORD threadId;
137  _gui = CreateThread( NULL, 0, &(Win32Gui::guiThread), (LPVOID)this, 0, &threadId );
138  WaitForSingleObject( _canStartTests, INFINITE );
139  }

◆ startTests()

void CxxTest::Win32Gui::startTests ( )
inlineprivate

Definition at line 310 of file Win32Gui.h.

311  {
312  SetEvent( _canStartTests );
313  }

◆ startTimer()

void CxxTest::Win32Gui::startTimer ( )
inlineprivate

Definition at line 297 of file Win32Gui.h.

298  {
299  reset( _worldStart );
300  reset( _suiteStart );
301  reset( _testStart );
302  SetTimer( _mainWindow, TIMER_ID, TIMER_DELAY, 0 );
303  }

◆ statusBarMessage()

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

Definition at line 380 of file Win32Gui.h.

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

◆ stopTimer()

void CxxTest::Win32Gui::stopTimer ( )
inlineprivate

Definition at line 493 of file Win32Gui.h.

494  {
495  KillTimer( _mainWindow, TIMER_ID );
497  }

◆ updateTime()

void CxxTest::Win32Gui::updateTime ( )
inlineprivate

◆ windowProcedure()

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

Definition at line 323 of file Win32Gui.h.

324  {
325  if ( message == WM_CREATE )
326  setUp( window, (LPCREATESTRUCT)lParam );
327 
328  Win32Gui *that = (Win32Gui *)GetWindowLong( window, GWL_USERDATA );
329  return that->handle( window, message, wParam, lParam );
330  }

◆ yellowBar()

void CxxTest::Win32Gui::yellowBar ( )
inlinevirtual

Reimplemented from CxxTest::GuiListener.

Definition at line 58 of file Win32Gui.h.

59  {
60  setColor( 255, 255, 0 );
61  setIcon( IDI_WARNING );
62  getTotalTests();
63  }

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:
CxxTest::Win32Gui::_keep
bool _keep
Definition: Win32Gui.h:86
FALSE
#define FALSE
Definition: auxiliary.h:94
LONG
#define LONG
Definition: longrat.cc:111
CxxTest::Win32Gui::createMainWindow
void createMainWindow()
Definition: Win32Gui.h:180
CxxTest::Win32Gui::setSummaryStatusBar
void setSummaryStatusBar()
Definition: Win32Gui.h:499
CxxTest::Win32Gui::createStatusBar
void createStatusBar()
Definition: Win32Gui.h:214
CxxTest::Win32Gui::STATUS_WORLD_TIME
@ STATUS_WORLD_TIME
Definition: Win32Gui.h:96
CxxTest::Win32Gui::updateTime
void updateTime()
Definition: Win32Gui.h:450
CxxTest::Win32Gui::STATUS_SUITE_TIME
@ STATUS_SUITE_TIME
Definition: Win32Gui.h:94
CxxTest::Win32Gui::loadStandardIcon
HICON loadStandardIcon(LPCTSTR icon)
Definition: Win32Gui.h:407
CxxTest::Win32Gui::_strTotalTests
char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]
Definition: Win32Gui.h:92
CxxTest::Win32Gui::getScreenArea
void getScreenArea(RECT &area)
Definition: Win32Gui.h:266
CxxTest::Win32Gui::_canStartTests
HANDLE _canStartTests
Definition: Win32Gui.h:90
CxxTest::Win32Gui::_statusOffsets
unsigned _statusOffsets[STATUS_TOTAL_PARTS]
Definition: Win32Gui.h:100
CxxTest::Win32Gui::_progressBar
HWND _progressBar
Definition: Win32Gui.h:89
CxxTest::Win32Gui::setStatusParts
void setStatusParts(LONG width)
Definition: Win32Gui.h:372
CxxTest::Win32Gui::setIcon
void setIcon(LPCTSTR icon)
Definition: Win32Gui.h:402
CxxTest::Win32Gui::statusBarMessage
void statusBarMessage(UINT message, WPARAM wParam=0, const void *lParam=0)
Definition: Win32Gui.h:380
CxxTest::Win32Gui::showTestName
void showTestName(const char *testName)
Definition: Win32Gui.h:437
create
NodeM * create()
Definition: janet.cc:758
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
CxxTest::Win32Gui::STATUS_TESTS_DONE
@ STATUS_TESTS_DONE
Definition: Win32Gui.h:96
CxxTest::Win32Gui::_testsDone
unsigned _testsDone
Definition: Win32Gui.h:91
CxxTest::TestTracker::failedTests
unsigned failedTests() const
Definition: TestTracker.h:37
CxxTest::Win32Gui::_windowClass
WNDCLASSEX _windowClass
Definition: Win32Gui.h:88
CxxTest::Win32Gui::initCommonControls
void initCommonControls()
Definition: Win32Gui.h:185
b
CanonicalForm b
Definition: cfModGcd.cc:4044
CxxTest::Win32Gui::resizeControls
void resizeControls()
Definition: Win32Gui.h:355
CxxTest::Win32Gui::registerWindowClass
void registerWindowClass()
Definition: Win32Gui.h:162
CxxTest::Win32Gui::_numTotalTests
unsigned _numTotalTests
Definition: Win32Gui.h:91
CxxTest::Win32Gui::_testStart
DWORD _testStart
Definition: Win32Gui.h:103
CxxTest::Win32Gui::STATUS_SUITE_NAME
@ STATUS_SUITE_NAME
Definition: Win32Gui.h:94
CxxTest::Win32Gui::_mainWindow
HWND _mainWindow
Definition: Win32Gui.h:89
CxxTest::Win32Gui::STATUS_TEST_NAME
@ STATUS_TEST_NAME
Definition: Win32Gui.h:95
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
CxxTest::Win32Gui::setColor
void setColor(BYTE, BYTE, BYTE)
Definition: Win32Gui.h:397
CxxTest::Win32Gui::reset
void reset(DWORD &tick)
Definition: Win32Gui.h:305
CxxTest::Win32Gui::guiThread
static DWORD WINAPI guiThread(LPVOID parameter)
Definition: Win32Gui.h:141
CxxTest::Win32Gui::_suiteStart
DWORD _suiteStart
Definition: Win32Gui.h:103
message
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7729
CxxTest::Win32Gui::showMainWindow
void showMainWindow()
Definition: Win32Gui.h:284
CxxTest::Win32Gui::setRatios
void setRatios(unsigned suiteNameRatio, unsigned suiteTimeRatio, unsigned testNameRatio, unsigned testTimeRatio, unsigned testsDoneRatio, unsigned worldTimeRatio)
Definition: Win32Gui.h:220
CxxTest::Win32Gui::getScreenAreaWithoutTaskbar
bool getScreenAreaWithoutTaskbar(RECT &area)
Definition: Win32Gui.h:272
CxxTest::Win32Gui::windowProcedure
static LRESULT CALLBACK windowProcedure(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
Definition: Win32Gui.h:323
CxxTest::Win32Gui::_statusBar
HWND _statusBar
Definition: Win32Gui.h:89
CxxTest::Win32Gui::createProgressBar
void createProgressBar()
Definition: Win32Gui.h:199
CxxTest::Win32Gui::TIMER_ID
@ TIMER_ID
Definition: Win32Gui.h:295
CxxTest::Win32Gui::greenBar
void greenBar()
Definition: Win32Gui.h:385
CxxTest::Win32Gui::setStatusTime
void setStatusTime(unsigned part, DWORD start)
Definition: Win32Gui.h:457
CxxTest::Win32Gui::allocate
char * allocate(unsigned length)
Definition: Win32Gui.h:519
CxxTest::Win32Gui::_timeString
char _timeString[sizeof("00:00:00")]
Definition: Win32Gui.h:104
CxxTest::Win32Gui::parseCommandLine
void parseCommandLine(int argc, char **argv)
Definition: Win32Gui.h:106
CxxTest::Win32Gui::getTotalTests
void getTotalTests()
Definition: Win32Gui.h:122
CxxTest::Win32Gui::_gui
HANDLE _gui
Definition: Win32Gui.h:87
CxxTest::Win32Gui::progressBarMessage
void progressBarMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: Win32Gui.h:239
CxxTest::Win32Gui::centerMainWindow
void centerMainWindow()
Definition: Win32Gui.h:244
CxxTest::Win32Gui::_startMinimized
bool _startMinimized
Definition: Win32Gui.h:86
CxxTest::Win32Gui::STATUS_TEST_TIME
@ STATUS_TEST_TIME
Definition: Win32Gui.h:95
CxxTest::Win32Gui::keep
bool keep()
Definition: Win32Gui.h:472
CxxTest::Win32Gui::showSuiteName
void showSuiteName(const char *suiteName)
Definition: Win32Gui.h:432
CxxTest::Win32Gui::startTests
void startTests()
Definition: Win32Gui.h:310
CxxTest::Win32Gui::_worldStart
DWORD _worldStart
Definition: Win32Gui.h:103
CxxTest::Win32Gui::messageLoop
void messageLoop()
Definition: Win32Gui.h:315
CxxTest::Win32Gui::_statusWidths
int _statusWidths[STATUS_TOTAL_PARTS]
Definition: Win32Gui.h:99
CxxTest::Win32Gui::setStatusPart
void setStatusPart(unsigned part, const char *text)
Definition: Win32Gui.h:488
name
char name(const Variable &v)
Definition: factory.h:180
CxxTest::Win32Gui::setTestCaption
void setTestCaption(const char *suiteName, const char *testName)
Definition: Win32Gui.h:412
CxxTest::Win32Gui::_title
const char * _title
Definition: Win32Gui.h:85
CxxTest::Win32Gui::STATUS_TOTAL_PARTS
@ STATUS_TOTAL_PARTS
Definition: Win32Gui.h:97
CxxTest::Win32Gui::deallocate
void deallocate(char *data)
Definition: Win32Gui.h:524
CxxTest::Win32Gui::getWholeScreenArea
void getWholeScreenArea(RECT &area)
Definition: Win32Gui.h:277
NULL
#define NULL
Definition: omList.c:10
CxxTest::Win32Gui::createWindow
HWND createWindow(LPCTSTR className, DWORD style, HWND parent=(HWND) NULL)
Definition: Win32Gui.h:233
CxxTest::Win32Gui::stopTimer
void stopTimer()
Definition: Win32Gui.h:493
CxxTest::Win32Gui::startTimer
void startTimer()
Definition: Win32Gui.h:297
CxxTest::Win32Gui::setSummaryCaption
void setSummaryCaption()
Definition: Win32Gui.h:514
CxxTest::Win32Gui::_statusTestsDone
char _statusTestsDone[sizeof("1000000000 of (100%)")+WorldDescription::MAX_STRLEN_TOTAL_TESTS]
Definition: Win32Gui.h:102
CxxTest::Win32Gui::showTestsDone
void showTestsDone()
Definition: Win32Gui.h:442
CxxTest::Win32Gui::_statusTotal
unsigned _statusTotal
Definition: Win32Gui.h:101
CxxTest::Win32Gui::setCaption
void setCaption(const char *a="", const char *b="", const char *c="", const char *d="")
Definition: Win32Gui.h:417
CxxTest::Win32Gui::TIMER_DELAY
@ TIMER_DELAY
Definition: Win32Gui.h:295
CxxTest::Win32Gui::showSummary
void showSummary()
Definition: Win32Gui.h:481
CxxTest::Win32Gui::startGuiThread
void startGuiThread()
Definition: Win32Gui.h:133
CxxTest::tracker
TestTracker & tracker()
Definition: TestTracker.h:111
CxxTest::Win32Gui::setUp
static void setUp(HWND window, LPCREATESTRUCT create)
Definition: Win32Gui.h:332