QQuickItemView/QQuickPathView: Fix creation of delegates
[qt:qtdeclarative.git] / tests / auto / qmltest / pathview / tst_pathview.qml
1 import QtQuick 2.1
2 import QtTest 1.0
3
4 Item {
5     id: top
6
7     PathView {
8         id: pathViewDelegateModelAfterCreate
9         anchors.fill: parent
10         property int createdDelegates: 0
11         path: Path { startX: 120; startY: 100 }
12     }
13
14     Component {
15         id: delegateModelAfterCreateComponent
16         Rectangle {
17             width: 140
18             height: 140
19             border.color: "black"
20             color: "red"
21             Component.onCompleted: pathViewDelegateModelAfterCreate.createdDelegates++;
22         }
23     }
24
25     TestCase {
26         name: "PathView"
27         when: windowShown
28
29         function test_set_delegate_model_after_path_creation() {
30             pathViewDelegateModelAfterCreate.delegate = delegateModelAfterCreateComponent;
31             pathViewDelegateModelAfterCreate.model = 40;
32             verify(pathViewDelegateModelAfterCreate.createdDelegates > 0);
33         }
34     }
35 }