testexecutor-ui 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. testexecutor/VERSION +1 -0
  2. testexecutor/__init__.py +6 -0
  3. testexecutor/control/TestListenerApi.py +56 -0
  4. testexecutor/control/TestSuiteListener.py +249 -0
  5. testexecutor/control/__init__.py +0 -0
  6. testexecutor/model/GenericListModel.py +63 -0
  7. testexecutor/model/InstructionsModel.py +351 -0
  8. testexecutor/model/KeyValueModel.py +177 -0
  9. testexecutor/model/MultiTestWindowModel.py +184 -0
  10. testexecutor/model/ResultModel.py +314 -0
  11. testexecutor/model/TestSuiteControlModel.py +139 -0
  12. testexecutor/model/TestSuiteGroup.py +105 -0
  13. testexecutor/model/TestSuiteModel.py +301 -0
  14. testexecutor/model/__init__.py +0 -0
  15. testexecutor/model/selector/FilterGroupModel.py +90 -0
  16. testexecutor/model/selector/FilterModel.py +251 -0
  17. testexecutor/model/selector/MultiSelectDetails.py +106 -0
  18. testexecutor/model/selector/MultiSelectListModel.py +48 -0
  19. testexecutor/model/selector/__init__.py +0 -0
  20. testexecutor/ui/IdentificationWidget.qml +40 -0
  21. testexecutor/ui/InputWidget.qml +74 -0
  22. testexecutor/ui/InstructionWidget.qml +185 -0
  23. testexecutor/ui/KeyValueItem.qml +194 -0
  24. testexecutor/ui/KeyValueItemConfig.qml +41 -0
  25. testexecutor/ui/KeyValueList.qml +49 -0
  26. testexecutor/ui/MultiTestWidget.qml +48 -0
  27. testexecutor/ui/MultiTestWindow.qml +88 -0
  28. testexecutor/ui/ResultItem.qml +199 -0
  29. testexecutor/ui/ResultItemConfig.qml +46 -0
  30. testexecutor/ui/ResultList.qml +58 -0
  31. testexecutor/ui/TestSuiteConfig.qml +95 -0
  32. testexecutor/ui/TestSuiteController.qml +54 -0
  33. testexecutor/ui/TestSuiteWidget.qml +350 -0
  34. testexecutor/ui/selector/FilterItem.qml +75 -0
  35. testexecutor/ui/selector/FilterItemConfig.qml +24 -0
  36. testexecutor/ui/selector/FilterMultiSelectorItem.qml +169 -0
  37. testexecutor/ui/selector/FilterMultiSelectorItemConfig.qml +22 -0
  38. testexecutor/ui/selector/FilterMultiSelectorList.qml +50 -0
  39. testexecutor/ui/selector/HeaderConfig.qml +24 -0
  40. testexecutor/ui/selector/SectionConfig.qml +24 -0
  41. testexecutor/ui/selector/SectionDelegate.qml +85 -0
  42. testexecutor/ui/selector/SelectorHeader.qml +43 -0
  43. testexecutor/ui/selector/SuiteList.qml +150 -0
  44. testexecutor/ui/selector/SuiteSelector.qml +71 -0
  45. testexecutor/ui/selector/SuiteSelectorConfig.qml +38 -0
  46. testexecutor/ui/selector/TestConfig.qml +22 -0
  47. testexecutor/ui/selector/TestDelegate.qml +75 -0
  48. testexecutor/ui/te-64x64.ico +0 -0
  49. testexecutor_ui-0.6.1.dist-info/LICENSE +204 -0
  50. testexecutor_ui-0.6.1.dist-info/METADATA +27 -0
  51. testexecutor_ui-0.6.1.dist-info/NOTICE +3 -0
  52. testexecutor_ui-0.6.1.dist-info/RECORD +54 -0
  53. testexecutor_ui-0.6.1.dist-info/WHEEL +5 -0
  54. testexecutor_ui-0.6.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,199 @@
