aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest/qtbug46798/tst_qtbug46798.qml
blob: a99bdf7af791e2229015b4d8e92b6205c0fbbcf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.2
import QtQml.Models 2.3
import QtTest 1.1

Item {
    id: top

    ListView {
        id: listViewWithObjectModel // QTBUG-46798
        anchors.fill: parent
        model: ObjectModel {
            id: objectModel
            Rectangle { width: 160; height: 160; color: "red" }
            Rectangle { width: 160; height: 160; color: "green" }
            Rectangle { width: 160; height: 160; color: "blue" }
        }
    }

    TestCase {
        name: "QTBUG-46798"
        when: windowShown

        function test_bug46798() {
            var item = objectModel.get(0)
            if (item) {
                objectModel.remove(0)
                item.destroy()
            }
        }
    }
}