From 3a10ff2a85448881863e8d6f729c1abebdc8297a Mon Sep 17 00:00:00 2001 From: graemeg Date: Fri, 11 Jul 2008 21:51:53 +0000 Subject: * Fixed the recusion bug in Treeview when searching for a node. * Minor improvements to the GUI Test Runner. * Extended the treeview unit tests. --- examples/apps/fpcunit/fpg_guitestrunner.pas | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/apps/fpcunit/fpg_guitestrunner.pas b/examples/apps/fpcunit/fpg_guitestrunner.pas index dab2e5fd..15c24869 100644 --- a/examples/apps/fpcunit/fpg_guitestrunner.pas +++ b/examples/apps/fpcunit/fpg_guitestrunner.pas @@ -99,13 +99,15 @@ procedure TGUITestRunnerForm.AddFailure(ATest: TTest; AFailure: TTestFailure); var FailureNode, node: TfpgTreeNode; begin - MemoLog('failed - ' + ATest.TestName); +// MemoLog('failed - ' + ATest.TestName); FailureNode := FindNode(ATest); - FailureNode.ImageIndex := 3; if not Assigned(FailureNode) then - memolog(' Failed to find node'); - if Assigned(FailureNode) then begin + memolog('BUG: Failed to find node for <' + ATest.TestName + '>'); + end + else + begin + FailureNode.ImageIndex := 3; node := FailureNode.AppendText('Message: ' + AFailure.ExceptionMessage); node.ImageIndex := 4; node.TextColor := clFuchsia; @@ -125,11 +127,15 @@ procedure TGUITestRunnerForm.AddError(ATest: TTest; AError: TTestFailure); var ErrorNode, node: TfpgTreeNode; begin - MemoLog('error - ' + ATest.TestName); +// MemoLog('error - ' + ATest.TestName); ErrorNode := FindNode(ATest); - ErrorNode.ImageIndex := 2; - if Assigned(ErrorNode) then + if not Assigned(ErrorNode) then begin + memolog('BUG: Failed to find node for <' + ATest.TestName + '>'); + end + else + begin + ErrorNode.ImageIndex := 2; node := ErrorNode.AppendText('Exception message: ' + AError.ExceptionMessage); node.TextColor := clRed; node.ImageIndex := 4; @@ -263,6 +269,9 @@ begin // Popup Menu support is still experimental // CreatePopupMenu; + + // Focus on first node + tvTests.Selection := n; end; procedure TGUITestRunnerForm.btnQuitClicked(Sender: TObject); -- cgit v1.2.3-70-g09d2