ValueRangeConstraint Item¶
-
class
ValueRangeConstraint
¶ Checks whether a property is in a certain range.
Properties
Detailed Description¶
ValueRangeConstraint
checks whether value
is within a range
given by minValue
and maxValue
.
The constraint has two stages: validation and evaluation. Validation happens
immediately after the value
property has changed. Whether
value
is within the expected range, can be seen at the property
valid
.
During the evaluation stage, it is decided whether the test case is aborted.
Evaluation can either happen immediately after validation
(evaluateOnValidation
is true
) or just before the
Testcase::finished()
event (evaluateOnFinished
is
true
). The enabled
property switches measurement completely on
and off.
Example for measuring the duration between two signals:
import qst 1.0
import QtQml 2.0 as QtQml
Testcase {
QtQml.Timer {
id: timer
repeat: true
interval: 123
onTriggered: adc.start
}
AdcProbe {
id: adc
ioid: 23
}
ValueRangeConstraint {
id: constraint
minValue: 100
maxValue: 300
value: adc.value
}
function run() {
timer.start
Qst.wait(4000)
}
Properties¶
-
bool
enabled
¶ Default: true
When
false
, thevalue
property does not have any effect and the constraint is neither validated nor evaluated.
-
bool
evaluateOnFinished
¶ Default: false If
true
, the constraint will be evaluated by Qst just beforeTestcase::finished()
.See also
evaluateOnValidation
-
bool
evaluateOnValidation
¶ Default: true If
true
, the test case will fail immediately when validation fails. Iffalse
, then the constraint will not be evaluated immediately. Instead, it will be evaluated onTestcase::finished()
.See also
evaluateOnFinished