Anonymous - 2001-01-12

I'm busy at work so feel free to ignore anything I write that is rubbish!

I'm merely listing the changes I made to make CppUnit work on our MSVC6 environment.

On the Dialog Resource I removed the Stop and Close buttons (putting the OnOK code in OnCancel where it should have been in the first place). The Run button then has to change to a Stop button while the test is running (Code listed later). The run button should be up close to the Windows Close box (corner to corner to minimise the chance of clicking the wrong button). (Also initially there were two Default buttons).
I also turned the Combo Box into a List Box which is the full height of the dialog under the Run button. Most Suites have short names. Now when the test dialog opens, my mouse jumps to the Run button which is close to the test suite selection list and the close button.
I also made the ListCtrl autosize its columns to save time.
I believe there is a way to make it so that if you clicked or double-clicked a line of the ListCtrl you could be taken to the Vistual Studio editor on the Asserting file and error line... I just can't remember where I saw how to do it!

Use GetTickCount() instead of timeGetTime() and you don't need to include and link with the WinMM library to do the same thing slower...

Start with the Stop button disabled (and only one default button (run)) or:
The Run and Stop Buttons should be one button, say IDC_RunStop.
Have a function OnRunStop linked to it's OnClick Event that uses GetDlgItemText to see if it says "&Run"... If it does: call OnRun, else OnStop. Then have the following funtion alterations.

void TestRunnerDlg::OnRunStop() {
  CString S;
  GetDlgItemText(IDC_RunStop, S);
  if(S=="&Run") OnRun();
  else          OnStop();
}

void TestRunnerDlg::BeRunning() {
  CButton* RunStop=(CButton*)GetDlgItem(IDC_RunStop);
  RunStop->EnableWindow(TRUE);
  RunStop->SetWindowText("&Stop");
}

void TestRunnerDlg::BeIdle() {
  CButton* RunStop=(CButton*)GetDlgItem(IDC_RunStop);
  RunStop->EnableWindow(TRUE);
  RunStop->SetWindowText("&Run");
}

void TestRunnerDlg::BeRunDisabled() {((CButton*)GetDlgItem(IDC_RunStop))->EnableWindow(FALSE);}

After the UpdateCountsDisplay() in TestRunnerDlg::EndTest put:
  CListCtrl* listCtrl=(CListCtrl*)GetDlgItem(IDC_LIST);
  if(listCtrl->GetItemCount()) {
    for(int i=0; i<5; i++) listCtrl->SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
  }

The version I downloaded (last week) won't work with MFC statically linked - and I don't know where to start with the error messages you get if you change TestRunner or HostApp to link statically: [Project Menu][Settings][General Tab][Microsoft Foundation Classes]
and set it to [Use MFC in a Static Library]
Any help appreciated! (BossShot@hotmail.com)