2021-10-01 08:37:08 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtTest 1.14
|
|
|
|
|
|
|
|
import QtQuick.Window 2.14
|
|
|
|
|
|
|
|
TestCase {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
readonly property Window window: baseWindow
|
2021-10-18 11:38:15 +00:00
|
|
|
readonly property Item windowContent: contentWindow
|
2021-10-01 08:37:08 +00:00
|
|
|
|
|
|
|
Window {
|
|
|
|
id: baseWindow
|
|
|
|
width: 800
|
|
|
|
height: 600
|
2021-10-18 11:38:15 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: contentWindow
|
|
|
|
anchors.fill: parent
|
|
|
|
}
|
2021-10-18 12:22:40 +00:00
|
|
|
|
|
|
|
visible: true
|
2021-10-01 08:37:08 +00:00
|
|
|
}
|
2021-10-20 11:00:05 +00:00
|
|
|
|
2021-10-21 15:51:31 +00:00
|
|
|
property Helpers __helpers: Helpers {}
|
|
|
|
|
|
|
|
function getObjectByObjectName(parent, objectName) {
|
|
|
|
var result = __helpers.getObjectByObjectName(parent, objectName)
|
|
|
|
verify(result, "Method getObjectByObjectName can't find object with name:" + objectName + " in parent:" + parent.toString())
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
function clickOnButton(item) {
|
|
|
|
verify(item, "item is null")
|
|
|
|
verify((item.width !== 0 && item.height !== 0) ||
|
|
|
|
(item.implicitWidth !== 0 && item.implicitHeight !== 0) , "item has zero sizes")
|
|
|
|
verify(item.visible, "item is invisibble")
|
|
|
|
|
|
|
|
if (item.width !== 0 && item.height !== 0) {
|
|
|
|
mouseClick(item, item.width / 2, item.height / 2, Qt.LeftButton)
|
|
|
|
} else {
|
|
|
|
mouseClick(item, item.implicitWidth / 2, item.implicitHeight / 2, Qt.LeftButton)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-20 11:00:05 +00:00
|
|
|
function initTestCase() {
|
|
|
|
window.show()
|
|
|
|
}
|
|
|
|
|
|
|
|
function cleanupTestCase() {
|
|
|
|
window.close()
|
|
|
|
}
|
2021-10-01 08:37:08 +00:00
|
|
|
}
|