| 1 |
/**************************************************************************** |
| 2 |
** |
| 3 |
** Copyright (C) 2016 Jolla Ltd, author: <[email protected]> |
| 4 |
** Contact: https://www.qt.io/licensing/ |
| 5 |
** |
| 6 |
** This file is part of the test suite of the Qt Toolkit. |
| 7 |
** |
| 8 |
** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 |
** Commercial License Usage |
| 10 |
** Licensees holding valid commercial Qt licenses may use this file in |
| 11 |
** accordance with the commercial license agreement provided with the |
| 12 |
** Software or, alternatively, in accordance with the terms contained in |
| 13 |
** a written agreement between you and The Qt Company. For licensing terms |
| 14 |
** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 |
** information use the contact form at https://www.qt.io/contact-us. |
| 16 |
** |
| 17 |
** GNU General Public License Usage |
| 18 |
** Alternatively, this file may be used under the terms of the GNU |
| 19 |
** General Public License version 3 as published by the Free Software |
| 20 |
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 |
** included in the packaging of this file. Please review the following |
| 22 |
** information to ensure the GNU General Public License requirements will |
| 23 |
** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 |
** |
| 25 |
** $QT_END_LICENSE$ |
| 26 |
** |
| 27 |
****************************************************************************/ |
| 28 |
|
| 29 |
import QtQuick 2.2 |
| 30 |
import QtTest 1.1 |
| 31 |
|
| 32 |
Item { |
| 33 |
id: root; |
| 34 |
width: 200 |
| 35 |
height: 200 |
| 36 |
|
| 37 |
TestCase { |
| 38 |
id: testCase |
| 39 |
name: "animators-mixed" |
| 40 |
when: !rootAnimation.running |
| 41 |
function test_endresult() { |
| 42 |
compare(box.rootStart, 2); |
| 43 |
compare(box.rootEnd, 2); |
| 44 |
|
| 45 |
compare(parallelWithOneSequential.before, 4); |
| 46 |
compare(parallelWithOneSequential.scaleUpdates, 4); |
| 47 |
|
| 48 |
compare(parallelWithTwoSequentialNormalEndsLast.beforeAnimator, 4); |
| 49 |
compare(parallelWithTwoSequentialNormalEndsLast.scaleUpdates, 4); |
| 50 |
compare(parallelWithTwoSequentialNormalEndsLast.afterAnimator, 4); |
| 51 |
compare(parallelWithTwoSequentialNormalEndsLast.beforePause, 4); |
| 52 |
compare(parallelWithTwoSequentialNormalEndsLast.afterPause, 4); |
| 53 |
|
| 54 |
compare(parallelWithTwoSequentialNormalEndsFirst.beforeAnimator, 4); |
| 55 |
compare(parallelWithTwoSequentialNormalEndsFirst.scaleUpdates, 4); |
| 56 |
compare(parallelWithTwoSequentialNormalEndsFirst.afterAnimator, 4); |
| 57 |
compare(parallelWithTwoSequentialNormalEndsFirst.beforePause, 4); |
| 58 |
compare(parallelWithTwoSequentialNormalEndsFirst.afterPause, 4); |
| 59 |
|
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
Box { |
| 64 |
id: box |
| 65 |
|
| 66 |
property int rootStart : 0 |
| 67 |
property int rootEnd : 0; |
| 68 |
|
| 69 |
SequentialAnimation { |
| 70 |
id: rootAnimation |
| 71 |
|
| 72 |
running: true |
| 73 |
loops: 2 |
| 74 |
|
| 75 |
ScriptAction { script: box.rootStart++; } |
| 76 |
|
| 77 |
ParallelAnimation { |
| 78 |
id: parallelWithOneSequential |
| 79 |
property int before : 0; |
| 80 |
property int scaleUpdates : 0; |
| 81 |
loops: 2 |
| 82 |
SequentialAnimation { |
| 83 |
ScriptAction { script: { |
| 84 |
parallelWithOneSequential.before++; |
| 85 |
box.scale = 1; |
| 86 |
box.scaleChangeCounter = 0; |
| 87 |
} |
| 88 |
} |
| 89 |
ScaleAnimator { target: box; from: 1; to: 2; duration: 100; } |
| 90 |
ScriptAction { script: { |
| 91 |
parallelWithOneSequential.scaleUpdates += box.scaleChangeCounter; |
| 92 |
} |
| 93 |
} |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
ParallelAnimation { |
| 98 |
id: parallelWithTwoSequentialNormalEndsLast |
| 99 |
property int beforeAnimator : 0; |
| 100 |
property int scaleUpdates : 0; |
| 101 |
property int afterAnimator : 0; |
| 102 |
property int beforePause : 0; |
| 103 |
property int afterPause : 0; |
| 104 |
loops: 2 |
| 105 |
SequentialAnimation { |
| 106 |
ScriptAction { script: { |
| 107 |
parallelWithTwoSequentialNormalEndsLast.beforeAnimator++; |
| 108 |
box.scale = 1; |
| 109 |
box.scaleChangeCounter = 0; |
| 110 |
} |
| 111 |
} |
| 112 |
ScaleAnimator { target: box; from: 1; to: 2; duration: 100; } |
| 113 |
ScriptAction { script: { |
| 114 |
parallelWithTwoSequentialNormalEndsLast.scaleUpdates += box.scaleChangeCounter; |
| 115 |
parallelWithTwoSequentialNormalEndsLast.afterAnimator++; |
| 116 |
} |
| 117 |
} |
| 118 |
} |
| 119 |
SequentialAnimation { |
| 120 |
ScriptAction { script: { |
| 121 |
parallelWithTwoSequentialNormalEndsLast.beforePause++ |
| 122 |
} |
| 123 |
} |
| 124 |
PauseAnimation { duration: 200 } |
| 125 |
ScriptAction { script: { |
| 126 |
parallelWithTwoSequentialNormalEndsLast.afterPause++ |
| 127 |
} |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
|
| 132 |
ParallelAnimation { |
| 133 |
id: parallelWithTwoSequentialNormalEndsFirst |
| 134 |
property int beforeAnimator : 0; |
| 135 |
property int scaleUpdates : 0; |
| 136 |
property int afterAnimator : 0; |
| 137 |
property int beforePause : 0; |
| 138 |
property int afterPause : 0; |
| 139 |
loops: 2 |
| 140 |
SequentialAnimation { |
| 141 |
ScriptAction { script: { |
| 142 |
parallelWithTwoSequentialNormalEndsFirst.beforeAnimator++; |
| 143 |
box.scale = 1; |
| 144 |
box.scaleChangeCounter = 0; |
| 145 |
} |
| 146 |
} |
| 147 |
ScaleAnimator { target: box; from: 1; to: 2; duration: 200; } |
| 148 |
ScriptAction { script: { |
| 149 |
parallelWithTwoSequentialNormalEndsFirst.scaleUpdates += box.scaleChangeCounter; |
| 150 |
parallelWithTwoSequentialNormalEndsFirst.afterAnimator++; |
| 151 |
} |
| 152 |
} |
| 153 |
} |
| 154 |
SequentialAnimation { |
| 155 |
ScriptAction { script: parallelWithTwoSequentialNormalEndsFirst.beforePause++ } |
| 156 |
PauseAnimation { duration: 100 } |
| 157 |
ScriptAction { script: parallelWithTwoSequentialNormalEndsFirst.afterPause++ } |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
ScriptAction { script: box.rootEnd++; } |
| 162 |
} |
| 163 |
|
| 164 |
} |
| 165 |
|
| 166 |
} |