summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-04-05 22:58:12 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-04-27 03:50:00 +0000
commitf1b4348dae2b992aeaa75e4257c6db4a5182415c (patch)
treea2ddaee3f1211e28854e57e180a6db613eb3474c /tests
parent3d55d182704e2c2b01aa3e5fc159507e322dd281 (diff)
fakeFlickable manual test: put the slider in a drawer
The main reason is that the drawer also demonstrates a different use of the BoundaryRule (limiting drags, with springy endstops). Change-Id: I958af65a857fda1b5b8dc1b135414799261afc1f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/pointer/content/LeftDrawer.qml101
-rw-r--r--tests/manual/pointer/content/Slider.qml5
-rw-r--r--tests/manual/pointer/fakeFlickable.qml45
3 files changed, 127 insertions, 24 deletions
diff --git a/tests/manual/pointer/content/LeftDrawer.qml b/tests/manual/pointer/content/LeftDrawer.qml
new file mode 100644
index 0000000000..08f2f67b5c
--- /dev/null
+++ b/tests/manual/pointer/content/LeftDrawer.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.14
+import Qt.labs.animation 1.0
+import QtGraphicalEffects 1.14
+
+Item {
+ id: root
+ objectName: "LeftHandlerDrawer"
+ width: 100
+ height: 400
+ property real stickout: 4
+ property real xOpen: rect.radius * -2
+ property real xClosed: stickout - width
+ x: xClosed
+ y: 10
+
+ function close() {
+ openCloseAnimation.to = xClosed
+ openCloseAnimation.start()
+ }
+ function open() {
+ openCloseAnimation.to = xOpen
+ openCloseAnimation.start()
+ }
+
+ DragHandler {
+ id: dragHandler
+ yAxis.enabled: false
+ xAxis.minimum: -1000
+ margin: 20
+ onActiveChanged:
+ if (!active) {
+ if (xbr.returnToBounds())
+ return;
+ if (translation.x > 0)
+ open()
+ if (translation.x < 0)
+ close()
+ }
+ }
+
+ BoundaryRule on x {
+ id: xbr
+ minimum: xClosed
+ maximum: xOpen
+ minimumOvershoot: rect.radius
+ maximumOvershoot: rect.radius
+ }
+
+ NumberAnimation on x {
+ id: openCloseAnimation
+ duration: 300
+ easing { type: Easing.OutBounce; overshoot: 5 }
+ }
+
+ RectangularGlow {
+ id: effect
+ anchors.fill: parent
+ glowRadius: dragHandler.margin
+ spread: 0.2
+ color: "cyan"
+ cornerRadius: rect.radius + glowRadius
+ }
+
+ Rectangle {
+ id: rect
+ anchors.fill: parent
+ anchors.margins: 3
+ color: "#333"
+ border.color: "cyan"
+ border.width: 2
+ radius: 10
+ antialiasing: true
+ }
+}
diff --git a/tests/manual/pointer/content/Slider.qml b/tests/manual/pointer/content/Slider.qml
index c381d97c7c..e3e02b0a2f 100644
--- a/tests/manual/pointer/content/Slider.qml
+++ b/tests/manual/pointer/content/Slider.qml
@@ -51,8 +51,8 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: 10
- anchors.topMargin: 30
- anchors.bottomMargin: 30
+ anchors.topMargin: label.height + 6
+ anchors.bottomMargin: valueLabel.height + 4
anchors.horizontalCenter: parent.horizontalCenter
width: 10
color: "black"
@@ -98,6 +98,7 @@ Item {
}
Text {
+ id: valueLabel
font.pointSize: 16
color: "red"
anchors.bottom: parent.bottom
diff --git a/tests/manual/pointer/fakeFlickable.qml b/tests/manual/pointer/fakeFlickable.qml
index 284e0d1f34..3007848c9f 100644
--- a/tests/manual/pointer/fakeFlickable.qml
+++ b/tests/manual/pointer/fakeFlickable.qml
@@ -32,34 +32,22 @@ import "content"
Rectangle {
color: "#444"
width: 480
- height: 480
+ height: 640
FakeFlickable {
id: ff
anchors.fill: parent
+ anchors.leftMargin: 20
anchors.rightMargin: rightSB.width
- Row {
- Item {
- width: 100
- height: 400
- Slider {
- id: slider
- label: "font size"
- anchors.fill: parent
- maximumValue: 36
- value: 14
- }
- }
- Text {
- id: text
- color: "beige"
- font.family: "mono"
- font.pointSize: slider.value
- onTextChanged: console.log("text geom " + width + "x" + height +
- ", parent " + parent + " geom " + parent.width + "x" + parent.height)
- }
- }
+ Text {
+ id: text
+ color: "beige"
+ font.family: "mono"
+ font.pointSize: slider.value
+ onTextChanged: console.log("text geom " + width + "x" + height +
+ ", parent " + parent + " geom " + parent.width + "x" + parent.height)
+ }
onFlickStarted: console.log("flick started with velocity " + velocity)
onFlickEnded: console.log("flick ended with velocity " + velocity)
@@ -101,4 +89,17 @@ Rectangle {
bottom: parent.bottom
}
}
+
+ LeftDrawer {
+ width: 100
+ anchors.verticalCenter: parent.verticalCenter
+ Slider {
+ id: slider
+ label: "font\nsize"
+ anchors.fill: parent
+ anchors.margins: 10
+ maximumValue: 36
+ value: 14
+ }
+ }
}