aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc/QmltcTests/requiredProperties.qml
blob: 77e9c88b9bdf609d9825931d6ea9b7942188be57 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QmltcTests 1.0

TypeWithRequiredProperties {
    id: self
    required property int primitiveType
    required property list<int> valueList
    required property list<Item> objectList

    property int propertyThatWillBeMarkedRequired

    // This is already bound so it should not appear as part of the
    // bundle.
    inheritedRequiredPropertyThatWillBeBound : 10

    // This should be ignored as it alias a required property we are
    // already going to consider. It should thus not appear as part of
    // the bundle.
    property alias aliasToRequiredProperty : self.primitiveType

    required propertyThatWillBeMarkedRequired
    required nonRequiredInheritedPropertyThatWillBeMarkedRequired

    property alias aliasToRequiredInner: inner.requiredInner

    // This should be ignored as the underlying property is already bound.
    property alias aliasToRequiredBoundedInner: inner.requiredBoundedInner

    property alias aliasToInnerThatWillBeMarkedRequired: inner.nonRequiredInner
    required aliasToInnerThatWillBeMarkedRequired

    property int notRequired
    property alias requiredAliasToUnrequiredProperty : self.notRequired
    required requiredAliasToUnrequiredProperty

    // When we have an alias to a required property in the same scope
    // we exclude the alias in favor of setting the property directly.
    // See for example aliasToRequiredProperty in this file.
    //
    // The following alias should instead be picked up, as it point to
    // an inner scope.
    // Nonetheless, an initial implementation had a bug that would
    // discard the alias as long as a property with the same name as
    // the target was present in the same scope.
    //
    // The following alias tests this initially failing case.
    property alias aliasToPropertyThatShadows: inner.primitiveType

    property Item children : Item {
        id: inner
        required property int requiredInner
        property int nonRequiredInner
        required property int requiredBoundedInner
        requiredBoundedInner: 43

        required property int primitiveType
    }
}