Tools__TestRunner2.st
branchjv
changeset 19612 9f2e3136aa4d
parent 17137 2c2f7c9fc909
child 19638 f0275261f2ca
--- a/Tools__TestRunner2.st	Tue Sep 21 13:45:08 2021 +0100
+++ b/Tools__TestRunner2.st	Mon Sep 20 11:32:18 2021 +0100
@@ -1,6 +1,7 @@
 "
  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
  Copyright (c) 2009-2010 eXept Software AG
+ Copyright (c) 2021 LabWare
 
  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation
@@ -46,9 +47,9 @@
 	privateIn:TestRunner2
 !
 
-ApplicationModel subclass:#ResultList
+AbstractTestRunner subclass:#ResultList
 	instanceVariableNames:'results resultsHolder selectiomHolder listHolder timestampFormat
-		selectionHolder'
+		selectionHolder passedText failedText errorText'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:TestRunner2
@@ -56,7 +57,7 @@
 
 HierarchicalItem subclass:#ListEntry
 	instanceVariableNames:'label realLabel test result'
-	classVariableNames:'PassedText FailedText ErrorText'
+	classVariableNames:''
 	poolDictionaries:''
 	privateIn:TestRunner2::ResultList
 !
@@ -67,6 +68,7 @@
 "
  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
  Copyright (c) 2009-2010 eXept Software AG
+ Copyright (c) 2021 LabWare
 
  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation
@@ -1052,13 +1054,6 @@
 
 !TestRunner2 methodsFor:'accessing'!
 
-errorColor
-    ^ self class 
-        errorColor
-
-    "Modified: / 08-02-2010 / 13:57:26 / Jan Vrany <jan,vrany@fit.cvut.cz>"
-!
-
 errorTestSuite
 
     | testSuite |
@@ -1071,10 +1066,6 @@
     "Created: / 06-06-2008 / 09:08:40 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
-failedColor
-    ^ self class failedColor
-!
-
 failureTestSuite
     | testSuite |
 
@@ -1088,10 +1079,6 @@
     "Modified (format): / 23-09-2011 / 18:56:52 / cg"
 !
 
-passedColor
-    ^ self class passedColor
-!
-
 selectedPackages: packages
 
     self packageList selectedProjects value: packages.
@@ -1802,12 +1789,13 @@
 !
 
 displayFail:result 
-    self displayColor:self errorColor.
+    self displayColor:self errorBackgroundColor.
     self displayMode:'Fail'.
     self displayDetails:result printString.
 
     "Created: / 06-06-2008 / 08:49:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 07-02-2010 / 14:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-09-2021 / 22:23:42 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 displayMode: mode
@@ -1819,10 +1807,12 @@
 !
 
 displayPass:result 
-    self displayColor:self passedColor.
+    self displayColor:self passedBackgroundColor.
     self displayMode:'Pass '.
     self 
         displayDetails:result printString , ' ' , (self timeSinceLastPassAsString)
+
+    "Modified: / 17-09-2021 / 22:23:51 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 displayResult: aTestResult
@@ -1861,13 +1851,14 @@
 
 displayRunning: result test: test total: total
 
-    self displayColor: (result hasPassed ifTrue:[self class currentlyRunningColor] ifFalse:[Color orange]).
+    self displayColor: self runningBackgroundColor.
     self displayMode: 'Running ' , test printString.
     self displayDetails: total printString , ' total, ' , result printString
 
     "Modified: / 21-06-2000 / 12:14:52 / Sames"
     "Created: / 06-06-2008 / 19:38:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 05-07-2011 / 14:14:42 / cg"
+    "Modified: / 17-09-2021 / 22:24:33 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !TestRunner2 methodsFor:'hooks'!
@@ -2024,6 +2015,20 @@
 
 ! !
 
+!TestRunner2::ResultList methodsFor:'accessing'!
+
+errorText
+    ^ errorText
+!
+
+failedText
+    ^ failedText
+!
+
+passedText
+    ^ passedText
+! !
+
 !TestRunner2::ResultList methodsFor:'actions'!
 
 debugTest:entryIndex 
@@ -2129,12 +2134,14 @@
 
     | list |
     list := HierarchicalList new.
+    list application: self.
     list root: self makeRootEntry.            
     list showRoot: false.    
     self listHolder value: list.
 
     "Created: / 07-02-2010 / 11:03:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 07-02-2010 / 13:41:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-09-2021 / 22:50:17 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 updateTimestampFormat
@@ -2151,6 +2158,20 @@
     "Modified: / 04-08-2011 / 19:05:57 / cg"
 ! !
 
+!TestRunner2::ResultList methodsFor:'initialization'!
+
+initialize
+    "Invoked when a new instance is created."
+
+    super initialize.
+
+    passedText := (' [', (self resources string:'passed') , ']') withColor: self passedBackgroundColor. 
+    failedText := (' [', (self resources string:'failed') allBold , ']') withColor: self failedBackgroundColor. 
+    errorText :=  (' [', (self resources string:'error') allBold , ']') withColor: self errorBackgroundColor. 
+
+    "/ super initialize.   -- commented since inherited method does nothing
+! !
+
 !TestRunner2::ResultList methodsFor:'private'!
 
 invalidate
@@ -2245,35 +2266,6 @@
     "Created: / 19-03-2010 / 08:41:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!TestRunner2::ResultList::ListEntry class methodsFor:'initialization'!
-
-errorText
-    ErrorText isNil ifTrue:[
-        ErrorText := ' [','error' allBold,']' withColor: Tools::TestRunner2 errorColor "darker".    
-    ].
-    ^ ErrorText
-
-    "Created: / 06-06-2016 / 14:41:59 / cg"
-!
-
-failedText
-    FailedText isNil ifTrue:[
-        FailedText := ' [','failed' allBold,']' withColor: Tools::TestRunner2 failedColor "darker".
-    ].
-    ^ FailedText
-
-    "Created: / 06-06-2016 / 14:41:40 / cg"
-!
-
-passedText
-    PassedText isNil ifTrue:[
-        PassedText := ' [passed]' withColor: Tools::TestRunner2 passedColor darker.
-    ].
-    ^ PassedText
-
-    "Created: / 06-06-2016 / 14:41:16 / cg"
-! !
-
 !TestRunner2::ResultList::ListEntry class methodsFor:'instance creation'!
 
 labeled: aStringOrText
@@ -2295,15 +2287,14 @@
 !
 
 label
-    | result |
-
-    result := self result.
+
+    self result. "/ to ensure result is computed
     realLabel ifNil:[
         realLabel := label.
         test ifNotNil:[
-            result == #passed ifTrue:[realLabel := realLabel , self class passedText].
-            result == #error ifTrue:[realLabel := realLabel , self class errorText].
-            result == #failed ifTrue:[realLabel := realLabel , self class failedText].
+            result == #passed ifTrue:[realLabel := realLabel , self application passedText].
+            result == #error ifTrue:[realLabel := realLabel , self application errorText].
+            result == #failed ifTrue:[realLabel := realLabel , self application failedText].
         ] ifNil: [
             realLabel := realLabel , self summary.
         ]        
@@ -2314,6 +2305,7 @@
     "Modified: / 07-02-2010 / 18:28:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 08-02-2010 / 10:15:35 / Jan Vrany <jan,vrany@fit.cvut.cz>"
     "Modified (format): / 06-06-2016 / 14:43:01 / cg"
+    "Modified: / 17-09-2021 / 22:59:45 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 label:aText
@@ -2461,6 +2453,11 @@
     ^ '$Header$'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$Id$'
 ! !