1
+ /*
2
+ * Copyright 2020 Direkt, Australia
3
+ * Copyright 2021 Direkt Embedded Pty Ltd
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import QtQuick
19
+ import QtQuick.Layouts
20
+ import QtQuick.Controls
21
+
22
+ Item {
23
+ id: resultItem
24
+ width: parent ? parent.width : 100
25
+ height: 40
26
+ clip: true
27
+ property var config: ResultItemConfig{}
28
+
29
+ Rectangle {
30
+ id: resultRectangle
31
+ color: config.color
32
+ border.width: 3
33
+ border.color: config.border.color
34
+ anchors.fill: parent
35
+
36
+ RowLayout {
37
+ id: resultsRow
38
+ spacing: 1.5
39
+ anchors.fill: parent
40
+
41
+ Rectangle {
42
+ id: nameRectangle
43
+ Layout.preferredWidth: parent.width * config.proportion.name
44
+ color: config.name.color
45
+ Layout.fillHeight: true
46
+
47
+ Text {
48
+ id: resultName
49
+ color: config.name.text.color
50
+ text: Boolean(test) ? test.name : ""
51
+ verticalAlignment: Text.AlignVCenter
52
+ font.pixelSize: parent.height / 1.2
53
+ anchors.rightMargin: 2
54
+ anchors.fill: parent
55
+ clip: false
56
+ horizontalAlignment: Text.AlignRight
57
+ }
58
+ }
59
+
60
+ Rectangle {
61
+ id: feedbackRectangle
62
+ color: config.feedback.color
63
+ border.color: config.feedback.border.color
64
+ Layout.fillHeight: true
65
+ Layout.fillWidth: true
66
+ Rectangle {
67
+ height: parent.height
68
+ width: Boolean(test) ? parent.width * test.progress : 0
69
+ color: Boolean(test) && test.progress === 1 ? "transparent" : config.feedback.progress.color
70
+ opacity: 0.5
71
+ }
72
+ Text {
73
+ id: feedback
74
+ color: Boolean(test) && test.progress < 1 ? config.feedback.text.color.default : config.feedback.text.color.progress
75
+ text: Boolean(test) ? test.feedback : ""
76
+ verticalAlignment: Text.AlignTop
77
+ clip: true
78
+ font.pixelSize: parent.height / 1.2
79
+ anchors.rightMargin: 0
80
+ anchors.leftMargin: 3
81
+ anchors.fill: parent
82
+ }
83
+ }
84
+
85
+ Rectangle {
86
+ id: timeRectangle
87
+ Layout.preferredWidth: parent.width * config.proportion.time
88
+ Layout.maximumWidth: parent.width * 0.3
89
+ color: config.time.color
90
+ Layout.fillHeight: true
91
+ Timer {
92
+ interval: 1000
93
+ running: (state === "Running") && Boolean(test) && (test.progress < 1)
94
+ repeat: true
95
+ onTriggered: {
96
+ test.duration = test.duration + 1
97
+ }
98
+ }
99
+ Text {
100
+ id: timeProgress
101
+ color: config.time.text.color
102
+ text: Boolean(test) ? formatTime(test.duration) : ""
103
+ verticalAlignment: Text.AlignVCenter
104
+ horizontalAlignment: Text.AlignRight
105
+ font.pixelSize: parent.height / 1.2
106
+ anchors.rightMargin: 0
107
+ anchors.fill: parent
108
+ clip: true
109
+ }
110
+ }
111
+ }
112
+ ToolTip {
113
+ visible: test && test.name ? resultMouseArea.containsMouse : false
114
+ timeout: 3000
115
+ delay: 500
116
+ contentItem:
117
+ Row {
118
+ Rectangle {
119
+ Text {
120
+ text: resultName.text
121
+ font.pixelSize: resultRectangle.height
122
+ font.weight: Font.Bold
123
+ color: resultName.color
124
+ rightPadding: 5
125
+ leftPadding: 10
126
+ }
127
+ color: nameRectangle.color
128
+ width: childrenRect.width
129
+ height: childrenRect.height
130
+ }
131
+ Rectangle {
132
+ Text {
133
+ text: feedback.text ? feedback.text:" "
134
+ font.pixelSize: resultRectangle.height
135
+ font.weight: Font.Bold
136
+ color: feedback.color
137
+ rightPadding: 5
138
+ leftPadding: 5
139
+ }
140
+ color: feedbackRectangle.color
141
+ width: childrenRect.width
142
+ height: childrenRect.height
143
+ }
144
+ Rectangle {
145
+ Text {
146
+ text: timeProgress.text
147
+ font.pixelSize: resultRectangle.height
148
+ font.weight: Font.Bold
149
+ color: timeProgress.color
150
+ rightPadding: 10
151
+ leftPadding: 5
152
+ }
153
+ color: timeRectangle.color
154
+ width: childrenRect.width
155
+ height: childrenRect.height
156
+ }
157
+ }
158
+ }
159
+ MouseArea {
160
+ id: resultMouseArea
161
+ anchors.fill: parent
162
+ hoverEnabled: true
163
+ }
164
+ }
165
+ state: test ? test.result : "Running"
166
+ states: [
167
+ State {
168
+ name: "Running"
169
+ PropertyChanges { target: feedbackRectangle; color: "#e5e2e2" }
170
+ },
171
+ State {
172
+ name: "Pass"
173
+ PropertyChanges { target: feedbackRectangle; color: "green" }
174
+ },
175
+ State {
176
+ name: "Fail"
177
+ PropertyChanges { target: feedbackRectangle; color: "red" }
178
+ }
179
+ ]
180
+
181
+ function formatTime(timeInSeconds) {
182
+ var pad = function(num, size) { return ('000' + num).slice(size * -1); },
183
+ time = parseFloat(timeInSeconds).toFixed(3),
184
+ hours = Math.floor(time / 60 / 60),
185
+ minutes = Math.floor(time / 60) % 60,
186
+ seconds = Math.floor(time - minutes * 60),
187
+ milliseconds = time.slice(-3);
188
+
189
+ var s = pad(seconds, 2);
190
+ if (timeInSeconds >= 60*60) {
191
+ s = pad(hours, 2) + ':' + pad(minutes, 2) + ':' + pad(seconds, 2)
192
+ } else if (timeInSeconds >= 60){
193
+ s = pad(minutes, 2) + ':' + pad(seconds, 2)
194
+ }
195
+
196
+ return s;
197
+ }
198
+ }
199
+
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright 2020 Direkt, Australia
3
+ * Copyright 2021 Direkt Embedded Pty Ltd
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import QtQuick
19
+
20
+ Item {
21
+ /*
22
+ * Define the proportions for the widths of the test result items.
23
+ * The feedback area is not defined and will fill any remaining area.
24
+ */
25
+ property var proportion: {
26
+ "name": 0.3,
27
+ // feedback fill remaining space
28
+ "time": 0.2
29
+ }
30
+ property var color: "#605b5b"
31
+ property var border: {"color": "#00000000"}
32
+ property var name: {
33
+ "color": "#00000000",
34
+ "text": {"color": "#e5e2e2"}
35
+ }
36
+ property var feedback: {
37
+ "color": "#8e8a8a",
38
+ "border": {"color": "#b9e5e2e2"},
39
+ "text": {"color": {"default": "black", "progress": "#e5e2e2"}},
40
+ "progress": {"color": "green"}
41
+ }
42
+ property var time: {
43
+ "color": "#00000000",
44
+ "text": {"color": "#e5e2e2"}
45
+ }
46
+ }
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright 2020 Direkt, Australia
3
+ * Copyright 2021 Direkt Embedded Pty Ltd
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import QtQuick
19
+ import QtQuick.Controls
20
+
21
+ Item {
22
+ id: resultList
23
+ width: 600
24
+ clip: true
25
+ property var results
26
+ property int viewableCount: -1
27
+ property var itemConfig
28
+ property var color: "#e5e2e2"
29
+
30
+ Rectangle {
31
+ id: resultListRectangle
32
+ color: color
33
+ anchors.fill: parent
34
+
35
+ ListView {
36
+ id: resultListView
37
+ spacing: 1
38
+ snapMode: ListView.NoSnap
39
+ boundsBehavior: Flickable.StopAtBounds
40
+ currentIndex: results ? results.currentTestIndex : 0
41
+ highlightFollowsCurrentItem: true
42
+ anchors.fill: parent
43
+ delegate: ResultItem {
44
+ height: (viewableCount <= 0) ? (resultListView.height / resultListView.count) : (resultListView.height / viewableCount)
45
+ Component.onCompleted: {
46
+ if (results.currentTestIndex === -1) {
47
+ resultListView.positionViewAtEnd();
48
+ }
49
+ if (resultList.itemConfig) {
50
+ config = resultList.itemConfig
51
+ }
52
+ }
53
+ }
54
+ model: results
55
+ ScrollBar.vertical: ScrollBar {}
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Copyright 2020 Direkt, Australia
3
+ * Copyright 2021 Direkt Embedded Pty Ltd
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import QtQuick
19
+
20
+ /*
21
+ * A qml item which acts as the default configuration for the test suite widget.
22
+ * If the inheriting model wants to override this model they can do so by forcefully setting the config property
23
+ * of the TestSuiteWidget.qml file with equivalent json string. Note the full json needs to be set or some aspects
24
+ * of the UI will fail due to missing configuration.
25
+ */
26
+ Item {
27
+ /*
28
+ * Configuration variables set dependent on the state of the suite.
29
+ * idle.color is set in idle and end states if suite does not have a 'pass' or 'fail' state. If it does then the
30
+ * pass or fail colours will be used.
31
+ * ready.color is set when suite is ready to start
32
+ * running.color is set when suite state is starting or running
33
+ * stopped.color is set when the suite is stopping or stopped state
34
+ */
35
+ property var states: {
36
+ "idle": { "color": {"default": "lightgray", "pass": "green", "fail": "red"}, "button": {"text": "Clear"} },
37
+ "ready": { "color": "gray", "button": {"text": "Clear"}},
38
+ "running": { "color": "gray", "button": {"text": "Stop"}},
39
+ "stopped": { "color": "orange", "button": {"text": "Clear"}},
40
+ }
41
+ /*
42
+ * Define the proportions for the height of the test suite widget.
43
+ * The results area is not defined and will fill any remaining area.
44
+ */
45
+ property var proportion: {
46
+ "title": 0.1,
47
+ "identification": 0.25,
48
+ "input": 0.05,
49
+ "instructions": 0.4,
50
+ // results takes remaining space
51
+ "status": 0.04
52
+ }
53
+
54
+ /*
55
+ * viewableCount: The number of test results to be visible. Effects height of each test result, dependent on
56
+ * proportion values set.
57
+ * color: Background color when no items in list
58
+ * item: Set to false here, in order to use default config from ResultItemConfig.
59
+ * User should define it to an equivalent json to ResultItemConfig it they want to override the default.
60
+ */
61
+ property var results: {
62
+ "viewableCount": 8,
63
+ "color": "#e5e2e2",
64
+ "item": false
65
+ }
66
+
67
+ /*
68
+ * color: Background color when no items in list
69
+ * item: Set to false here, in order to use default config from KeyValueItemConfig.
70
+ * User should define it to an equivalent json to KeyValueItemConfig it they want to override the default.
71
+ */
72
+ property var identification: {
73
+ "color": "#e5e2e2",
74
+ "item": false
75
+ }
76
+
77
+ /*
78
+ * allow_focus: allow for the input to automatically get focus when the instruction becomes active
79
+ */
80
+ property var input: {
81
+ "allow_focus": true
82
+ }
83
+
84
+ /*
85
+ * color: Background color when instruction text is not html
86
+ * proportion:
87
+ * header: Proportion of text box dedicated to header if there is one
88
+ * text: Proportion of text box the main instruction text height will be
89
+ * control: Proportion of instruction box the control buttons are in height
90
+ */
91
+ property var instructions: {
92
+ "color": {"default": "#f4f2f2", "active": "yellow"},
93
+ "proportion": {"header": 0.1, "textHeight": 0.07, "control": 0.02}
94
+ }
95
+ }
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright 2020 Sipke Vriend, Australia
3
+ * Copyright 2021 Direkt Embedded Pty Ltd
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import QtQuick
19
+ import QtQuick.Controls
20
+ import QtQuick.Layouts
21
+ import QtQuick.Window
22
+ import QtQuick.Dialogs
23
+ import "./selector"
24
+
25
+ Item {
26
+ id: testSuiteController
27
+ property alias tswModel: testSuiteWidget.tswModel
28
+ property alias cntrlModel: suiteSelector.cntrlModel
29
+ property alias duration: testSuiteWidget.duration
30
+ property alias config: testSuiteWidget.config
31
+ property alias about: testSuiteWidget.about
32
+ property alias controllerConfig: suiteSelector.config
33
+ property var useController: tswModel && Boolean(tswModel.testsuite.controller)
34
+ width: 600
35
+ height: 600
36
+ RowLayout {
37
+ id: rowLayout
38
+ anchors.fill: parent
39
+
40
+ SuiteSelector {
41
+ id: suiteSelector
42
+ Layout.fillHeight: true
43
+ Layout.fillWidth: true
44
+ visible: useController
45
+ }
46
+ TestSuiteWidget {
47
+ id: testSuiteWidget
48
+ Layout.minimumWidth: 0
49
+ Layout.preferredWidth: useController ? parent.width * 0.5 : parent.width
50
+ Layout.maximumWidth: useController ? 400 : parent.width
51
+ Layout.fillHeight: true
52
+ }
53
+ }
54
+ }