StackView: add tests to check that Qt.binding works with push()
This is documented to work, but only works with QML properties, so expect failures until it's fixed to work with JS variables. Task-number: QTBUG-112605 Task-number: QTBUG-114959 Pick-to: 6.5 6.6 Change-Id: Idc55d5954172cdfe53a69f0598807638533480f9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
f21f1d47e9
commit
6bf49d1262
|
@ -367,6 +367,8 @@ TestCase {
|
|||
verify(control.get(2, StackView.ForceLoad))
|
||||
}
|
||||
|
||||
property bool qmlProperty
|
||||
|
||||
function test_push() {
|
||||
var control = createTemporaryObject(stackViewComponent, testCase)
|
||||
verify(control)
|
||||
|
@ -420,6 +422,27 @@ TestCase {
|
|||
compare(item6.objectName, "6")
|
||||
compare(control.depth, 6)
|
||||
compare(control.currentItem, item6)
|
||||
|
||||
// push([component, {binding}]) - with JS variable in binding
|
||||
var jsVariable = false
|
||||
var item7 = control.push([itemComponent, {objectName: Qt.binding(() => {
|
||||
return jsVariable.toString() })}], StackView.Immediate)
|
||||
compare(item7.objectName, "false")
|
||||
compare(control.depth, 7)
|
||||
compare(control.currentItem, item7)
|
||||
jsVariable = true
|
||||
expectFailContinue("", "QTBUG-114959")
|
||||
compare(item7.objectName, "true")
|
||||
|
||||
// push([component, {binding}]) - with QML property in binding
|
||||
qmlProperty = false
|
||||
var item8 = control.push([itemComponent, {objectName: Qt.binding(() => {
|
||||
return testCase.qmlProperty.toString() })}], StackView.Immediate)
|
||||
compare(item8.objectName, "false")
|
||||
compare(control.depth, 8)
|
||||
compare(control.currentItem, item8)
|
||||
qmlProperty = true
|
||||
compare(item8.objectName, "true")
|
||||
}
|
||||
|
||||
// Escape special Regexp characters with a '\' (backslash) prefix so that \a str can be
|
||||
|
|
Loading…
Reference in New Issue