aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-10 10:00:34 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-10 10:01:52 +0200
commit5bf33901429e64ab91f30037e25ec04aab4b4c11 (patch)
tree160e993f75f08a602360e5e4aac7cb52aa814036 /tests
parent7a99b074b9565473c4cf95a622fc5b7dca278046 (diff)
parent8190355557c13bba836cef49585556f0c823f672 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro2
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h2
-rw-r--r--tests/auto/qmltest/events/tst_drag.qml102
-rw-r--r--tests/auto/qmltest/textedit/tst_textedit.qml24
-rw-r--r--tests/auto/quick/dialogs/dialogs.pro2
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml2
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml2
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml56
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp62
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp2
10 files changed, 250 insertions, 6 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index d4ce36dc4a..eb5f17a55d 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -22,5 +22,3 @@ OTHER_FILES += data/test.qml data/test.js \
data/breakpointRelocation.qml \
data/createComponent.qml
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-
-mac:CONFIG+=insignificant_test # QTBUG-28263
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 363aabbf39..2b9a94366a 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -57,7 +57,7 @@
class QQmlDebugTest
{
public:
- static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
+ static bool waitForSignal(QObject *receiver, const char *member, int timeout = 10000);
};
class QQmlDebugTestClient : public QQmlDebugClient
diff --git a/tests/auto/qmltest/events/tst_drag.qml b/tests/auto/qmltest/events/tst_drag.qml
index 70e0ea2096..7db1e1e1b2 100644
--- a/tests/auto/qmltest/events/tst_drag.qml
+++ b/tests/auto/qmltest/events/tst_drag.qml
@@ -51,6 +51,17 @@ Rectangle{
id: util
}
+ SignalSpy {
+ id: spyX
+ target: container2
+ signalName: "posXChanged"
+ }
+ SignalSpy {
+ id: spyY
+ target: container2
+ signalName: "posYChanged"
+ }
+
Rectangle {
id:container
width:20
@@ -66,6 +77,55 @@ Rectangle{
}
}
+ Rectangle {
+ id: container2
+ x: 25
+ y: 25
+ width:100
+ height:100
+ color: "red"
+ property bool updatePositionWhileDragging: false
+ property var posX: 0
+ property var posY: 0
+
+ function reset() {
+ fakeHandle.x = 0
+ fakeHandle.y = 0
+ spyX.clear()
+ spyY.clear()
+ }
+
+ Binding {
+ when: container2.updatePositionWhileDragging
+ target: container2
+ property: "posX"
+ value: fakeHandle.x
+ }
+
+ Binding {
+ when: container2.updatePositionWhileDragging
+ target: container2
+ property: "posY"
+ value: fakeHandle.y
+ }
+
+ Item { id: fakeHandle }
+
+ MouseArea {
+ anchors.fill : container2
+ drag.maximumX: 180
+ drag.maximumY: 180
+ drag.minimumX: 0
+ drag.minimumY: 0
+ drag.target: fakeHandle
+
+ onReleased: if (!container2.updatePositionWhileDragging) {
+ container2.posX = mouse.x;
+ container2.posY = mouse.y
+ }
+ }
+ }
+
TestCase {
name:"mouserelease"
when:windowShown
@@ -74,5 +134,47 @@ Rectangle{
compare(container.x, 20 - util.dragThreshold - 1);
compare(container.y, 30 - util.dragThreshold - 1);
}
+
+ function test_doSomethingWhileDragging() {
+ container2.updatePositionWhileDragging = false
+ // dx and dy are superior to 3 times util.dragThreshold.
+ // but here the dragging does not update posX and posY
+ // posX and posY are only updated on mouseRelease
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 10*util.dragThreshold, 10*util.dragThreshold);
+ compare(spyX.count, 1)
+ compare(spyY.count, 1)
+
+ container2.updatePositionWhileDragging = true
+ // dx and dy are superior to 3 times util.dragThreshold.
+ // 3 intermediate mouseMove when dragging
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 10*util.dragThreshold, 10*util.dragThreshold);
+ compare(spyX.count, 3)
+ compare(spyY.count, 3)
+
+ // dx and dy are inferior to 3 times util.dragThreshold.
+ // No intermediate mouseMove when dragging, only one mouseMove
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 2*util.dragThreshold, 2*util.dragThreshold);
+ compare(spyX.count, 1)
+ compare(spyY.count, 1)
+
+ // dx is superior to 3 times util.dragThreshold.
+ // 3 intermediate mouseMove when dragging on x axis
+ // no move on the y axis
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 10*util.dragThreshold, 0);
+ compare(spyX.count, 3)
+ compare(spyY.count, 0)
+
+ // dy is inferior to 3 times util.dragThreshold.
+ // No intermediate mouseMove when dragging, only one mouseMove on y axis
+ // no move on the x axis
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 0, 2*util.dragThreshold);
+ compare(spyX.count, 0)
+ compare(spyY.count, 1)
+ }
}
}
diff --git a/tests/auto/qmltest/textedit/tst_textedit.qml b/tests/auto/qmltest/textedit/tst_textedit.qml
index dc9affdad8..edfa127c59 100644
--- a/tests/auto/qmltest/textedit/tst_textedit.qml
+++ b/tests/auto/qmltest/textedit/tst_textedit.qml
@@ -74,6 +74,13 @@ Item {
}
TextEdit {
+ id: txtentry2
+ text: ""
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
id: txtfunctions
text: "The quick brown fox jumped over the lazy dog"
height: 20
@@ -124,6 +131,23 @@ Item {
compare(txtentry.text, "hello world")
}
+ function test_textentry_char() {
+ txtentry2.focus = true;
+ compare(txtentry2.text, "")
+ keyClick("h")
+ keyClick("e")
+ keyClick("l")
+ keyClick("l")
+ keyClick("o")
+ keyClick(" ")
+ keyClick("W")
+ keyClick("o")
+ keyClick("r")
+ keyClick("l")
+ keyClick("d")
+ compare(txtentry2.text, "hello World")
+ }
+
function test_functions() {
compare(txtfunctions.getText(4,9), "quick")
txtfunctions.select(4,9);
diff --git a/tests/auto/quick/dialogs/dialogs.pro b/tests/auto/quick/dialogs/dialogs.pro
index d28c623a1f..024b15a758 100644
--- a/tests/auto/quick/dialogs/dialogs.pro
+++ b/tests/auto/quick/dialogs/dialogs.pro
@@ -5,6 +5,8 @@ SOURCES += tst_dialogs.cpp
include (../../shared/util.pri)
macx:CONFIG -= app_bundle
+macx:CONFIG+=insignificant_test # QTBUG-30513 - test is unstable
+linux-*:CONFIG+=insignificant_test # QTBUG-30513 - test is unstable
CONFIG += parallel_test
QT += core-private gui-private qml-private quick-private v8-private testlib
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
index e064b41efe..f8f81e306a 100644
--- a/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.1
Item {
id: main
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
index 00fb82d59e..480c0d4863 100644
--- a/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.1
Item {
id: main
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml
new file mode 100644
index 0000000000..0c8586294d
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 800
+ height: 600
+ focus: true
+ Component.onCompleted: button11.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ width: 230
+ height: 600
+ activeFocusOnTab: false
+ anchors.top: parent.top
+ anchors.left: parent.left
+ Item {
+ id: button11
+ objectName: "button11"
+ width: 100
+ height: 50
+ activeFocusOnTab: false
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: false
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub1.right
+ Item {
+ id: button21
+ objectName: "button21"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index 668b5e2945..f2d25e81ed 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -67,6 +67,8 @@ private slots:
void activeFocusOnTab();
void activeFocusOnTab2();
void activeFocusOnTab3();
+ void activeFocusOnTab4();
+ void activeFocusOnTab5();
void keys();
void keysProcessingOrder();
@@ -602,6 +604,66 @@ void tst_QQuickItem::activeFocusOnTab3()
delete window;
}
+void tst_QQuickItem::activeFocusOnTab4()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab4.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button11
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button11");
+ item->setActiveFocusOnTab(true);
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button11->button21
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab5()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab4.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button11 in sub1
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ QQuickItem *item2 = findItem<QQuickItem>(window->rootObject(), "sub1");
+ item2->setActiveFocusOnTab(true);
+
+ // Tab: button11->button21
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
void tst_QQuickItem::keys()
{
QQuickView *window = new QQuickView(0);
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index e805a6b074..274b93e81a 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -1833,7 +1833,7 @@ void tst_QQuickPathView::snapToItem()
flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
QVERIFY(pathview->isMoving());
- QTRY_VERIFY(!pathview->isMoving());
+ QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
QVERIFY(pathview->offset() == qFloor(pathview->offset()));