diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-23 13:35:38 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-04-23 13:35:38 +0000 |
commit | 25b99c8f488c55d5a55874eacfb16b0d1b285cb0 (patch) | |
tree | 8eaf2f4467c29b08de192f180f0a51a8276b71e6 /tests | |
parent | 2dbf8e01035f3979b32d82590a362a56d2429ea1 (diff) | |
parent | 07782f48f4318a7261f1b0ddcd686b19ec812e36 (diff) |
Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev
Diffstat (limited to 'tests')
18 files changed, 625 insertions, 18 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro index 3608375771..0d6484f8e6 100644 --- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro +++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qdebugmessageservice -QT += qml network testlib gui-private +QT += qml network testlib gui-private core-private macx:CONFIG -= app_bundle SOURCES += tst_qdebugmessageservice.cpp diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro index 98c0fc2542..716d8f0be9 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro +++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro @@ -8,5 +8,5 @@ INCLUDEPATH += ../shared include(../shared/debugutil.pri) CONFIG += parallel_test -QT += qml network testlib gui-private +QT += qml network testlib gui-private core-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro index 38f78e8248..ad431d4871 100644 --- a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro +++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro @@ -14,5 +14,5 @@ DEFINES += QT_QML_DEBUG_NO_WARNING CONFIG += qml_debug -QT += qml-private testlib gui-private +QT += qml-private testlib gui-private core-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro index 330c8bcdbf..eb41f759c9 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmldebuggingenabler -QT += qml testlib gui-private +QT += qml testlib gui-private core-private osx:CONFIG -= app_bundle SOURCES += tst_qqmldebuggingenabler.cpp diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro index eb5f17a55d..fb06df9c99 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmldebugjs -QT += qml testlib gui-private +QT += qml testlib gui-private core-private macx:CONFIG -= app_bundle SOURCES += tst_qqmldebugjs.cpp diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro index 5879506a58..573e58d3a6 100644 --- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro +++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro @@ -18,5 +18,5 @@ OTHER_FILES += \ DEFINES += QT_QML_DEBUG_NO_WARNING -QT += qml-private testlib gui-private +QT += qml-private testlib gui-private core-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro index 09332cc302..901dd229c0 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro +++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro @@ -10,7 +10,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private +QT += core qml testlib gui-private core-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro index 9da6bda28e..028eb3644d 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qqmlenginedebuginspectorintegration -QT += qml testlib gui-private +QT += qml testlib gui-private core-private macx:CONFIG -= app_bundle SOURCES += tst_qqmlenginedebuginspectorintegration.cpp diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro index 4adda35aea..3a1d59f3fa 100644 --- a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro +++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qqmlinspector -QT += qml testlib gui-private +QT += qml testlib gui-private core-private macx:CONFIG -= app_bundle SOURCES += tst_qqmlinspector.cpp diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index 1bab614b63..ec84139797 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -10,7 +10,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private +QT += core qml testlib gui-private core-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp index e78427df3b..7df020405f 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -134,31 +134,30 @@ void tst_qquickapplication::state() QQuickWindow window; item->setParentItem(window.contentItem()); - // initial state should be ApplicationInactive - QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationInactive); - QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationInactive); - // If the platform plugin has the ApplicationState capability, state changes originate from it // as a result of a system event. We therefore have to simulate these events here. if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) { + // Flush pending events, in case the platform have already queued real application state events + QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive); - QTest::waitForEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationActive); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationActive); QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive); - QTest::waitForEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationInactive); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationInactive); QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended); - QTest::waitForEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationSuspended); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationSuspended); QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationHidden); - QTest::waitForEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationHidden); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationHidden); diff --git a/tests/manual/shorcuts/shortcuts.qml b/tests/manual/shortcuts/shortcuts.qml index beb931389d..beb931389d 100644 --- a/tests/manual/shorcuts/shortcuts.qml +++ b/tests/manual/shortcuts/shortcuts.qml diff --git a/tests/manual/touch/flicktext.qml b/tests/manual/touch/flicktext.qml new file mode 100644 index 0000000000..e541d5e35e --- /dev/null +++ b/tests/manual/touch/flicktext.qml @@ -0,0 +1,378 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the manual tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import "qrc:/quick/shared/" as Examples + +Rectangle { + id: root + + Item { + id: flickArea + anchors.fill: parent + anchors.bottomMargin: bottomFlow.implicitHeight + 4 + clip: true + + Flickable { + id: flick + anchors.fill: parent + anchors.margins: 6 + contentWidth: text.implicitWidth + contentHeight: text.implicitHeight + pixelAligned: pxAlignCB.checked + Text { + id: text + text: "foo bar" + font.family: "mono" + } + onContentXChanged: canvas.requestPaint() + onContentYChanged: canvas.requestPaint() + } + + Timer { id: fadeTimer; interval: 1000; onTriggered: { hfade.start(); } } + + MouseArea { + id: verticalScrollArea + anchors { + right: parent.right + top: flick.top + bottom: flick.bottom + } + width: 36 + onMouseYChanged: { + var contentY = Math.min(height, mouseY) / height * (flick.contentHeight - height) + flick.contentY = Math.max(0, contentY) + } + onReleased: flick.returnToBounds() + Rectangle { + anchors.right: parent.right + anchors.margins: 2 + color: "darkgrey" + width: 20 + radius: 2 + antialiasing: true + height: flick.height * (flick.height / flick.contentHeight) - anchors.margins * 2 + y: flick.contentY * (flick.height / flick.contentHeight) + + Rectangle { + anchors.top: parent.top + width: parent.width + height: 6 + radius: 2 + color: "blue" + visible: flick.atYBeginning + } + + Rectangle { + anchors.top: parent.bottom + width: parent.width + height: 6 + radius: 2 + color: "blue" + visible: flick.atYEnd + } + + Text { + anchors.centerIn: parent + text: flick.contentY.toFixed(2) + rotation: 90 + style: Text.Outline + styleColor: "white" + color: "black" + } + + } + } + + Rectangle { + id: horizontalScrollDecorator + anchors.bottom: flick.bottom + anchors.bottomMargin: -4 + color: "darkgrey" + border.color: "black" + border.width: 1 + height: 5 + radius: 2 + antialiasing: true + width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2 + x: flick.contentX * (flick.width / flick.contentWidth) + NumberAnimation on opacity { id: hfade; to: 0; duration: 500 } + onXChanged: { opacity = 1.0; fadeTimer.restart() } + } + + Canvas { + id: canvas + anchors.fill: parent + antialiasing: true + renderTarget: Canvas.FramebufferObject + onPaint: { + var ctx = canvas.getContext('2d'); + ctx.save() + ctx.clearRect(0, 0, canvas.width, canvas.height) + ctx.strokeStyle = "green" + ctx.fillStyle = "green" + ctx.lineWidth = 1 + + if (flick.horizontalVelocity) { + ctx.save() + ctx.beginPath() + ctx.translate((flick.horizontalVelocity < 0 ? width : 0), height / 2) + ctx.moveTo(0, 0) + var velScaled = flick.horizontalVelocity / 10 + var arrowOffset = (flick.horizontalVelocity < 0 ? 10 : -10) + ctx.lineTo(velScaled, 0) + ctx.lineTo(velScaled + arrowOffset, -4) + ctx.lineTo(velScaled + arrowOffset, 4) + ctx.lineTo(velScaled, 0) + ctx.closePath() + ctx.stroke() + ctx.fill() + ctx.restore() + } + + if (flick.verticalVelocity) { + ctx.save() + ctx.beginPath() + ctx.translate(width / 2, (flick.verticalVelocity < 0 ? height : 0)) + ctx.moveTo(0, 0) + var velScaled = flick.verticalVelocity / 10 + var arrowOffset = (flick.verticalVelocity < 0 ? 10 : -10) + ctx.lineTo(0, velScaled) + ctx.lineTo(-4, velScaled + arrowOffset) + ctx.lineTo(4, velScaled + arrowOffset) + ctx.lineTo(0, velScaled) + ctx.closePath() + ctx.stroke() + ctx.fill() + ctx.restore() + } + + ctx.restore() + } + } + } + + Row { + id: bottomFlow + anchors.bottom: parent.bottom + width: parent.width - 12 + x: 6 + spacing: 12 + + Item { + id: progFlickItem + width: progFlickRow.implicitWidth + height: progFlickRow.implicitHeight + 4 + flickingLabel.implicitHeight + Text { id: progLabel; text: "programmatic flick: h " + xvelSlider.value.toFixed(1) + " v " + yvelSlider.value.toFixed(1) } + Row { + id: progFlickRow + y: progLabel.height + spacing: 4 + + Column { + Examples.Slider { + id: xvelSlider + min: -5000 + max: 5000 + init: 5000 + width: 250 + name: "X" + minLabelWidth: 0 + } + Examples.Slider { + id: yvelSlider + min: -5000 + max: 5000 + init: 2500 + width: 250 + name: "Y" + minLabelWidth: 0 + } + } + + Grid { + columns: 2 + spacing: 2 + Examples.Button { + text: "flick" + onClicked: flick.flick(xvelSlider.value, yvelSlider.value) + width: zeroButton.width + } + Examples.Button { + text: "cancel" + onClicked: flick.cancelFlick() + width: zeroButton.width + } + Examples.Button { + id: zeroButton + text: "<- zero" + onClicked: { + xvelSlider.setValue(5000) + yvelSlider.setValue(5000) + } + } + Examples.Button { + text: "home" + width: zeroButton.width + onClicked: { + flick.contentX = 0 + flick.contentY = 0 + } + } + } + } + } + + Column { + height: parent.height + width: movingLabel.implicitWidth * 1.5 + spacing: 2 + Text { + id: movingLabel + text: "moving:" + color: flick.moving ? "green" : "black" + } + Rectangle { + width: parent.width + height: hVelLabel.implicitHeight + 4 + color: flick.movingHorizontally ? "green" : "darkgrey" + Text { + id: hVelLabel + anchors.centerIn: parent + color: "white" + text: "h " + flick.horizontalVelocity.toFixed(2) + } + } + Rectangle { + width: parent.width + height: vVelLabel.implicitHeight + 4 + color: flick.movingVertically ? "green" : "darkgrey" + Text { + id: vVelLabel + anchors.centerIn: parent + color: "white" + text: "v " + flick.verticalVelocity.toFixed(2) + } + } + } + + Column { + height: parent.height + width: draggingLabel.implicitWidth + spacing: 2 + Text { + id: draggingLabel + text: "dragging:" + color: flick.dragging ? "green" : "black" + } + Rectangle { + width: draggingLabel.implicitWidth + height: hVelLabel.implicitHeight + 4 + color: flick.draggingHorizontally ? "green" : "darkgrey" + Text { + anchors.centerIn: parent + color: "white" + text: "h" + } + } + Rectangle { + width: draggingLabel.implicitWidth + height: vVelLabel.implicitHeight + 4 + color: flick.draggingVertically ? "green" : "darkgrey" + Text { + anchors.centerIn: parent + color: "white" + text: "v" + } + } + } + + Column { + height: parent.height + width: flickingLabel.implicitWidth + spacing: 2 + Text { + id: flickingLabel + text: "flicking:" + color: flick.flicking ? "green" : "black" + } + Rectangle { + width: flickingLabel.implicitWidth + height: hVelLabel.implicitHeight + 4 + color: flick.flickingHorizontally ? "green" : "darkgrey" + Text { + anchors.centerIn: parent + color: "white" + text: "h" + } + } + Rectangle { + width: flickingLabel.implicitWidth + height: vVelLabel.implicitHeight + 4 + color: flick.flickingVertically ? "green" : "darkgrey" + Text { + anchors.centerIn: parent + color: "white" + text: "v" + } + } + } + + Column { + Examples.CheckBox { + id: pxAlignCB + text: "pixel aligned" + } + Text { + text: "content X " + flick.contentX.toFixed(2) + " Y " + flick.contentY.toFixed(2) + } + } + } + + Component.onCompleted: { + var request = new XMLHttpRequest() + request.open('GET', 'qrc:/flicktext.qml') + request.onreadystatechange = function(event) { + if (request.readyState === XMLHttpRequest.DONE) + text.text = request.responseText + } + request.send() + } +} diff --git a/tests/manual/touch/main.cpp b/tests/manual/touch/main.cpp new file mode 100644 index 0000000000..baa9603175 --- /dev/null +++ b/tests/manual/touch/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the manual tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + return app.exec(); +} diff --git a/tests/manual/touch/main.qml b/tests/manual/touch/main.qml new file mode 100644 index 0000000000..524f979c85 --- /dev/null +++ b/tests/manual/touch/main.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the manual tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Window 2.2 +import "qrc:/quick/shared/" as Examples + +Window { + width: 800 + height: 600 + visible: true + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("crosshairs", "crosshairs and velocity vectors at finger positions", Qt.resolvedUrl("mpta-crosshairs.qml")) + addExample("flick text", "flick a text document", Qt.resolvedUrl("flicktext.qml")) + } + } +} diff --git a/tests/manual/touch/mpta-crosshairs.qml b/tests/manual/touch/mpta-crosshairs.qml new file mode 100644 index 0000000000..8b71e4fdc3 --- /dev/null +++ b/tests/manual/touch/mpta-crosshairs.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the manual tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Window 2.2 + +Rectangle { + id: root + color: "black" + + MultiPointTouchArea { + id: mpta + anchors.fill: parent + touchPoints: [ + TouchPoint { property color color: "red" }, + TouchPoint { property color color: "orange" }, + TouchPoint { property color color: "yellow" }, + TouchPoint { property color color: "green" }, + TouchPoint { property color color: "blue" }, + TouchPoint { property color color: "violet" }, + TouchPoint { property color color: "cyan" }, + TouchPoint { property color color: "magenta" }, + TouchPoint { property color color: "goldenrod" }, + TouchPoint { property color color: "darkgray" } + ] } + + Repeater { + model: 10 + + Item { + anchors.fill: parent + property TouchPoint touchPoint + visible: touchPoint.pressed + + Rectangle { + color: touchPoint.color + anchors.top: parent.top + anchors.bottom: parent.bottom + width: 2 + x: touchPoint.x - 1 + } + Rectangle { + color: touchPoint.color + anchors.left: parent.left + anchors.right: parent.right + height: 2 + y: touchPoint.y - 1 + } + Rectangle { + color: touchPoint.color + width: 50 * touchPoint.pressure + height: width + radius: width / 2 + x: touchPoint.x - width / 2 + y: touchPoint.y - width / 2 + } + Rectangle { + id: velocityVector + visible: width > 0 + width: touchPoint.velocity.length() + height: 1 + x: touchPoint.x + y: touchPoint.y + rotation: width > 0 ? Math.acos(touchPoint.velocity.x / width) : 0 + transformOrigin: Item.BottomLeft + } + + Component.onCompleted: touchPoint = mpta.touchPoints[index] + } + } +} diff --git a/tests/manual/touch/qml.qrc b/tests/manual/touch/qml.qrc new file mode 100644 index 0000000000..478b6886d6 --- /dev/null +++ b/tests/manual/touch/qml.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>mpta-crosshairs.qml</file> + <file>flicktext.qml</file> + </qresource> +</RCC> diff --git a/tests/manual/touch/touch.pro b/tests/manual/touch/touch.pro new file mode 100644 index 0000000000..3705d41df0 --- /dev/null +++ b/tests/manual/touch/touch.pro @@ -0,0 +1,7 @@ +TEMPLATE = app + +QT += qml quick + +SOURCES += main.cpp + +RESOURCES += qml.qrc ../../../examples/quick/shared/quick_shared.qrc |