tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml
changeset 30 5dc02b23752f
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
       
     1 import Qt 4.7
       
     2 
       
     3 /*
       
     4     This test verifies that a single animation animating two properties is visually the same as two
       
     5     animations in a parallel group animating the same properties. Visually, you should see a red
       
     6     rectangle at 0,0 stretching from the top of the window to the bottom. This rect will be moved to
       
     7     the right side of the window while turning purple. If the bottom half is visually different
       
     8     than the top half, there is a problem.
       
     9 */
       
    10 
       
    11 Rectangle {
       
    12     width: 400; height: 200
       
    13     Rectangle {
       
    14         id: redRect
       
    15         width: 100; height: 100
       
    16         color: "red"
       
    17     }
       
    18     Rectangle {
       
    19         id: redRect2
       
    20         width: 100; height: 100
       
    21         y: 100
       
    22         color: "red"
       
    23     }
       
    24 
       
    25     MouseArea {
       
    26         anchors.fill: parent
       
    27         onClicked: parent.state = "state1"
       
    28     }
       
    29 
       
    30     states: State {
       
    31         name: "state1"
       
    32         PropertyChanges {
       
    33             target: redRect
       
    34             x: 300
       
    35             color: "purple"
       
    36         }
       
    37         PropertyChanges {
       
    38             target: redRect2
       
    39             x: 300
       
    40             color: "purple"
       
    41         }
       
    42     }
       
    43 
       
    44     transitions: Transition {
       
    45         PropertyAnimation { targets: redRect; properties: "x,color"; duration: 300 }
       
    46         ParallelAnimation {
       
    47             NumberAnimation { targets: redRect2; properties: "x"; duration: 300 }
       
    48             ColorAnimation { targets: redRect2; properties: "color"; duration: 300 }
       
    49         }
       
    50     }
       
    51 }