Debian Codegraph @

tests/unit/swipearea13/tst_swipearea.qml

raw
1 /*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18 import QtQuick 2.4
19 import Lomiri.Components 1.3
20 import Lomiri.Test 1.0
21
22 Rectangle {
23 width: units.gu(60)
24 height: units.gu(60)
25 color: "white"
26
27 Binding {
28 target: MouseTouchAdaptor
29 property: "enabled"
30 value: true
31 }
32
33 MouseArea {
34 id: mouseArea
35 objectName: "mouseArea"
36 anchors.fill: parent
37 onClicked: {
38 hpLauncher.reset()
39 hnLauncher.reset()
40 vpLauncher.reset()
41 vnLauncher.reset()
42 }
43 }
44
45 Item {
46 id: baseItem
47 objectName: "baseItem"
48 width: parent.width
49 height: parent.height
50
51 // NB: Do not anchor it as we will move it programmatically from the test
52 RightwardsLauncher {
53 id: hpLauncher;
54 width: parent.width
55 height: parent.height
56 }
57
58 LeftwardsLauncher { id: hnLauncher; anchors.fill: parent }
59 DownwardsLauncher { id: vpLauncher; anchors.fill: parent }
60 UpwardsLauncher { id: vnLauncher; anchors.fill: parent }
61 }
62
63 Button {
64 anchors.bottom: parent.bottom
65 anchors.left: parent.left
66 anchors.margins: units.gu(1)
67
68 text: "rotation: " + baseItem.rotation
69 onClicked: {
70 if (baseItem.rotation === 0.0) {
71 baseItem.rotation = 90.0
72 } else {
73 baseItem.rotation = 0.0
74 }
75 }
76 }
77 }