summaryrefslogtreecommitdiff
path: root/examples/apps
diff options
context:
space:
mode:
Diffstat (limited to 'examples/apps')
-rw-r--r--examples/apps/fpcunit/fpg_guitestrunner.pas57
-rw-r--r--examples/apps/fpcunit/images/error.bmpbin0 -> 822 bytes
-rw-r--r--examples/apps/fpcunit/images/treeimages.inc52
3 files changed, 91 insertions, 18 deletions
diff --git a/examples/apps/fpcunit/fpg_guitestrunner.pas b/examples/apps/fpcunit/fpg_guitestrunner.pas
index 9380a114..cafc92be 100644
--- a/examples/apps/fpcunit/fpg_guitestrunner.pas
+++ b/examples/apps/fpcunit/fpg_guitestrunner.pas
@@ -110,11 +110,14 @@ begin
FailureNode.ImageIndex := 3;
node := FailureNode.AppendText('Message: ' + AFailure.ExceptionMessage);
node.ImageIndex := 4;
- node.TextColor := clFuchsia;
+// node.TextColor := clFuchsia;
node := FailureNode.AppendText('Exception: ' + AFailure.ExceptionClassName);
node.ImageIndex := 4;
- node.TextColor := clFuchsia;
-// PaintNodeFailure(FailureNode);
+// node.TextColor := clFuchsia;
+
+ node := node.Parent;
+ if Assigned(node) and (node.ImageIndex in [0, 1]) then
+ node.ImageIndex := 3;
end;
Inc(failureCounter);
if errorCounter = 0 then
@@ -137,26 +140,29 @@ begin
begin
ErrorNode.ImageIndex := 2;
node := ErrorNode.AppendText('Exception message: ' + AError.ExceptionMessage);
- node.TextColor := clRed;
+// node.TextColor := clRed;
node.ImageIndex := 4;
node := ErrorNode.AppendText('Exception class: ' + AError.ExceptionClassName);
- node.TextColor := clRed;
+// node.TextColor := clRed;
node.ImageIndex := 4;
if (AError.SourceUnitName <> '') and
(AError.FailedMethodName <> '')
then
begin
node := ErrorNode.AppendText('Unit name: ' + AError.SourceUnitName);
- node.TextColor := clRed;
+// node.TextColor := clRed;
node.ImageIndex := 5;
node := ErrorNode.AppendText('Method name: ' + AError.FailedMethodName);
- node.TextColor := clRed;
+// node.TextColor := clRed;
node.ImageIndex := 5;
node := ErrorNode.AppendText('Line number: ' + IntToStr(AError.LineNumber));
- node.TextColor := clRed;
+// node.TextColor := clRed;
node.ImageIndex := 5;
end;
-// PaintNodeError(ErrorNode);
+
+ node := node.Parent;
+ if Assigned(node) and (node.ImageIndex in [0, 1, 3]) then
+ node.ImageIndex := 2;
end;
Inc(errorCounter);
barColor := clRed;
@@ -167,14 +173,13 @@ end;
procedure TGUITestRunnerForm.StartTest(ATest: TTest);
var
- Node: TfpgTreeNode;
+ n: TfpgTreeNode;
begin
-// writeln(ATest.TestName, '...');
- Node := FindNode(ATest);
- if Assigned(Node) then
+ n := FindNode(ATest);
+ if Assigned(n) then
begin
- Node.Clear;
- Node.ImageIndex := 1; // green
+ n.Clear;
+ n.ImageIndex := 1; // green
tvTests.Invalidate;
fpgApplication.ProcessMessages;
end
@@ -184,12 +189,22 @@ end;
procedure TGUITestRunnerForm.EndTest(ATest: TTest);
begin
-
+ inc(pbName1.Position, 1);
+ pbName1.Invalidate;
+ fpgApplication.ProcessMessages;
end;
procedure TGUITestRunnerForm.StartTestSuite(ATestSuite: TTestSuite);
+var
+ n: TfpgTreeNode;
begin
-
+ n := FindNode(ATestSuite);
+ if Assigned(n) then
+ begin
+ n.ImageIndex := 1; // green
+ end
+ else
+ writeln(' Failed to find TestSuite');
end;
procedure TGUITestRunnerForm.EndTestSuite(ATestSuite: TTestSuite);
@@ -302,6 +317,10 @@ begin
begin
testSuite := TTest(tvTests.Selection.Data);
// tvTests.Selection.Collapse;
+
+ pbName1.Position := 0;
+ pbName1.Max := testSuite.CountTestCases;
+
RunTest(testSuite);
end;
end;
@@ -358,7 +377,9 @@ begin
img := CreateImage_BMP(@fpcunit_circle_fuchsia, sizeof(fpcunit_circle_fuchsia) );
FImagelist.AddImage(img, 3);
- img := CreateImage_BMP(@fpcunit_bug, sizeof(fpcunit_bug) );
+ //img := CreateImage_BMP(@fpcunit_bug, sizeof(fpcunit_bug) );
+ //FImagelist.AddImage(img, 4);
+ img := CreateImage_BMP(@fpcunit_error, sizeof(fpcunit_error) );
FImagelist.AddImage(img, 4);
img := CreateImage_BMP(@fpcunit_information, sizeof(fpcunit_information) );
diff --git a/examples/apps/fpcunit/images/error.bmp b/examples/apps/fpcunit/images/error.bmp
new file mode 100644
index 00000000..505df947
--- /dev/null
+++ b/examples/apps/fpcunit/images/error.bmp
Binary files differ
diff --git a/examples/apps/fpcunit/images/treeimages.inc b/examples/apps/fpcunit/images/treeimages.inc
index 86553af7..93131e40 100644
--- a/examples/apps/fpcunit/images/treeimages.inc
+++ b/examples/apps/fpcunit/images/treeimages.inc
@@ -363,3 +363,55 @@ Const
202,148,153,194,186,234,191,249,254,253,255,255,255,255,255,255,255,
255,255,255,255,255,255);
+Const
+ fpcunit_error : Array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 123,201,237, 45,167,224, 43,164,223, 41,161,221, 39,158,220, 37,155,
+ 218, 35,152,217, 32,147,214, 27,140,211, 22,133,207, 17,126,204, 13,
+ 119,201, 9,113,198, 6,108,195, 3,104,193, 93,157,214, 72,182,230,
+ 190,227,245,244,252,254,239,251,254,238,251,254,238,251,254,239,252,
+ 254,239,252,254,239,251,254,238,251,254,237,251,254,237,251,254,236,
+ 251,254,242,252,254,171,206,235, 42,127,202,195,232,247, 98,191,232,
+ 244,252,254,181,239,250, 88,218,245, 88,218,245, 87,216,243, 88,215,
+ 242, 88,214,242, 87,217,244, 81,216,245, 78,215,244, 98,218,246,234,
+ 251,254, 68,147,210,182,212,237,255,255,255, 94,192,234,157,215,241,
+ 231,249,253,139,229,248, 90,219,246, 91,218,244, 61,161,213, 61,161,
+ 213, 84,214,242, 82,216,245, 80,214,244,216,246,252,136,191,229, 85,
+ 160,217,255,255,255,255,255,255,227,244,251, 55,178,229,243,251,254,
+ 195,242,251, 92,220,246, 92,218,244,100,223,246, 87,203,235, 85,214,
+ 242, 84,217,245,148,231,248,227,244,251, 28,138,209,222,237,248,255,
+ 255,255,255,255,255,255,255,255,121,204,238,140,210,240,234,251,254,
+ 148,230,248, 92,218,244, 71,177,221, 61,161,213, 86,215,242, 92,219,
+ 245,222,248,253,125,192,231,135,195,232,255,255,255,255,255,255,255,
+ 255,255,255,255,255,246,252,254, 69,186,232,200,234,247,230,250,253,
+ 93,218,244, 61,161,213, 61,161,213, 87,215,242,199,243,252,192,227,
+ 244, 59,164,221,245,250,253,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,185,229,247,113,200,237,249,254,255, 94,220,244,
+ 62,162,213, 62,162,213, 92,217,244,237,251,254,104,187,229,178,220,
+ 242,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255, 90,195,236,169,223,244,237,249,253, 62,163,214,
+ 62,163,214,212,245,252,162,215,241, 93,185,230,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,218,242,251, 58,184,232,249,253,255,148,233,249,158,235,250,
+ 236,250,254, 49,170,225,215,238,249,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,116,206,239,148,216,242,243,252,254,231,250,254,143,211,240,
+ 134,206,239,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,241,
+ 250,254, 68,190,234,241,250,253,213,239,250, 67,183,232,241,249,253,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,141,
+ 216,243,133,212,241,130,209,240,173,225,245,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,253,254,255, 93,
+ 199,238,104,202,239,253,254,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255);
+