aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qquickmousearea/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qquickmousearea/data')
-rw-r--r--tests/auto/declarative/qquickmousearea/data/clickThrough.qml23
-rw-r--r--tests/auto/declarative/qquickmousearea/data/clickThrough2.qml32
-rw-r--r--tests/auto/declarative/qquickmousearea/data/clickandhold.qml13
-rw-r--r--tests/auto/declarative/qquickmousearea/data/clicktwice.qml16
-rw-r--r--tests/auto/declarative/qquickmousearea/data/doubleclick.qml16
-rw-r--r--tests/auto/declarative/qquickmousearea/data/dragging.qml28
-rw-r--r--tests/auto/declarative/qquickmousearea/data/dragproperties.qml28
-rw-r--r--tests/auto/declarative/qquickmousearea/data/dragreset.qml28
-rw-r--r--tests/auto/declarative/qquickmousearea/data/hoverPosition.qml17
-rw-r--r--tests/auto/declarative/qquickmousearea/data/hoverPropagation.qml54
-rw-r--r--tests/auto/declarative/qquickmousearea/data/noclickandhold.qml11
-rw-r--r--tests/auto/declarative/qquickmousearea/data/pressedCanceled.qml18
-rw-r--r--tests/auto/declarative/qquickmousearea/data/pressedOrdering.qml28
-rw-r--r--tests/auto/declarative/qquickmousearea/data/preventstealing.qml24
-rw-r--r--tests/auto/declarative/qquickmousearea/data/rejectEvent.qml28
-rw-r--r--tests/auto/declarative/qquickmousearea/data/updateMousePosOnClick.qml20
-rw-r--r--tests/auto/declarative/qquickmousearea/data/updateMousePosOnResize.qml43
17 files changed, 427 insertions, 0 deletions
diff --git a/tests/auto/declarative/qquickmousearea/data/clickThrough.qml b/tests/auto/declarative/qquickmousearea/data/clickThrough.qml
new file mode 100644
index 0000000000..0d954f8511
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/clickThrough2.qml b/tests/auto/declarative/qquickmousearea/data/clickThrough2.qml
new file mode 100644
index 0000000000..bc73a1bf8a
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/clickandhold.qml b/tests/auto/declarative/qquickmousearea/data/clickandhold.qml
new file mode 100644
index 0000000000..5e4e48f6db
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/clicktwice.qml b/tests/auto/declarative/qquickmousearea/data/clicktwice.qml
new file mode 100644
index 0000000000..002d1b9047
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/doubleclick.qml b/tests/auto/declarative/qquickmousearea/data/doubleclick.qml
new file mode 100644
index 0000000000..1030d0c33e
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/dragging.qml b/tests/auto/declarative/qquickmousearea/data/dragging.qml
new file mode 100644
index 0000000000..d9b6ac4083
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/dragproperties.qml b/tests/auto/declarative/qquickmousearea/data/dragproperties.qml
new file mode 100644
index 0000000000..421dfe26b7
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/dragreset.qml b/tests/auto/declarative/qquickmousearea/data/dragreset.qml
new file mode 100644
index 0000000000..d7949f9139
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/hoverPosition.qml b/tests/auto/declarative/qquickmousearea/data/hoverPosition.qml
new file mode 100644
index 0000000000..834f91ff29
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/hoverPropagation.qml b/tests/auto/declarative/qquickmousearea/data/hoverPropagation.qml
new file mode 100644
index 0000000000..c47c794132
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/data/hoverPropagation.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item{
+ width: 400
+ height: 200
+ property bool point1: ma2.containsMouse && !ma1.containsMouse
+ property bool point2: ma3.containsMouse && ma4.containsMouse
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma1.containsMouse ? "red" : "white"
+ MouseArea{
+ id: ma1
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma2.containsMouse ? "blue" : "white"
+ MouseArea{
+ id: ma2
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ }
+ }
+
+ Item{
+ x:200
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma3.containsMouse ? "yellow" : "white"
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma4.containsMouse ? "green" : "white"
+ }
+ }
+ MouseArea{
+ id: ma3
+ hoverEnabled: true
+ width: 200
+ height: 200
+ MouseArea{
+ id: ma4
+ width: 100
+ height: 100
+ hoverEnabled: true
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qquickmousearea/data/noclickandhold.qml b/tests/auto/declarative/qquickmousearea/data/noclickandhold.qml
new file mode 100644
index 0000000000..6647de001d
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/data/noclickandhold.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool clicked: false
+
+ MouseArea {
+ width: 200; height: 200
+ onClicked: { root.clicked = true }
+ }
+}
diff --git a/tests/auto/declarative/qquickmousearea/data/pressedCanceled.qml b/tests/auto/declarative/qquickmousearea/data/pressedCanceled.qml
new file mode 100644
index 0000000000..231436d0f2
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/data/pressedCanceled.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "#ffffff"
+ width: 320; height: 240
+ property bool pressed:mouse.pressed
+ property bool canceled: false
+ property bool released: false
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onPressed: { root.canceled = false }
+ onCanceled: {root.canceled = true}
+ onReleased: {root.released = true; root.canceled = false}
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qquickmousearea/data/pressedOrdering.qml b/tests/auto/declarative/qquickmousearea/data/pressedOrdering.qml
new file mode 100644
index 0000000000..7aa3098100
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/preventstealing.qml b/tests/auto/declarative/qquickmousearea/data/preventstealing.qml
new file mode 100644
index 0000000000..fb0d6955c1
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/rejectEvent.qml b/tests/auto/declarative/qquickmousearea/data/rejectEvent.qml
new file mode 100644
index 0000000000..816fc76fac
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/updateMousePosOnClick.qml b/tests/auto/declarative/qquickmousearea/data/updateMousePosOnClick.qml
new file mode 100644
index 0000000000..7377a2e86c
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/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/qquickmousearea/data/updateMousePosOnResize.qml b/tests/auto/declarative/qquickmousearea/data/updateMousePosOnResize.qml
new file mode 100644
index 0000000000..55af864060
--- /dev/null
+++ b/tests/auto/declarative/qquickmousearea/data/updateMousePosOnResize.qml
@@ -0,0 +1,43 @@
+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 }
+ onMouseXChanged: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x2 = mouseX; y2 = mouseY
+ }
+ onMouseYChanged: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x2 = mouseX; y2 = mouseY
+ }
+ }
+}