2016-06-19 17:13:06 +02:00
|
|
|
import QtQuick 2.3
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: testCase
|
|
|
|
objectName: "testCase"
|
|
|
|
|
2016-06-19 17:53:31 +02:00
|
|
|
function testObjectName() {
|
|
|
|
return testObject && testObject.objectName === "testObject"
|
|
|
|
}
|
|
|
|
|
|
|
|
function testPropertyReadAndWrite() {
|
|
|
|
if (!testObject)
|
|
|
|
return false
|
|
|
|
if (testObject.name !== "foo")
|
|
|
|
return false
|
|
|
|
testObject.name = "bar"
|
|
|
|
if (testObject.name !== "bar")
|
|
|
|
return false
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
function testSignalEmittion() {
|
|
|
|
if (!testObject)
|
|
|
|
return false
|
|
|
|
if (testObject.name !== "foo")
|
|
|
|
return false
|
|
|
|
var result = false
|
|
|
|
testObject.nameChanged.connect(function(name){ result = name === "bar" })
|
|
|
|
testObject.name = "bar"
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
2016-06-19 17:13:06 +02:00
|
|
|
function testRowCount() {
|
2016-06-19 17:30:43 +02:00
|
|
|
return testObject && testObject.rowCount() === 4
|
2016-06-19 17:13:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function testColumnCount() {
|
2016-06-19 17:30:43 +02:00
|
|
|
return testObject && testObject.columnCount() === 1;
|
2016-06-19 17:13:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function testData() {
|
2016-06-19 17:30:43 +02:00
|
|
|
return testObject && testObject.data(testObject.index(0,0, null)) === "John"
|
|
|
|
&& testObject.data(testObject.index(1,0, null)) === "Mary"
|
|
|
|
&& testObject.data(testObject.index(2,0, null)) === "Andy"
|
|
|
|
&& testObject.data(testObject.index(3,0, null)) === "Anna"
|
2016-06-19 17:13:06 +02:00
|
|
|
}
|
|
|
|
}
|