aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qsgmousearea/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qsgmousearea/data')
-rw-r--r--tests/auto/declarative/qsgmousearea/data/clickThrough.qml23
-rw-r--r--tests/auto/declarative/qsgmousearea/data/clickThrough2.qml32
-rw-r--r--tests/auto/declarative/qsgmousearea/data/clickandhold.qml13
-rw-r--r--tests/auto/declarative/qsgmousearea/data/clicktwice.qml16
-rw-r--r--tests/auto/declarative/qsgmousearea/data/doubleclick.qml16
-rw-r--r--tests/auto/declarative/qsgmousearea/data/dragging.qml28
-rw-r--r--tests/auto/declarative/qsgmousearea/data/dragproperties.qml28
-rw-r--r--tests/auto/declarative/qsgmousearea/data/dragreset.qml28
-rw-r--r--tests/auto/declarative/qsgmousearea/data/hoverPosition.qml17
-rw-r--r--tests/auto/declarative/qsgmousearea/data/pressedOrdering.qml28
-rw-r--r--tests/auto/declarative/qsgmousearea/data/preventstealing.qml24
-rw-r--r--tests/auto/declarative/qsgmousearea/data/rejectEvent.qml28
-rw-r--r--tests/auto/declarative/qsgmousearea/data/updateMousePosOnClick.qml20
-rw-r--r--tests/auto/declarative/qsgmousearea/data/updateMousePosOnResize.qml38
14 files changed, 339 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsgmousearea/data/clickThrough.qml b/tests/auto/declarative/qsgmousearea/data/clickThrough.qml
new file mode 100644
index 0000000000..0d954f8511
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/clickThrough.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item{
+ width: 200
+ height: 200
+ property int doubleClicks: 0
+ property int clicks: 0
+ property int pressAndHolds: 0
+ property int presses: 0
+ MouseArea{
+ z: 0
+ anchors.fill: parent
+ onPressed: presses++
+ onClicked: clicks++
+ onPressAndHold: pressAndHolds++
+ onDoubleClicked: doubleClicks++
+ }
+ MouseArea{
+ z: 1
+ enabled: true
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/clickThrough2.qml b/tests/auto/declarative/qsgmousearea/data/clickThrough2.qml
new file mode 100644
index 0000000000..bc73a1bf8a
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/clickThrough2.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item{
+ width: 300
+ height: 300
+ property int doubleClicks: 0
+ property int clicks: 0
+ property int pressAndHolds: 0
+ property int presses: 0
+ property bool letThrough: false
+ Rectangle{
+ z: 0
+ color: "lightsteelblue"
+ width: 150
+ height: 150
+ MouseArea{
+ anchors.fill: parent
+ onPressed: presses++
+ onClicked: clicks++
+ onPressAndHold: pressAndHolds++
+ onDoubleClicked: doubleClicks++
+ }
+ }
+ MouseArea{
+ z: 1
+ enabled: true
+ anchors.fill: parent
+ onClicked: mouse.accepted = !letThrough;
+ onDoubleClicked: mouse.accepted = !letThrough;
+ onPressAndHold: mouse.accepted = !letThrough;
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/clickandhold.qml b/tests/auto/declarative/qsgmousearea/data/clickandhold.qml
new file mode 100644
index 0000000000..5e4e48f6db
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/clickandhold.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool clicked: false
+ property bool held: false
+
+ MouseArea {
+ width: 200; height: 200
+ onClicked: { root.clicked = true }
+ onPressAndHold: { root.held = true }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/clicktwice.qml b/tests/auto/declarative/qsgmousearea/data/clicktwice.qml
new file mode 100644
index 0000000000..002d1b9047
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/clicktwice.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int clicked: 0
+ property int pressed: 0
+ property int released: 0
+
+ MouseArea {
+ width: 200; height: 200
+ onPressed: { root.pressed++ }
+ onClicked: { root.clicked++ }
+ onReleased: { root.released++ }
+ }
+}
+
diff --git a/tests/auto/declarative/qsgmousearea/data/doubleclick.qml b/tests/auto/declarative/qsgmousearea/data/doubleclick.qml
new file mode 100644
index 0000000000..1030d0c33e
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/doubleclick.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int clicked: 0
+ property int doubleClicked: 0
+ property int released: 0
+
+ MouseArea {
+ width: 200; height: 200
+ onClicked: { root.clicked++ }
+ onDoubleClicked: { root.doubleClicked++ }
+ onReleased: { root.released++ }
+ }
+}
+
diff --git a/tests/auto/declarative/qsgmousearea/data/dragging.qml b/tests/auto/declarative/qsgmousearea/data/dragging.qml
new file mode 100644
index 0000000000..d9b6ac4083
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/dragging.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: blackRect
+ drag.axis: Drag.XandYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/declarative/qsgmousearea/data/dragproperties.qml b/tests/auto/declarative/qsgmousearea/data/dragproperties.qml
new file mode 100644
index 0000000000..421dfe26b7
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/dragproperties.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: blackRect
+ drag.axis: Drag.XandYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/declarative/qsgmousearea/data/dragreset.qml b/tests/auto/declarative/qsgmousearea/data/dragreset.qml
new file mode 100644
index 0000000000..d7949f9139
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/dragreset.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: haveTarget ? blackRect : undefined
+ drag.axis: Drag.XandYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/declarative/qsgmousearea/data/hoverPosition.qml b/tests/auto/declarative/qsgmousearea/data/hoverPosition.qml
new file mode 100644
index 0000000000..834f91ff29
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/hoverPosition.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400;
+
+ property real mouseX: mousetracker.mouseX
+ property real mouseY: mousetracker.mouseY
+
+ Rectangle {
+ width: 100; height: 100;
+ MouseArea {
+ id: mousetracker;
+ anchors.fill: parent;
+ hoverEnabled: true
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/pressedOrdering.qml b/tests/auto/declarative/qsgmousearea/data/pressedOrdering.qml
new file mode 100644
index 0000000000..7aa3098100
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/pressedOrdering.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property string value: "base"
+
+ MouseArea {
+ id: mouseArea
+ width: 200; height: 200
+ onClicked: toggleState.state = "toggled"
+ }
+
+ StateGroup {
+ states: State {
+ name: "pressed"
+ when: mouseArea.pressed
+ PropertyChanges { target: root; value: "pressed" }
+ }
+ }
+
+ StateGroup {
+ id: toggleState
+ states: State {
+ name: "toggled"
+ PropertyChanges { target: root; value: "toggled" }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/preventstealing.qml b/tests/auto/declarative/qsgmousearea/data/preventstealing.qml
new file mode 100644
index 0000000000..fb0d6955c1
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/preventstealing.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Flickable {
+ property bool stealing: true
+ width: 200
+ height: 200
+ contentWidth: 400
+ contentHeight: 400
+ Rectangle {
+ color: "black"
+ width: 400
+ height: 400
+ Rectangle {
+ x: 50; y: 50
+ width: 100; height: 100
+ color: "steelblue"
+ MouseArea {
+ objectName: "mousearea"
+ anchors.fill: parent
+ preventStealing: stealing
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/rejectEvent.qml b/tests/auto/declarative/qsgmousearea/data/rejectEvent.qml
new file mode 100644
index 0000000000..816fc76fac
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/rejectEvent.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "#ffffff"
+ width: 320; height: 240
+ property bool mr1_pressed: false
+ property bool mr1_released: false
+ property bool mr1_canceled: false
+ property bool mr2_pressed: false
+ property bool mr2_released: false
+ property bool mr2_canceled: false
+
+ MouseArea {
+ id: mouseRegion1
+ anchors.fill: parent
+ onPressed: { root.mr1_pressed = true }
+ onReleased: { root.mr1_released = true }
+ onCanceled: { root.mr1_canceled = true }
+ }
+ MouseArea {
+ id: mouseRegion2
+ width: 120; height: 120
+ onPressed: { root.mr2_pressed = true; mouse.accepted = false }
+ onReleased: { root.mr2_released = true }
+ onCanceled: { root.mr2_canceled = true }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/updateMousePosOnClick.qml b/tests/auto/declarative/qsgmousearea/data/updateMousePosOnClick.qml
new file mode 100644
index 0000000000..7377a2e86c
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/updateMousePosOnClick.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "#ffffff"
+ width: 320; height: 240
+ MouseArea {
+ id: mouseRegion
+ objectName: "mouseregion"
+ anchors.fill: parent
+ Rectangle {
+ id: ball
+ objectName: "ball"
+ width: 20; height: 20
+ radius: 10
+ color: "#0000ff"
+ x: { mouseRegion.mouseX }
+ y: mouseRegion.mouseY
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/updateMousePosOnResize.qml b/tests/auto/declarative/qsgmousearea/data/updateMousePosOnResize.qml
new file mode 100644
index 0000000000..ad52ef3820
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/updateMousePosOnResize.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "#ffffff"
+ width: 320; height: 240
+ Rectangle {
+ id: brother
+ objectName: "brother"
+ color: "lightgreen"
+ x: 200; y: 100
+ width: 120; height: 120
+ }
+ MouseArea {
+ id: mouseRegion
+ objectName: "mouseregion"
+
+ property int x1
+ property int y1
+ property int x2
+ property int y2
+ property bool emitPositionChanged: false
+ property bool mouseMatchesPos: true
+
+ anchors.fill: brother
+ onPressed: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x1 = mouseX; y1 = mouseY
+ anchors.fill = parent
+ }
+ onPositionChanged: { emitPositionChanged = true }
+ onMousePositionChanged: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x2 = mouseX; y2 = mouseY
+ }
+ }
+}