eric6/PyUnit/UnittestDialog.py

changeset 8029
5feb4f723f07
parent 7960
e8fc383322f7
child 8043
0acf98cd089a
child 8143
2c730d5fd177
equal deleted inserted replaced
8024:e0eb1d5922a5 8029:5feb4f723f07
45 45
46 TestCaseNameRole = Qt.UserRole 46 TestCaseNameRole = Qt.UserRole
47 TestCaseFileRole = Qt.UserRole + 1 47 TestCaseFileRole = Qt.UserRole + 1
48 48
49 ErrorsInfoRole = Qt.UserRole 49 ErrorsInfoRole = Qt.UserRole
50
51 SkippedColorDarkTheme = QColor("#00aaff")
52 FailedExpectedColorDarkTheme = QColor("#ccaaff")
53 SucceededUnexpectedColorDarkTheme = QColor("#ff99dd")
54 SkippedColorLightTheme = QColor("#0000ff")
55 FailedExpectedColorLightTheme = QColor("#7700bb")
56 SucceededUnexpectedColorLightTheme = QColor("#ff0000")
50 57
51 def __init__(self, prog=None, dbs=None, ui=None, parent=None, name=None): 58 def __init__(self, prog=None, dbs=None, ui=None, parent=None, name=None):
52 """ 59 """
53 Constructor 60 Constructor
54 61
1048 @param testId id of the test (string) 1055 @param testId id of the test (string)
1049 """ 1056 """
1050 self.skippedCount += 1 1057 self.skippedCount += 1
1051 self.progressCounterSkippedCount.setText(str(self.skippedCount)) 1058 self.progressCounterSkippedCount.setText(str(self.skippedCount))
1052 itm = QListWidgetItem(self.tr(" Skipped: {0}").format(reason)) 1059 itm = QListWidgetItem(self.tr(" Skipped: {0}").format(reason))
1053 itm.setForeground(Qt.blue) 1060 if e5App().usesDarkPalette():
1061 itm.setForeground(self.SkippedColorDarkTheme)
1062 else:
1063 itm.setForeground(self.SkippedColorLightTheme)
1054 self.testsListWidget.insertItem(1, itm) 1064 self.testsListWidget.insertItem(1, itm)
1055 1065
1056 def testFailedExpected(self, test, exc, testId): 1066 def testFailedExpected(self, test, exc, testId):
1057 """ 1067 """
1058 Public method called if a test fails expectedly. 1068 Public method called if a test fails as expected.
1059 1069
1060 @param test name of the test (string) 1070 @param test name of the test (string)
1061 @param exc string representation of the exception (string) 1071 @param exc string representation of the exception (string)
1062 @param testId id of the test (string) 1072 @param testId id of the test (string)
1063 """ 1073 """
1064 self.expectedFailureCount += 1 1074 self.expectedFailureCount += 1
1065 self.progressCounterExpectedFailureCount.setText( 1075 self.progressCounterExpectedFailureCount.setText(
1066 str(self.expectedFailureCount)) 1076 str(self.expectedFailureCount))
1067 itm = QListWidgetItem(self.tr(" Expected Failure")) 1077 itm = QListWidgetItem(self.tr(" Expected Failure"))
1068 itm.setForeground(Qt.blue) 1078 if e5App().usesDarkPalette():
1079 itm.setForeground(self.FailedExpectedColorDarkTheme)
1080 else:
1081 itm.setForeground(self.FailedExpectedColorLightTheme)
1069 self.testsListWidget.insertItem(1, itm) 1082 self.testsListWidget.insertItem(1, itm)
1070 1083
1071 def testSucceededUnexpected(self, test, testId): 1084 def testSucceededUnexpected(self, test, testId):
1072 """ 1085 """
1073 Public method called if a test succeeds unexpectedly. 1086 Public method called if a test succeeds unexpectedly.
1077 """ 1090 """
1078 self.unexpectedSuccessCount += 1 1091 self.unexpectedSuccessCount += 1
1079 self.progressCounterUnexpectedSuccessCount.setText( 1092 self.progressCounterUnexpectedSuccessCount.setText(
1080 str(self.unexpectedSuccessCount)) 1093 str(self.unexpectedSuccessCount))
1081 itm = QListWidgetItem(self.tr(" Unexpected Success")) 1094 itm = QListWidgetItem(self.tr(" Unexpected Success"))
1082 itm.setForeground(Qt.red) 1095 if e5App().usesDarkPalette():
1096 itm.setForeground(self.SucceededUnexpectedColorDarkTheme)
1097 else:
1098 itm.setForeground(self.SucceededUnexpectedColorLightTheme)
1083 self.testsListWidget.insertItem(1, itm) 1099 self.testsListWidget.insertItem(1, itm)
1084 1100
1085 def testStarted(self, test, doc): 1101 def testStarted(self, test, doc):
1086 """ 1102 """
1087 Public method called if a test is about to be run. 1103 Public method called if a test is about to be run.

eric ide

mercurial