9
/* obj is the object on which the tests are carried out, name is used
10
to identify the object in human-readable way */
14
/* these are the default fail strings used during verification
15
they can be overriden here or via optional arguments to the
17
property string constantMsg: strings.constantMsg
18
property string changedMsg: strings.changedMsg
19
property string writableMsg: strings.writableMsg
20
property string assignmentMsg: strings.assignmentMsg
21
property string roleMsg: strings.roleMsg
26
readonly property string constantMsg: "%1.%2 should be a property of type %3"
27
readonly property string changedMsg: "%1 should have an %2Changed signal"
28
readonly property string writableMsg: "%1.%2 should be writable"
29
readonly property string assignmentMsg: "assignment to %1.%2 did not work"
30
readonly property string roleMsg: "%1 should expose a \"%2\" role of type %3"
33
/* verify that there's a $prop of $type */
34
function constant(prop, type, msg) {
35
verifyType(obj[prop], type, (msg || constantMsg).arg(name).arg(prop).arg(type));
38
/* verify that there's a $prop of $type and a corresponding $typeChanged signal */
39
function property(prop, type, msg) {
41
verifyType(obj[prop+"Changed"], "function", (msg || changedMsg).arg(name).arg(prop));
44
/* verify that there's a writable $prop of $type */
45
function writable(prop, type, value, msg1, msg2) {
51
if (writable) fail((msg1 || writableMsg).arg(name).arg(prop));
53
compare(obj[prop], value, (msg2 || assignmentMsg).arg(name).arg(prop));
57
/* verify that there's a $role of $type exposed */
58
function role(role, type, msg) {
59
constant(role, type, msg || roleMsg);
62
/* clear the properties */
67
verifier.constantMsg = strings.constantMsg;
68
verifier.changedMsg = strings.changedMsg;
69
verifier.writableMsg = strings.writableMsg;
70
verifier.assignmentMsg = strings.assignmentMsg;
71
verifier.roleMsg = strings.roleMsg;
8
/* obj is the object on which the tests are carried out, name is used
9
to identify the object in human-readable way */
13
/* these are the default fail strings used during verification
14
they can be overriden here or via optional arguments to the
16
property string constantMsg: strings.constantMsg
17
property string changedMsg: strings.changedMsg
18
property string writableMsg: strings.writableMsg
19
property string assignmentMsg: strings.assignmentMsg
20
property string roleMsg: strings.roleMsg
25
readonly property string constantMsg: "%1.%2 should be a property of type %3"
26
readonly property string changedMsg: "%1 should have an %2Changed signal"
27
readonly property string writableMsg: "%1.%2 should be writable"
28
readonly property string assignmentMsg: "assignment to %1.%2 did not work"
29
readonly property string roleMsg: "%1 should expose a \"%2\" role of type %3"
75
32
/* verify that $value is of $type, otherwise fail with $msg */
83
40
verify(Util.isInstanceOf(value, type), msg);
44
/* verify that there's a $prop of $type */
45
function constant(prop, type, msg) {
46
verifyType(object[prop], type, (msg || constantMsg).arg(name).arg(prop).arg(type));
49
/* verify that there's a $prop of $type and a corresponding $typeChanged signal */
50
function property(prop, type, msg) {
52
verifyType(object[prop+"Changed"], "function", (msg || changedMsg).arg(name).arg(prop));
55
/* verify that there's a writable $prop of $type */
56
function writable(prop, type, value, msg1, msg2) {
62
if (writable) fail((msg1 || writableMsg).arg(name).arg(prop));
64
compare(object[prop], value, (msg2 || assignmentMsg).arg(name).arg(prop));
68
/* verify that there's a $role of $type exposed */
69
function role(role, type, msg) {
70
constant(role, type, msg || roleMsg);
73
/* clear the properties */
78
root.constantMsg = strings.constantMsg;
79
root.changedMsg = strings.changedMsg;
80
root.writableMsg = strings.writableMsg;
81
root.assignmentMsg = strings.assignmentMsg;
82
root.roleMsg = strings.roleMsg;