Win32Gui.h revision 6b15695578f07a3f72c4c9475c1a261a3021472a
#ifndef __cxxtest__Win32Gui_h__
#define __cxxtest__Win32Gui_h__
//
// The Win32Gui displays a simple progress bar using the Win32 API.
//
// It accepts the following command line options:
// -minimized Start minimized, pop up on error
// -keep Don't close the window at the end
// -title TITLE Set the window caption
//
// If both -minimized and -keep are specified, GUI will only keep the
// window if it's in focus.
//
// N.B. If you're wondering why this class doesn't use any standard
// library or STL (<string> would have been nice) it's because it only
// uses "straight" Win32 API.
//
#include <windows.h>
#include <commctrl.h>
{
{
{
}
{
getTotalTests( wd );
_testsDone = 0;
}
void guiEnterSuite( const char *suiteName )
{
reset( _suiteStart );
}
{
++ _testsDone;
showTestName( testName );
reset( _testStart );
}
void yellowBar()
{
setIcon( IDI_WARNING );
}
void redBar()
{
if ( _startMinimized )
setColor( 255, 0, 0 );
}
void leaveGui()
{
if ( keep() )
{
showSummary();
}
}
const char *_title;
bool _startMinimized, _keep;
unsigned _numTotalTests, _testsDone;
enum {
};
unsigned _statusOffsets[STATUS_TOTAL_PARTS];
unsigned _statusTotal;
char _timeString[sizeof("00:00:00")];
{
_startMinimized = _keep = false;
for ( int i = 1; i < argc; ++ i )
{
_startMinimized = true;
_keep = true;
}
}
void getTotalTests()
{
}
{
}
void startGuiThread()
{
}
{
return 0;
}
void gui()
{
startTimer();
startTests();
messageLoop();
}
void registerWindowClass()
{
_windowClass.cbClsExtra = 0;
}
void createMainWindow()
{
}
void initCommonControls()
{
if ( !dll )
return;
if ( !func )
return;
func();
}
void createProgressBar()
{
#ifdef PBM_SETRANGE32
#else // No PBM_SETRANGE32, use PBM_SETRANGE
#endif // PBM_SETRANGE32
progressBarMessage( PBM_SETPOS, 0 );
greenBar();
}
void createStatusBar()
{
}
unsigned testNameRatio, unsigned testTimeRatio,
unsigned testsDoneRatio, unsigned worldTimeRatio )
{
_statusTotal = 0;
}
{
}
{
}
void centerMainWindow()
{
getScreenArea( screen );
if ( windowHeight < minimumHeight )
windowWidth, windowHeight, 0 );
}
{
if ( !getScreenAreaWithoutTaskbar( area ) )
}
{
}
{
}
void showMainWindow()
{
}
void showMainWindow( int mode )
{
}
void startTimer()
{
reset( _worldStart );
reset( _suiteStart );
reset( _testStart );
}
{
tick = GetTickCount();
}
void startTests()
{
}
void messageLoop()
{
if ( haveMessage != -1 )
DispatchMessage( &message );
}
{
}
{
}
{
switch ( message )
{
case WM_SIZE: resizeControls(); break;
case WM_TIMER: updateTime(); break;
case WM_CLOSE:
case WM_DESTROY:
case WM_QUIT:
ExitProcess( 0 );
}
return 0;
}
void resizeControls()
{
RECT r;
GetClientRect( _mainWindow, &r );
GetClientRect( _statusBar, &r );
}
{
for ( unsigned i = 0; i < STATUS_TOTAL_PARTS; ++ i )
}
{
}
void greenBar()
{
setColor( 0, 255, 0 );
}
#ifdef PBM_SETBARCOLOR
{
}
#else // !PBM_SETBARCOLOR
{
}
#endif // PBM_SETBARCOLOR
{
}
{
}
{
}
{
deallocate( name );
}
void showSuiteName( const char *suiteName )
{
}
void showTestName( const char *testName )
{
}
void showTestsDone()
{
}
void updateTime()
{
}
{
if ( hours )
else
}
bool keep()
{
if ( !_keep )
return false;
if ( !_startMinimized )
return true;
return (_mainWindow == GetForegroundWindow());
}
void showSummary()
{
stopTimer();
}
{
}
void stopTimer()
{
}
void setSummaryStatusBar()
{
if ( tracker().failedTests() )
else
}
void setSummaryCaption()
{
}
{
}
void deallocate( char *data )
{
}
};
};
#endif // __cxxtest__Win32Gui_h__