aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtquick2')
-rw-r--r--tests/auto/qtquick2/examples/tst_examples.cpp2
-rw-r--r--tests/auto/qtquick2/geometry/tst_geometry.cpp4
-rw-r--r--tests/auto/qtquick2/nodes/tst_nodestest.cpp4
-rw-r--r--tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp2
-rw-r--r--tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp2
-rw-r--r--tests/auto/qtquick2/qquickaccessible/data/checkbuttons.qml47
-rw-r--r--tests/auto/qtquick2/qquickaccessible/data/hittest.qml176
-rw-r--r--tests/auto/qtquick2/qquickaccessible/data/pushbutton.qml15
-rw-r--r--tests/auto/qtquick2/qquickaccessible/data/statictext.qml25
-rw-r--r--tests/auto/qtquick2/qquickaccessible/data/widgets/TextRect.qml26
-rw-r--r--tests/auto/qtquick2/qquickaccessible/qquickaccessible.pro25
-rw-r--r--tests/auto/qtquick2/qquickaccessible/tst_qquickaccessible.cpp410
-rw-r--r--tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp4
-rw-r--r--tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp2
-rw-r--r--tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp2
-rw-r--r--tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp2
-rw-r--r--tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp2
-rw-r--r--tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp4
-rw-r--r--tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp4
-rw-r--r--tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp2
-rw-r--r--tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp2
-rw-r--r--tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp2
-rw-r--r--tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp122
-rw-r--r--tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp5
-rw-r--r--tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp42
-rw-r--r--tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml2
-rw-r--r--tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp2
-rw-r--r--tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp2
-rw-r--r--tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp2
-rw-r--r--tests/auto/qtquick2/qquicklistview/incrementalmodel.h2
-rw-r--r--tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp71
-rw-r--r--tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp5
-rw-r--r--tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp4
-rw-r--r--tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp4
-rw-r--r--tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp2
-rw-r--r--tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp4
-rw-r--r--tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp21
-rw-r--r--tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp2
-rw-r--r--tests/auto/qtquick2/qquickscreen/data/screen.qml2
-rw-r--r--tests/auto/qtquick2/qquickscreen/qquickscreen.pro2
-rw-r--r--tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp4
-rw-r--r--tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp59
-rw-r--r--tests/auto/qtquick2/qquickspriteimage/data/advance.qml66
-rw-r--r--tests/auto/qtquick2/qquickspriteimage/data/basic.qml2
-rw-r--r--tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp19
-rw-r--r--tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml7
-rw-r--r--tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml7
-rw-r--r--tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp32
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml6
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml6
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml7
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml6
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml6
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml7
-rw-r--r--tests/auto/qtquick2/qquicktextedit/data/http/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp141
-rw-r--r--tests/auto/qtquick2/qquicktextinput/data/validators.qml7
-rw-r--r--tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp136
-rw-r--r--tests/auto/qtquick2/qquickview/tst_qquickview.cpp2
-rw-r--r--tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp8
-rw-r--r--tests/auto/qtquick2/qtquick2.pro1
72 files changed, 1408 insertions, 203 deletions
diff --git a/tests/auto/qtquick2/examples/tst_examples.cpp b/tests/auto/qtquick2/examples/tst_examples.cpp
index 5672cb4658..006ebddbb6 100644
--- a/tests/auto/qtquick2/examples/tst_examples.cpp
+++ b/tests/auto/qtquick2/examples/tst_examples.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/geometry/tst_geometry.cpp b/tests/auto/qtquick2/geometry/tst_geometry.cpp
index 23e37dae2f..a947de2268 100644
--- a/tests/auto/qtquick2/geometry/tst_geometry.cpp
+++ b/tests/auto/qtquick2/geometry/tst_geometry.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the Qt scene graph research project.
**
diff --git a/tests/auto/qtquick2/nodes/tst_nodestest.cpp b/tests/auto/qtquick2/nodes/tst_nodestest.cpp
index 7aaff3fe91..ce9848e0aa 100644
--- a/tests/auto/qtquick2/nodes/tst_nodestest.cpp
+++ b/tests/auto/qtquick2/nodes/tst_nodestest.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the Qt scene graph research project.
**
diff --git a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 683f1c7603..b2c07526ff 100644
--- a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
index edf206acdc..7047321557 100644
--- a/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
+++ b/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index e512f6c5c1..26a73d3bca 100644
--- a/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
index 39e9fa3389..39606a7775 100644
--- a/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
+++ b/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp b/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp
index c2682358b3..655b2541cb 100644
--- a/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp
+++ b/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
index 596ac3d337..95a06c81bf 100644
--- a/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
+++ b/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
index 3243c6ff8a..16a0c1ac27 100644
--- a/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
+++ b/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp b/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp
index 77778a677c..eae7d9db65 100644
--- a/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp
+++ b/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp
index 4d5df12e0b..6edd61af09 100644
--- a/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp
index a0fe195f2e..a64caafcc8 100644
--- a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp
+++ b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp
index 9177107d16..1de6267a93 100644
--- a/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp
+++ b/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp
index b7045a1317..61500c617a 100644
--- a/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp
+++ b/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index 35c0bba717..d4a2246538 100644
--- a/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickaccessible/data/checkbuttons.qml b/tests/auto/qtquick2/qquickaccessible/data/checkbuttons.qml
new file mode 100644
index 0000000000..22cdad1377
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/data/checkbuttons.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 400
+
+ // button, not checkable
+ Rectangle {
+ y: 20
+ width: 100; height: 20
+ Accessible.role : Accessible.Button
+ }
+
+ // button, checkable, not checked
+ Rectangle {
+ y: 40
+ width: 100; height: 20
+ Accessible.role : Accessible.Button
+ property bool checkable: true
+ property bool checked: false
+ }
+
+ // button, checkable, checked
+ Rectangle {
+ y: 60
+ width: 100; height: 20
+ Accessible.role : Accessible.Button
+ property bool checkable: true
+ property bool checked: true
+ }
+
+ // check box, checked
+ Rectangle {
+ y: 80
+ width: 100; height: 20
+ Accessible.role : Accessible.CheckBox
+ property bool checked: true
+ }
+ // check box, not checked
+ Rectangle {
+ y: 100
+ width: 100; height: 20
+ Accessible.role : Accessible.CheckBox
+ property bool checked: false
+ }
+}
+
diff --git a/tests/auto/qtquick2/qquickaccessible/data/hittest.qml b/tests/auto/qtquick2/qquickaccessible/data/hittest.qml
new file mode 100644
index 0000000000..e6ce8b1882
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/data/hittest.qml
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+import "widgets"
+
+Rectangle {
+ id: page
+ width: 640
+ height: 480
+ color: "white"
+ Rectangle {
+ id: header
+ color: "#c0c0c0"
+ height: usage.height + chkClip.height
+ anchors.left: parent.left
+ anchors.right: parent.right
+ Text {
+ id: usage
+ text: "Use an a11y inspect tool to see if all visible rectangles can be found with hit testing."
+ }
+ Rectangle {
+ id: chkClip
+ property bool checked: true
+
+ color: (checked ? "#f0f0f0" : "#c0c0c0")
+ height: label.height
+ width: label.width
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: chkClip.checked = !chkClip.checked
+ }
+ Text {
+ id: label
+ text: "Click here to toggle clipping"
+ }
+ }
+ }
+ TextRect {
+ clip: chkClip.checked
+ z: 2
+ id: rect1
+ text: "rect1"
+ width: 100
+ height: 100
+ color: "#ffc0c0"
+ anchors.top: header.bottom
+ TextRect {
+ id: rect10
+ text: "rect10"
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ color: "#ffa0a0"
+ TextRect {
+ id: rect100
+ text: "rect100"
+ width: 100
+ height: 100
+ x: 80
+ y: 80
+ color: "#ff8080"
+ }
+ TextRect {
+ id: rect101
+ text: "rect101"
+ x: 100
+ y: 70
+ z: 3
+ width: 100
+ height: 100
+ color: "#e06060"
+ }
+ TextRect {
+ id: rect102
+ text: "rect102"
+ width: 100
+ height: 100
+ x: 150
+ y: 60
+ color: "#c04040"
+ }
+ }
+ }
+
+ TextRect {
+ x: 0
+ y: 50
+ id: rect2
+ text: "rect2"
+ width: 100
+ height: 100
+ color: "#c0c0ff"
+ TextRect {
+ id: rect20
+ text: "rect20"
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ color: "#a0a0ff"
+ TextRect {
+ id: rect200
+ text: "rect200"
+ width: 100
+ height: 100
+ x: 80
+ y: 80
+ color: "#8080ff"
+ }
+ TextRect {
+ id: rect201
+ text: "rect201"
+ x: 100
+ y: 70
+ z: 100
+ width: 100
+ height: 100
+ color: "#6060e0"
+ }
+ TextRect {
+ id: rect202
+ text: "rect202"
+ width: 100
+ height: 100
+ x: 150
+ y: 60
+ color: "#4040c0"
+ }
+ }
+ }
+
+}
diff --git a/tests/auto/qtquick2/qquickaccessible/data/pushbutton.qml b/tests/auto/qtquick2/qquickaccessible/data/pushbutton.qml
new file mode 100644
index 0000000000..df19231703
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/data/pushbutton.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ Accessible.role : Accessible.Button
+ property string text : "test"
+
+ Text {
+ anchors.fill : parent
+ text : parent.text
+ }
+
+ MouseArea {
+ anchors.fill : parent
+ }
+}
diff --git a/tests/auto/qtquick2/qquickaccessible/data/statictext.qml b/tests/auto/qtquick2/qquickaccessible/data/statictext.qml
new file mode 100644
index 0000000000..a0821cfc4d
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/data/statictext.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 400
+
+ Text {
+ x: 100
+ y: 20
+ width: 200
+ height: 50
+ text : "Hello Accessibility"
+ }
+
+ Text {
+ x: 100
+ y: 40
+ width: 100
+ height: 40
+ text : "Hello 2"
+ Accessible.role: Accessible.StaticText
+ Accessible.name: "The Hello 2 accessible text"
+ Accessible.description: "A text description"
+ }
+}
diff --git a/tests/auto/qtquick2/qquickaccessible/data/widgets/TextRect.qml b/tests/auto/qtquick2/qquickaccessible/data/widgets/TextRect.qml
new file mode 100644
index 0000000000..937686974b
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/data/widgets/TextRect.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: button
+
+ property alias text : buttonText.text
+ Accessible.name: text
+ Accessible.description: "This button does " + text
+ Accessible.role: Accessible.Client
+
+ signal clicked
+
+ width: 40
+ height: 40
+ border.width: 2
+ border.color: "black";
+
+ Text {
+ id: buttonText
+ text: "TextRect"
+ anchors.centerIn: parent
+ font.pixelSize: parent.height * .1
+ style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
+ }
+
+}
diff --git a/tests/auto/qtquick2/qquickaccessible/qquickaccessible.pro b/tests/auto/qtquick2/qquickaccessible/qquickaccessible.pro
new file mode 100644
index 0000000000..dc32316e28
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/qquickaccessible.pro
@@ -0,0 +1,25 @@
+CONFIG += testcase
+
+TARGET = tst_qquickaccessible
+QT += declarative-private network quick-private testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickaccessible.cpp
+
+include (../../shared/util.pri)
+
+OTHER_FILES += data/checkbuttons.qml
+OTHER_FILES += data/hittest.qml
+OTHER_FILES += data/pushbutton.qml
+OTHER_FILES += data/statictext.qml
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+wince*: {
+ accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
+ accessneeded.path = accessible
+ DEPLOYMENT += accessneeded
+}
+
diff --git a/tests/auto/qtquick2/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/qtquick2/qquickaccessible/tst_qquickaccessible.cpp
new file mode 100644
index 0000000000..d2967a1453
--- /dev/null
+++ b/tests/auto/qtquick2/qquickaccessible/tst_qquickaccessible.cpp
@@ -0,0 +1,410 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include "QtTest/qtestaccessible.h"
+
+#include <QtGui/qaccessible.h>
+
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickitem.h>
+
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativeproperty.h>
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+
+#include "../../shared/util.h"
+
+
+typedef QSharedPointer<QAccessibleInterface> QAI;
+
+#define EXPECT(cond) \
+ do { \
+ if (!errorAt && !(cond)) { \
+ errorAt = __LINE__; \
+ qWarning("level: %d, middle: %d, role: %d (%s)", treelevel, middle, iface->role(), #cond); \
+ } \
+ } while (0)
+
+static int verifyHierarchy(QAccessibleInterface *iface)
+{
+ int errorAt = 0;
+ static int treelevel = 0; // for error diagnostics
+ QAccessibleInterface *middleChild, *if2;
+ middleChild = 0;
+ ++treelevel;
+ int middle = iface->childCount()/2 + 1;
+ if (iface->childCount() >= 2) {
+ middleChild = iface->child(middle - 1);
+ }
+ for (int i = 0; i < iface->childCount() && !errorAt; ++i) {
+ if2 = iface->child(i);
+ EXPECT(if2 != 0);
+ // navigate Ancestor...
+ QAccessibleInterface *parent = if2->parent();
+ EXPECT(iface->object() == parent->object());
+ delete parent;
+
+ // verify children...
+ if (!errorAt)
+ errorAt = verifyHierarchy(if2);
+ delete if2;
+ }
+ delete middleChild;
+
+ --treelevel;
+ return errorAt;
+}
+
+
+//TESTED_FILES=
+
+class tst_QQuickAccessible : public QDeclarativeDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickAccessible();
+ virtual ~tst_QQuickAccessible();
+
+private slots:
+ void commonTests_data();
+ void commonTests();
+
+ void declarativeAttachedProperties();
+ void basicPropertiesTest();
+ void hitTest();
+ void checkableTest();
+};
+
+tst_QQuickAccessible::tst_QQuickAccessible()
+{
+
+}
+
+tst_QQuickAccessible::~tst_QQuickAccessible()
+{
+
+}
+
+void tst_QQuickAccessible::commonTests_data()
+{
+ QTest::addColumn<QString>("accessibleRoleFileName");
+
+ QTest::newRow("StaticText") << SRCDIR "/data/statictext.qml";
+ QTest::newRow("PushButton") << SRCDIR "/data/pushbutton.qml";
+}
+
+void tst_QQuickAccessible::commonTests()
+{
+ QFETCH(QString, accessibleRoleFileName);
+
+ qDebug() << "testing" << accessibleRoleFileName;
+
+ QQuickView *view = new QQuickView();
+// view->setFixedSize(240,320);
+ view->setSource(QUrl::fromLocalFile(accessibleRoleFileName));
+ view->show();
+// view->setFocus();
+ QVERIFY(view->rootObject() != 0);
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(view);
+ QVERIFY(iface);
+
+ delete iface;
+ delete view;
+}
+
+
+
+QString eventName(const int ev)
+{
+ switch (ev) {
+ case 0x0001: return "SoundPlayed";
+ case 0x0002: return "Alert";
+ case 0x0003: return "ForegroundChanged";
+ case 0x0004: return "MenuStart";
+ case 0x0005: return "MenuEnd";
+ case 0x0006: return "PopupMenuStart";
+ case 0x0007: return "PopupMenuEnd";
+ case 0x000C: return "ContextHelpStart";
+ case 0x000D: return "ContextHelpEnd";
+ case 0x000E: return "DragDropStart";
+ case 0x000F: return "DragDropEnd";
+ case 0x0010: return "DialogStart";
+ case 0x0011: return "DialogEnd";
+ case 0x0012: return "ScrollingStart";
+ case 0x0013: return "ScrollingEnd";
+ case 0x0018: return "MenuCommand";
+ case 0x8000: return "ObjectCreated";
+ case 0x8001: return "ObjectDestroyed";
+ case 0x8002: return "ObjectShow";
+ case 0x8003: return "ObjectHide";
+ case 0x8004: return "ObjectReorder";
+ case 0x8005: return "Focus";
+ case 0x8006: return "Selection";
+ case 0x8007: return "SelectionAdd";
+ case 0x8008: return "SelectionRemove";
+ case 0x8009: return "SelectionWithin";
+ case 0x800A: return "StateChanged";
+ case 0x800B: return "LocationChanged";
+ case 0x800C: return "NameChanged";
+ case 0x800D: return "DescriptionChanged";
+ case 0x800E: return "ValueChanged";
+ case 0x800F: return "ParentChanged";
+ case 0x80A0: return "HelpChanged";
+ case 0x80B0: return "DefaultActionChanged";
+ case 0x80C0: return "AcceleratorChanged";
+ default: return "Unknown Event";
+ }
+}
+
+void tst_QQuickAccessible::declarativeAttachedProperties()
+{
+ {
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem {\n"
+ "}", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object);
+ QCOMPARE(attachedObject, static_cast<QObject*>(0));
+ delete object;
+ }
+
+ // Attached property
+ {
+ QObject parent;
+ QQuickAccessibleAttached *attachedObj = new QQuickAccessibleAttached(&parent);
+
+ attachedObj->name();
+
+ QVariant pp = attachedObj->property("name");
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem {\n"
+ "Accessible.role: Accessible.Button\n"
+ "}", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object);
+ QVERIFY(attachedObject);
+ if (attachedObject) {
+ QVariant p = attachedObject->property("role");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toInt(), int(QAccessible::PushButton));
+ p = attachedObject->property("name");
+ QCOMPARE(p.isNull(), true);
+ p = attachedObject->property("description");
+ QCOMPARE(p.isNull(), true);
+ }
+ delete object;
+ }
+
+ // Attached property
+ {
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem {\n"
+ "Accessible.role: Accessible.Button\n"
+ "Accessible.name: \"Donald\"\n"
+ "Accessible.description: \"Duck\"\n"
+ "}", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object);
+ QVERIFY(attachedObject);
+ if (attachedObject) {
+ QVariant p = attachedObject->property("role");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toInt(), int(QAccessible::PushButton));
+ p = attachedObject->property("name");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toString(), QLatin1String("Donald"));
+ p = attachedObject->property("description");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toString(), QLatin1String("Duck"));
+ }
+ delete object;
+ }
+}
+
+
+void tst_QQuickAccessible::basicPropertiesTest()
+{
+ QAI app = QAI(QAccessible::queryAccessibleInterface(qApp));
+ QCOMPARE(app->childCount(), 0);
+
+ QQuickView *canvas = new QQuickView();
+ canvas->setSource(testFileUrl("statictext.qml"));
+ canvas->show();
+ QCOMPARE(app->childCount(), 1);
+
+ QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
+ QVERIFY(iface.data());
+ QCOMPARE(iface->childCount(), 1);
+
+ QAI item = QAI(iface->child(0));
+ QVERIFY(item.data());
+ QCOMPARE(item->childCount(), 2);
+ QCOMPARE(item->rect().size(), QSize(400, 400));
+ QCOMPARE(item->role(), QAccessible::Pane);
+ QCOMPARE(iface->indexOfChild(item.data()), 0);
+
+ QAI text = QAI(item->child(0));
+ QVERIFY(text.data());
+ QCOMPARE(text->childCount(), 0);
+
+ QCOMPARE(text->text(QAccessible::Name), QLatin1String("Hello Accessibility"));
+ QCOMPARE(text->rect().size(), QSize(200, 50));
+ QCOMPARE(text->rect().x(), item->rect().x() + 100);
+ QCOMPARE(text->rect().y(), item->rect().y() + 20);
+ QCOMPARE(text->role(), QAccessible::StaticText);
+ QCOMPARE(item->indexOfChild(text.data()), 0);
+
+ QAI text2 = QAI(item->child(1));
+ QVERIFY(text2.data());
+ QCOMPARE(text2->childCount(), 0);
+
+ QCOMPARE(text2->text(QAccessible::Name), QLatin1String("The Hello 2 accessible text"));
+ QCOMPARE(text2->rect().size(), QSize(100, 40));
+ QCOMPARE(text2->rect().x(), item->rect().x() + 100);
+ QCOMPARE(text2->rect().y(), item->rect().y() + 40);
+ QCOMPARE(text2->role(), QAccessible::StaticText);
+ QCOMPARE(item->indexOfChild(text2.data()), 1);
+
+ QCOMPARE(iface->indexOfChild(text2.data()), -1);
+ QCOMPARE(text2->indexOfChild(item.data()), -1);
+
+ delete canvas;
+}
+
+QAI topLevelChildAt(QAccessibleInterface *iface, int x, int y)
+{
+ QAI child = QAI(iface->childAt(x, y));
+ if (!child)
+ return QAI();
+
+ QAI childOfChild;
+ while (childOfChild = QAI(child->childAt(x, y))) {
+ child = childOfChild;
+ }
+ return child;
+}
+
+void tst_QQuickAccessible::hitTest()
+{
+ QQuickView *canvas = new QQuickView;
+ canvas->setSource(testFileUrl("hittest.qml"));
+ canvas->show();
+
+ QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
+ QVERIFY(iface.data());
+ QAI rootItem = QAI(iface->child(0));
+ QRect rootRect = rootItem->rect();
+
+ // hit the root item
+ QAI itemHit(iface->childAt(rootRect.x() + 200, rootRect.y() + 50));
+ QVERIFY(itemHit);
+ QCOMPARE(rootRect, itemHit->rect());
+
+ // hit rect1
+ QAI rect1(rootItem->child(1));
+ QRect rect1Rect = rect1->rect();
+ itemHit = QAI(rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10));
+ QVERIFY(itemHit);
+ QCOMPARE(rect1Rect, itemHit->rect());
+ QCOMPARE(itemHit->text(QAccessible::Name), QLatin1String("rect1"));
+
+ // should also work from top level (app)
+ QAI app(QAccessible::queryAccessibleInterface(qApp));
+ QAI itemHit2(topLevelChildAt(app.data(), rect1Rect.x() + 10, rect1Rect.y() + 10));
+ QVERIFY(itemHit2);
+ QCOMPARE(itemHit2->rect(), rect1Rect);
+ QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1"));
+
+ // hit rect201
+ QAI rect2(rootItem->child(2));
+ QAI rect20(rect2->child(1));
+ QAI rect201(rect20->child(2));
+ QVERIFY(rect201);
+
+ QRect rect201Rect = rect201->rect();
+ itemHit = QAI(iface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20));
+ QVERIFY(itemHit);
+ QCOMPARE(itemHit->rect(), rect201Rect);
+ QCOMPARE(itemHit->text(QAccessible::Name), QLatin1String("rect201"));
+
+ delete canvas;
+}
+
+void tst_QQuickAccessible::checkableTest()
+{
+ QQuickView *canvas = new QQuickView();
+ canvas->setSource(testFileUrl("checkbuttons.qml"));
+ canvas->show();
+
+ QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
+ QVERIFY(iface.data());
+ QAI root = QAI(iface->child(0));
+
+ QAI button1 = QAI(root->child(0));
+ QCOMPARE(button1->role(), QAccessible::Button);
+ QVERIFY(!(button1->state().checked));
+ QAI button2 = QAI(root->child(1));
+ QVERIFY(!(button2->state().checked));
+ QAI button3 = QAI(root->child(2));
+ QVERIFY(button3->state().checked);
+
+ QAI checkBox1 = QAI(root->child(3));
+ QCOMPARE(checkBox1->role(), QAccessible::CheckBox);
+ QVERIFY((checkBox1->state().checked));
+ QAI checkBox2 = QAI(root->child(4));
+ QVERIFY(!(checkBox2->state().checked));
+}
+
+QTEST_MAIN(tst_QQuickAccessible)
+
+#include "tst_qquickaccessible.moc"
diff --git a/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp b/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp
index 9725390e47..01e982f0db 100644
--- a/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp
+++ b/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -482,7 +482,7 @@ void tst_qquickanchors::crash1()
{
QUrl source(testFileUrl("crash1.qml"));
- QString expect = source.toString() + ":3:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column";
+ QString expect = source.toString() + ":3:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
diff --git a/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp
index 417dd085b8..62592c1d25 100644
--- a/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp
+++ b/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp
index 24442a985d..3360ad97df 100644
--- a/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp
+++ b/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp b/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp
index 1a2eb832f2..78bf989047 100644
--- a/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp
+++ b/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp b/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp
index 56db225b39..a620ff9b4a 100644
--- a/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp
+++ b/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp b/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp
index 9163df6c62..dd5cb229ec 100644
--- a/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp
+++ b/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp
index f8a081ff21..36b0beeb30 100644
--- a/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp
+++ b/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
index 5281565220..a90870ce80 100644
--- a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp b/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp
index 41f8284c22..a30980f251 100644
--- a/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp
+++ b/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp
index 18c89f6371..a306a57ef9 100644
--- a/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp
+++ b/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
index a83d8a2d08..0a6e41fc5e 100644
--- a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -467,7 +467,7 @@ void tst_QQuickGridView::inserted_more()
// check visibleItems.first() is in correct position
QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
QVERIFY(item0);
- QCOMPARE(item0->y(), itemsOffsetAfterMove);
+ QCOMPARE(item0->y(), 0.0);
QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
int firstVisibleIndex = -1;
@@ -840,6 +840,7 @@ void tst_QQuickGridView::removed_more()
QFETCH(int, removeIndex);
QFETCH(int, removeCount);
QFETCH(qreal, itemsOffsetAfterMove);
+ QFETCH(QString, firstVisible);
QQuickText *name;
QQuickText *number;
@@ -868,22 +869,20 @@ void tst_QQuickGridView::removed_more()
model.removeItems(removeIndex, removeCount);
QTRY_COMPARE(gridview->property("count").toInt(), model.count());
- // check visibleItems.first() is in correct position
- QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
-// qApp->exec();
- QVERIFY(item0);
- QCOMPARE(item0->y(), itemsOffsetAfterMove);
-
+ QString firstName;
int firstVisibleIndex = -1;
QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
for (int i=0; i<items.count(); i++) {
if (items[i]->y() >= contentY) {
QDeclarativeExpression e(qmlContext(items[i]), items[i], "index");
firstVisibleIndex = e.evaluate().toInt();
+ QDeclarativeExpression en(qmlContext(items[i]), items[i], "name");
+ firstName = en.evaluate().toString();
break;
}
}
QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+ QCOMPARE(firstName, firstVisible);
// Confirm items positioned correctly and indexes correct
int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
@@ -911,21 +910,27 @@ void tst_QQuickGridView::removed_more_data()
QTest::addColumn<int>("removeIndex");
QTest::addColumn<int>("removeCount");
QTest::addColumn<qreal>("itemsOffsetAfterMove");
+ QTest::addColumn<QString>("firstVisible");
QTest::newRow("remove 1, before visible items")
<< 120.0 // show 6-23
<< 3 << 1
- << 0.0;
+ << 0.0 << "Item7";
QTest::newRow("remove multiple, all before visible items")
<< 120.0
<< 1 << 3
- << 60.0; // removed top row, slide down by 1 row
+ << 60.0 << "Item6"; // removed top row, slide down by 1 row
QTest::newRow("remove multiple, all before visible items, remove item 0")
<< 120.0
<< 0 << 4
- << 60.0; // removed top row, slide down by 1 row
+ << 60.0 << "Item7"; // removed top row, slide down by 1 row
+
+ QTest::newRow("remove multiple rows, all before visible items")
+ << 240.0 // show 12-29
+ << 1 << 7
+ << 120.0 << "Item13";
// remove 3,4,5 before the visible pos, first row moves down to just before the visible pos,
@@ -933,80 +938,80 @@ void tst_QQuickGridView::removed_more_data()
QTest::newRow("remove multiple, mix of items from before and within visible items")
<< 120.0
<< 3 << 5
- << 60.0; // adjust for the 1 row removed before the visible
+ << 60.0 << "Item8"; // adjust for the 1 row removed before the visible
QTest::newRow("remove multiple, mix of items from before and within visible items, remove item 0")
<< 120.0
<< 0 << 8
- << 60.0 * 2; // adjust for the 2 rows removed before the visible
+ << 60.0 * 2 << "Item8"; // adjust for the 2 rows removed before the visible
QTest::newRow("remove 1, from start of visible, content at start")
<< 0.0
<< 0 << 1
- << 0.0;
+ << 0.0 << "Item1";
QTest::newRow("remove multiple, from start of visible, content at start")
<< 0.0
<< 0 << 3
- << 0.0;
+ << 0.0 << "Item3";
QTest::newRow("remove 1, from start of visible, content not at start")
<< 120.0 // show 6-23
<< 4 << 1
- << 0.0;
+ << 0.0 << "Item7";
QTest::newRow("remove multiple, from start of visible, content not at start")
<< 120.0 // show 6-23
<< 4 << 3
- << 0.0;
+ << 0.0 << "Item9";
QTest::newRow("remove 1, from middle of visible, content at start")
<< 0.0
<< 10 << 1
- << 0.0;
+ << 0.0 << "Item0";
QTest::newRow("remove multiple, from middle of visible, content at start")
<< 0.0
<< 10 << 5
- << 0.0;
+ << 0.0 << "Item0";
QTest::newRow("remove 1, from middle of visible, content not at start")
<< 120.0 // show 6-23
<< 10 << 1
- << 0.0;
+ << 0.0 << "Item6";
QTest::newRow("remove multiple, from middle of visible, content not at start")
<< 120.0 // show 6-23
<< 10 << 5
- << 0.0;
+ << 0.0 << "Item6";
QTest::newRow("remove 1, after visible, content at start")
<< 0.0
<< 16 << 1
- << 0.0;
+ << 0.0 << "Item0";
QTest::newRow("remove multiple, after visible, content at start")
<< 0.0
<< 16 << 5
- << 0.0;
+ << 0.0 << "Item0";
QTest::newRow("remove 1, after visible, content not at start")
<< 120.0 // show 6-23
<< 16+4 << 1
- << 0.0;
+ << 0.0 << "Item6";
QTest::newRow("remove multiple, after visible, content not at start")
<< 120.0 // show 6-23
<< 16+4 << 5
- << 0.0;
+ << 0.0 << "Item6";
QTest::newRow("remove multiple, mix of items from within and after visible items")
<< 120.0 // show 6-23
<< 20 << 5
- << 0.0;
+ << 0.0 << "Item6";
}
void tst_QQuickGridView::addOrRemoveBeforeVisible()
@@ -1040,6 +1045,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible()
gridview->setCurrentIndex(0);
qApp->processEvents();
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
// scroll down until item 0 is no longer drawn
// (bug not triggered if we just move using content y, since that doesn't
@@ -1091,7 +1097,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible_data()
QTest::addColumn<qreal>("newTopContentY");
QTest::newRow("add") << true << -60.0;
- QTest::newRow("remove") << false << 0.0;
+ QTest::newRow("remove") << false << -60.0;
}
void tst_QQuickGridView::clear()
@@ -1134,11 +1140,6 @@ void tst_QQuickGridView::clear()
void tst_QQuickGridView::moved()
{
- if (QTest::currentDataTag() == QLatin1String("move 1 forwards, from non-visible -> visible")
- || QTest::currentDataTag() == QLatin1String("move 1 forwards, from non-visible -> visible (move first item)")) {
- QSKIP("QTBUG-23455");
- }
-
QFETCH(qreal, contentY);
QFETCH(int, from);
QFETCH(int, to);
@@ -1222,13 +1223,11 @@ void tst_QQuickGridView::moved_data()
<< 1 << 8 << 1
<< 0.0;
- // skipped QTBUG-23455
QTest::newRow("move 1 forwards, from non-visible -> visible")
<< 120.0 // show 6-23
<< 1 << 23 << 1
<< 0.0;
- // skipped QTBUG-23455
QTest::newRow("move 1 forwards, from non-visible -> visible (move first item)")
<< 120.0 // // show 6-23
<< 0 << 6 << 1
@@ -1301,6 +1300,26 @@ void tst_QQuickGridView::moved_data()
<< 0 << 6 << 3
<< 60.0; // top row moved and shifted to below 3rd row, all items should shift down by 1 row
+ QTest::newRow("move multiple forwards, mix of non-visible/visible")
+ << 120.0
+ << 3 << 16 << 6
+ << 60.0; // top two rows removed, third row is now the first visible
+
+ QTest::newRow("move multiple forwards, to bottom of view")
+ << 0.0
+ << 5 << 13 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, first row -> last")
+ << 0.0
+ << 0 << 15 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, content y not 0")
+ << 120.0
+ << 5+4 << 13+4 << 5
+ << 0.0;
+
QTest::newRow("move multiple forwards, from visible -> non-visible")
<< 0.0
<< 1 << 16 << 3
@@ -3175,6 +3194,41 @@ void tst_QQuickGridView::resizeViewAndRepaint()
gridview->setHeight(100);
QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10));
+ // Ensure we handle -ve sizes
+ gridview->setHeight(-100);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 3);
+
+ gridview->setCacheBuffer(120);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 9);
+
+ // ensure items in cache become visible
+ gridview->setHeight(120);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 15);
+
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal((i%3)*80));
+ QTRY_COMPARE(item->y(), qreal((i/3)*60));
+ QCOMPARE(item->isVisible(), i < 9); // inside view visible, outside not visible
+ }
+
+ // ensure items outside view become invisible
+ gridview->setHeight(60);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 12);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal((i%3)*80));
+ QTRY_COMPARE(item->y(), qreal((i/3)*60));
+ QCOMPARE(item->isVisible(), i < 6); // inside view visible, outside not visible
+ }
+
delete canvas;
}
diff --git a/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp b/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp
index e68c1157c9..c54f5e2b24 100644
--- a/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -693,7 +693,8 @@ void tst_qquickimage::imageCrash_QTBUG_22125()
// shouldn't crash when deleting cancelled QDeclarativePixmapReplys.
QTest::qWait(520); // Delay mode delays for 500 ms.
- qApp->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
}
/*
diff --git a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
index 7e32816599..dccf055ae8 100644
--- a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -66,9 +66,23 @@ protected:
virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
virtual void mousePressEvent(QMouseEvent *event) { event->accept(); ++pressCount; }
virtual void mouseReleaseEvent(QMouseEvent *event) { event->accept(); ++releaseCount; }
+ virtual void touchEvent(QTouchEvent *event) { event->accept(); }
virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; }
};
+class TestCanvas: public QQuickCanvas
+{
+public:
+ TestCanvas()
+ : QQuickCanvas()
+ {}
+
+ virtual bool event(QEvent *event)
+ {
+ return QQuickCanvas::event(event);
+ }
+};
+
class TestPolishItem : public QQuickItem
{
Q_OBJECT
@@ -124,6 +138,7 @@ private slots:
void enabled();
void mouseGrab();
+ void touchEventAccept();
void polishOutsideAnimation();
void polishOnCompleted();
@@ -862,6 +877,31 @@ void tst_qquickitem::mouseGrab()
delete canvas;
}
+void tst_qquickitem::touchEventAccept()
+{
+ TestCanvas *canvas = new TestCanvas;
+ canvas->resize(100, 100);
+ canvas->show();
+
+ TestItem *item = new TestItem;
+ item->setSize(QSizeF(100, 100));
+ item->setParentItem(canvas->rootItem());
+
+ static QTouchDevice* device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+
+ QTouchEvent *event = new QTouchEvent(QEvent::TouchBegin, device);
+
+ bool accepted = canvas->event(event);
+
+ QVERIFY(accepted && event->isAccepted());
+
+ delete event;
+ delete item;
+ delete canvas;
+}
+
void tst_qquickitem::polishOutsideAnimation()
{
QQuickCanvas *canvas = new QQuickCanvas;
diff --git a/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml b/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml
index 9d88d9df1d..282dbab9dd 100644
--- a/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml
+++ b/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
index 556f629618..0060dc7d3e 100644
--- a/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp
index 767926df98..c4bd7c12d8 100644
--- a/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp b/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp
index 452be57aa6..f950134848 100644
--- a/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp
+++ b/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquicklistview/incrementalmodel.h b/tests/auto/qtquick2/qquicklistview/incrementalmodel.h
index 09a2bbd11a..168dee8c5e 100644
--- a/tests/auto/qtquick2/qquicklistview/incrementalmodel.h
+++ b/tests/auto/qtquick2/qquicklistview/incrementalmodel.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
index ccdc49e00f..0fa6348026 100644
--- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -1359,6 +1359,7 @@ void tst_QQuickListView::moved(const QUrl &source)
QQuickListView *listview = findItem<QQuickListView>(canvas->rootObject(), "list");
QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
@@ -1496,6 +1497,26 @@ void tst_QQuickListView::moved_data()
<< 0 << 5 << 3
<< 20.0 * 3; // moving 3 from above the content y should adjust y positions accordingly
+ QTest::newRow("move multiple forwards, mix of non-visible/visible")
+ << 40.0
+ << 1 << 16 << 2
+ << 20.0; // item 1,2 are removed, item 3 is now first visible
+
+ QTest::newRow("move multiple forwards, to bottom of view")
+ << 0.0
+ << 5 << 13 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, first->last")
+ << 0.0
+ << 0 << 13 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, content y not 0")
+ << 80.0
+ << 5+4 << 13+4 << 3
+ << 0.0;
+
QTest::newRow("move multiple forwards, from visible -> non-visible")
<< 0.0
<< 1 << 16 << 3
@@ -1940,8 +1961,8 @@ void tst_QQuickListView::spacing()
QTRY_VERIFY(listview->spacing() == 10);
// Confirm items positioned correctly
- itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
- for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() == 11);
+ for (int i = 0; i < 11; ++i) {
QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
if (!item) qWarning() << "Item" << i << "not found";
QTRY_VERIFY(item);
@@ -1951,8 +1972,8 @@ void tst_QQuickListView::spacing()
listview->setSpacing(0);
// Confirm items positioned correctly
- itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
- for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() >= 16);
+ for (int i = 0; i < 16; ++i) {
QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
if (!item) qWarning() << "Item" << i << "not found";
QTRY_VERIFY(item);
@@ -2243,7 +2264,7 @@ void tst_QQuickListView::sectionsPositioning()
model.modifyItem(2, "Three", "aaa");
model.modifyItem(3, "Four", "aaa");
model.modifyItem(4, "Five", "aaa");
- QTest::qWait(300);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
QTRY_COMPARE(listview->currentSection(), QString("aaa"));
@@ -2254,8 +2275,7 @@ void tst_QQuickListView::sectionsPositioning()
QTRY_COMPARE(item->y(), qreal(i*20*6));
}
- topItem = findVisibleChild(contentItem, "sect_aaa"); // section header
- QVERIFY(topItem);
+ QTRY_VERIFY(topItem = findVisibleChild(contentItem, "sect_aaa")); // section header
QCOMPARE(topItem->y(), 10.);
// remove section boundary
@@ -3576,6 +3596,7 @@ void tst_QQuickListView::resizeView()
ctxt->setContextProperty("testObject", testObject);
canvas->setSource(testFileUrl("listviewtest.qml"));
+ canvas->show();
qApp->processEvents();
QQuickListView *listview = findItem<QQuickListView>(canvas->rootObject(), "list");
@@ -3602,6 +3623,40 @@ void tst_QQuickListView::resizeView()
QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio));
QCOMPARE(heightRatio.toReal(), 0.25);
+ // Ensure we handle -ve sizes
+ listview->setHeight(-100);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 1);
+
+ listview->setCacheBuffer(200);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 11);
+
+ // ensure items in cache become visible
+ listview->setHeight(200);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 21);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.);
+ QCOMPARE(item->isVisible(), i < 11); // inside view visible, outside not visible
+ }
+
+ // ensure items outside view become invisible
+ listview->setHeight(100);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 16);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.);
+ QCOMPARE(item->isVisible(), i < 6); // inside view visible, outside not visible
+ }
+
delete canvas;
delete testObject;
}
diff --git a/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp b/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp
index 74144d5348..c9880751d6 100644
--- a/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -762,7 +762,8 @@ void tst_QQuickLoader::deleteComponentCrash()
QCOMPARE(loader->item()->objectName(), QLatin1String("blue"));
QCOMPARE(loader->progress(), 1.0);
QCOMPARE(loader->status(), QQuickLoader::Ready);
- qApp->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
QVERIFY(loader->source() == testFileUrl("BlueRect.qml"));
diff --git a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
index 27f3f0abc7..bfbb6b22ae 100644
--- a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 837c31f073..0a0f69448d 100644
--- a/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp b/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
index 8c6dd19e5b..213d6609c0 100644
--- a/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp
index 53d7c2c2ce..1974c389e0 100644
--- a/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp
index 441c343927..5fa0c7f665 100644
--- a/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -1206,14 +1206,14 @@ void tst_qquickpositioners::test_conflictinganchors()
component.setData("import QtQuick 2.0\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
warningMessage.clear();
delete item;
@@ -1227,14 +1227,14 @@ void tst_qquickpositioners::test_conflictinganchors()
component.setData("import QtQuick 2.0\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nRow { Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
warningMessage.clear();
delete item;
@@ -1248,27 +1248,27 @@ void tst_qquickpositioners::test_conflictinganchors()
component.setData("import QtQuick 2.0\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nGrid { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
delete item;
component.setData("import QtQuick 2.0\nFlow { Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow"));
+ QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
qInstallMsgHandler(oldMsgHandler);
delete item;
}
@@ -1444,7 +1444,8 @@ void tst_qquickpositioners::test_attachedproperties_dynamic()
row->metaObject()->invokeMethod(row, "destroySubRect");
- qApp->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QTRY_VERIFY(rect1->property("index").toInt() == 1);
QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
diff --git a/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp
index ba93a62ed5..eb8a3ab226 100644
--- a/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickscreen/data/screen.qml b/tests/auto/qtquick2/qquickscreen/data/screen.qml
index 971975f892..780b22f23d 100644
--- a/tests/auto/qtquick2/qquickscreen/data/screen.qml
+++ b/tests/auto/qtquick2/qquickscreen/data/screen.qml
@@ -6,6 +6,6 @@ Item {
height: 100
property int w: Window.Screen.width
property int h: Window.Screen.height
- property int curOrientation: Window.Screen.currentOrientation
+ property int curOrientation: Window.Screen.orientation
property int priOrientation: Window.Screen.primaryOrientation
}
diff --git a/tests/auto/qtquick2/qquickscreen/qquickscreen.pro b/tests/auto/qtquick2/qquickscreen/qquickscreen.pro
index 9e84512264..6d0a5e1650 100644
--- a/tests/auto/qtquick2/qquickscreen/qquickscreen.pro
+++ b/tests/auto/qtquick2/qquickscreen/qquickscreen.pro
@@ -7,4 +7,4 @@ include (../../shared/util.pri)
macx:CONFIG -= app_bundle
CONFIG += parallel_test
-QT += core-private gui-private declarative-private testlib
+QT += core-private gui-private declarative-private testlib quick-private
diff --git a/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp b/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp
index 2d455911b2..fdb27302ae 100644
--- a/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp
+++ b/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -68,7 +68,7 @@ void tst_qquickscreen::basicProperties()
QCOMPARE(screen->size().width(), root->property("w").toInt());
QCOMPARE(screen->size().height(), root->property("h").toInt());
- QCOMPARE(int(screen->currentOrientation()), root->property("curOrientation").toInt());
+ QCOMPARE(int(screen->orientation()), root->property("curOrientation").toInt());
QCOMPARE(int(screen->primaryOrientation()), root->property("priOrientation").toInt());
}
diff --git a/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp
index 3287b8ccdb..d08281933d 100644
--- a/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp
+++ b/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -89,52 +89,8 @@ private:
OpacityPresent = 0x08,
PropertyPresent = 0x10
};
-
- static void installMsgHandler();
- static void uninstallMsgHandler();
- static void msgHandler(QtMsgType type, const char *msg);
- static void expectWarning(const char *msg);
-
- static QtMsgHandler originalMsgHandler;
- static QByteArray actualWarnings;
- static QByteArray expectedWarnings;
};
-QtMsgHandler tst_qquickshadereffect::originalMsgHandler = 0;
-QByteArray tst_qquickshadereffect::actualWarnings;
-QByteArray tst_qquickshadereffect::expectedWarnings;
-
-void tst_qquickshadereffect::installMsgHandler()
-{
- Q_ASSERT(originalMsgHandler == 0);
- originalMsgHandler = qInstallMsgHandler(msgHandler);
- actualWarnings.clear();
- expectedWarnings.clear();
-}
-
-void tst_qquickshadereffect::uninstallMsgHandler()
-{
- Q_ASSERT(originalMsgHandler != 0);
- qInstallMsgHandler(originalMsgHandler);
- originalMsgHandler = 0;
- QCOMPARE(QString(actualWarnings), QString(expectedWarnings)); // QString for sensible output.
-}
-
-void tst_qquickshadereffect::msgHandler(QtMsgType type, const char *msg)
-{
- Q_ASSERT(originalMsgHandler != 0);
- if (type == QtWarningMsg)
- actualWarnings.append(msg).append('\n');
- originalMsgHandler(type, msg);
-}
-
-void tst_qquickshadereffect::expectWarning(const char *msg)
-{
- Q_ASSERT(originalMsgHandler != 0);
- expectedWarnings.append(msg).append('\n');
- QTest::ignoreMessage(QtWarningMsg, msg);
-}
-
tst_qquickshadereffect::tst_qquickshadereffect()
{
}
@@ -295,21 +251,20 @@ void tst_qquickshadereffect::lookThroughShaderCode()
TestShaderEffect item;
QVERIFY(!item.isConnected(SIGNAL(dummyChanged()))); // Nothing connected yet.
- installMsgHandler();
+ QString expected;
if ((presenceFlags & VertexPresent) == 0)
- expectWarning("QQuickShaderEffect: Missing reference to \'qt_Vertex\'.");
+ expected += "Warning: Missing reference to \'qt_Vertex\'.\n";
if ((presenceFlags & TexCoordPresent) == 0)
- expectWarning("QQuickShaderEffect: Missing reference to \'qt_MultiTexCoord0\'.");
+ expected += "Warning: Missing reference to \'qt_MultiTexCoord0\'.\n";
if ((presenceFlags & MatrixPresent) == 0)
- expectWarning("QQuickShaderEffect: Missing reference to \'qt_Matrix\'.");
+ expected += "Warning: Missing reference to \'qt_Matrix\'.\n";
if ((presenceFlags & OpacityPresent) == 0)
- expectWarning("QQuickShaderEffect: Missing reference to \'qt_Opacity\'.");
+ expected += "Warning: Missing reference to \'qt_Opacity\'.\n";
item.setVertexShader(vertexShader);
item.setFragmentShader(fragmentShader);
item.ensureCompleted();
-
- uninstallMsgHandler();
+ QCOMPARE(item.parseLog(), expected);
// If the uniform was successfully parsed, the notify signal has been connected to an update slot.
QCOMPARE(item.isConnected(SIGNAL(dummyChanged())), (presenceFlags & PropertyPresent) != 0);
diff --git a/tests/auto/qtquick2/qquickspriteimage/data/advance.qml b/tests/auto/qtquick2/qquickspriteimage/data/advance.qml
new file mode 100644
index 0000000000..5029786849
--- /dev/null
+++ b/tests/auto/qtquick2/qquickspriteimage/data/advance.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ SpriteImage {
+ objectName: "sprite"
+ sprites: [Sprite {
+ name: "firstState"
+ source: "squarefacesprite.png"
+ frames: 3
+ duration: -1
+ to: {"secondState":1}
+ }, Sprite {
+ name: "secondState"
+ source: "squarefacesprite.png"
+ frames: 6
+ duration: -1
+ } ]
+ width: 160
+ height: 160
+ }
+}
diff --git a/tests/auto/qtquick2/qquickspriteimage/data/basic.qml b/tests/auto/qtquick2/qquickspriteimage/data/basic.qml
index c68d2e0779..7cdd4ead32 100644
--- a/tests/auto/qtquick2/qquickspriteimage/data/basic.qml
+++ b/tests/auto/qtquick2/qquickspriteimage/data/basic.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp b/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp
index d46a5c42cb..f7b27cf069 100644
--- a/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp
+++ b/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -51,6 +51,7 @@ public:
private slots:
void test_properties();
+ void test_framerateAdvance();//Separate codepath for QQuickSpriteEngine
};
void tst_qquickspriteimage::test_properties()
@@ -76,6 +77,22 @@ void tst_qquickspriteimage::test_properties()
delete canvas;
}
+void tst_qquickspriteimage::test_framerateAdvance()
+{
+ QQuickView *canvas = new QQuickView(0);
+
+ canvas->setSource(testFileUrl("advance.qml"));
+ canvas->show();
+ QTest::qWaitForWindowShown(canvas);
+
+ QVERIFY(canvas->rootObject());
+ QQuickSpriteImage* sprite = canvas->rootObject()->findChild<QQuickSpriteImage*>("sprite");
+ QVERIFY(sprite);
+
+ QTRY_COMPARE(sprite->currentSprite(), QLatin1String("secondState"));
+ delete canvas;
+}
+
QTEST_MAIN(tst_qquickspriteimage)
#include "tst_qquickspriteimage.moc"
diff --git a/tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml b/tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml
new file mode 100644
index 0000000000..8de7364d08
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http/"
+}
diff --git a/tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml b/tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml
new file mode 100644
index 0000000000..cee19740f9
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http://127.0.0.1:14453/text.html"
+}
diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
index 0e8eab18be..a2c4afd668 100644
--- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <QtTest/QSignalSpy>
#include <QTextDocument>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
@@ -74,6 +75,7 @@ private slots:
void alignments_data();
void alignments();
+ void baseUrl();
void embeddedImages_data();
void embeddedImages();
@@ -1281,6 +1283,32 @@ void tst_qquicktext::clickLink()
}
}
+void tst_qquicktext::baseUrl()
+{
+ QUrl localUrl("file:///tests/text.qml");
+ QUrl remoteUrl("http://qt.nokia.com/test.qml");
+
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\n Text {}", localUrl);
+ QQuickText *textObject = qobject_cast<QQuickText *>(textComponent.create());
+
+ QCOMPARE(textObject->baseUrl(), localUrl);
+
+ QSignalSpy spy(textObject, SIGNAL(baseUrlChanged()));
+
+ textObject->setBaseUrl(localUrl);
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 0);
+
+ textObject->setBaseUrl(remoteUrl);
+ QCOMPARE(textObject->baseUrl(), remoteUrl);
+ QCOMPARE(spy.count(), 1);
+
+ textObject->resetBaseUrl();
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 2);
+}
+
void tst_qquicktext::embeddedImages_data()
{
QTest::addColumn<QUrl>("qmlfile");
@@ -1288,9 +1316,11 @@ void tst_qquicktext::embeddedImages_data()
QTest::newRow("local") << testFileUrl("embeddedImagesLocal.qml") << "";
QTest::newRow("local-error") << testFileUrl("embeddedImagesLocalError.qml")
<< testFileUrl("embeddedImagesLocalError.qml").toString()+":3:1: QML Text: Cannot open: " + testFileUrl("http/notexists.png").toString();
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << "";
QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << "";
QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml")
<< testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
}
void tst_qquicktext::embeddedImages()
diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml
new file mode 100644
index 0000000000..150f7bd898
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http/exists.png'>"
+}
diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml
new file mode 100644
index 0000000000..067b6d72da
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http/notexists.png'>"
+}
diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml
new file mode 100644
index 0000000000..200ded196d
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http/"
+}
diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml
new file mode 100644
index 0000000000..a823882692
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http://127.0.0.1:42332/exists.png'>"
+}
diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml
new file mode 100644
index 0000000000..c6172b68dc
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http://127.0.0.1:42332/notexists.png'>"
+}
diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml
new file mode 100644
index 0000000000..ee39e089ea
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http://127.0.0.1:42332/text.html"
+}
diff --git a/tests/auto/qtquick2/qquicktextedit/data/http/exists.png b/tests/auto/qtquick2/qquicktextedit/data/http/exists.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/qtquick2/qquicktextedit/data/http/exists.png
Binary files differ
diff --git a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp
index 40dc438c15..1d63145b2f 100644
--- a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -51,6 +51,7 @@
#include <QtGui/qguiapplication.h>
#include <private/qquicktextedit_p.h>
#include <private/qquicktextedit_p_p.h>
+#include <private/qquicktext_p_p.h>
#include <QFontMetrics>
#include <QtQuick/QQuickView>
#include <QDir>
@@ -97,6 +98,7 @@ public:
tst_qquicktextedit();
private slots:
+ void cleanup();
void text();
void width();
void wrap();
@@ -173,6 +175,10 @@ private slots:
void undo_keypressevents_data();
void undo_keypressevents();
+ void baseUrl();
+ void embeddedImages();
+ void embeddedImages_data();
+
void emptytags_QTBUG_22058();
private:
@@ -296,6 +302,13 @@ tst_qquicktextedit::tst_qquicktextedit()
//
}
+void tst_qquicktextedit::cleanup()
+{
+ // ensure not even skipped tests with custom input context leave it dangling
+ QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
+ inputPanelPrivate->testContext = 0;
+}
+
void tst_qquicktextedit::text()
{
{
@@ -616,6 +629,10 @@ void tst_qquicktextedit::hAlign()
void tst_qquicktextedit::hAlign_RightToLeft()
{
+ PlatformInputContext platformInputContext;
+ QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
+ inputPanelPrivate->testContext = &platformInputContext;
+
QQuickView canvas(testFileUrl("horizontalAlignment_RightToLeft.qml"));
QQuickTextEdit *textEdit = canvas.rootObject()->findChild<QQuickTextEdit*>("text");
QVERIFY(textEdit != 0);
@@ -716,24 +733,40 @@ void tst_qquicktextedit::hAlign_RightToLeft()
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from qApp->inputPanel()->inputDirection
textEdit->setText("");
- QCOMPARE(textEdit->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ?
- QQuickTextEdit::AlignLeft : QQuickTextEdit::AlignRight);
- if (qApp->inputPanel()->inputDirection() == Qt::LeftToRight)
- QVERIFY(textEdit->positionToRectangle(0).x() < canvas.width()/2);
- else
- QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2);
- textEdit->setHAlign(QQuickTextEdit::AlignRight);
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ QVERIFY(qApp->inputPanel()->inputDirection() == Qt::LeftToRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+ QVERIFY(textEdit->positionToRectangle(0).x() < canvas.width()/2);
+
+ QSignalSpy cursorRectangleSpy(textEdit, SIGNAL(cursorRectangleChanged()));
+
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QCOMPARE(cursorRectangleSpy.count(), 1);
+ QVERIFY(qApp->inputPanel()->inputDirection() == Qt::RightToLeft);
QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2);
- // alignment of TextEdit with no text set to it
- QString componentStr = "import QtQuick 2.0\nTextEdit {}";
- QDeclarativeComponent textComponent(&engine);
- textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
- QCOMPARE(textObject->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ?
- QQuickTextEdit::AlignLeft : QQuickTextEdit::AlignRight);
- delete textObject;
+ // set input direction while having content
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textEdit->setText("a");
+ textEdit->setCursorPosition(1);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QTest::keyClick(&canvas, Qt::Key_Backspace);
+ QVERIFY(textEdit->text().isEmpty());
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->cursorRectangle().left() > canvas.width()/2);
+
+ // input direction changed while not having focus
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textEdit->setFocus(false);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ textEdit->setFocus(true);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->cursorRectangle().left() > canvas.width()/2);
+
+ textEdit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2);
}
void tst_qquicktextedit::vAlign()
@@ -2077,7 +2110,7 @@ void tst_qquicktextedit::textInput()
QVERIFY(edit->hasActiveFocus() == true);
// test that input method event is committed and change signal is emitted
- QSignalSpy spy(edit, SIGNAL(textChanged(QString)));
+ QSignalSpy spy(edit, SIGNAL(textChanged()));
QInputMethodEvent event;
event.setCommitString( "Hello world!", 0, 0);
QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
@@ -2804,7 +2837,7 @@ void tst_qquicktextedit::insert()
QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged()));
QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
- QSignalSpy textSpy(textEdit, SIGNAL(textChanged(QString)));
+ QSignalSpy textSpy(textEdit, SIGNAL(textChanged()));
QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged()));
textEdit->insert(insertPosition, insertText);
@@ -3049,7 +3082,7 @@ void tst_qquicktextedit::remove()
QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged()));
QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
- QSignalSpy textSpy(textEdit, SIGNAL(textChanged(QString)));
+ QSignalSpy textSpy(textEdit, SIGNAL(textChanged()));
QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged()));
textEdit->remove(removeStart, removeEnd);
@@ -3626,6 +3659,76 @@ void tst_qquicktextedit::undo_keypressevents()
QVERIFY(textEdit->text().isEmpty());
}
+void tst_qquicktextedit::baseUrl()
+{
+ QUrl localUrl("file:///tests/text.qml");
+ QUrl remoteUrl("http://qt.nokia.com/test.qml");
+
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\n TextEdit {}", localUrl);
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit *>(textComponent.create());
+
+ QCOMPARE(textObject->baseUrl(), localUrl);
+
+ QSignalSpy spy(textObject, SIGNAL(baseUrlChanged()));
+
+ textObject->setBaseUrl(localUrl);
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 0);
+
+ textObject->setBaseUrl(remoteUrl);
+ QCOMPARE(textObject->baseUrl(), remoteUrl);
+ QCOMPARE(spy.count(), 1);
+
+ textObject->resetBaseUrl();
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::embeddedImages_data()
+{
+ QTest::addColumn<QUrl>("qmlfile");
+ QTest::addColumn<QString>("error");
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocal.qml") << "";
+ QTest::newRow("local-error") << testFileUrl("embeddedImagesLocalError.qml")
+ << testFileUrl("embeddedImagesLocalError.qml").toString()+":3:1: QML TextEdit: Cannot open: " + testFileUrl("http/notexists.png").toString();
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << "";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << "";
+ QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml")
+ << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML TextEdit: Error downloading http://127.0.0.1:42332/notexists.png - server replied: Not found";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
+}
+
+void tst_qquicktextedit::embeddedImages()
+{
+ QFETCH(QUrl, qmlfile);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(42332);
+ server.serveDirectory(testFile("http"));
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toLatin1());
+
+ QDeclarativeComponent textComponent(&engine, qmlfile);
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QTRY_COMPARE(QQuickTextEditPrivate::get(textObject)->document->resourcesLoading(), 0);
+
+ QPixmap pm(testFile("http/exists.png"));
+ if (error.isEmpty()) {
+ QCOMPARE(textObject->width(), double(pm.width()));
+ QCOMPARE(textObject->height(), double(pm.height()));
+ } else {
+ QVERIFY(16 != pm.width()); // check test is effective
+ QCOMPARE(textObject->width(), 16.0); // default size of QTextDocument broken image icon
+ QCOMPARE(textObject->height(), 16.0);
+ }
+
+ delete textObject;
+}
+
void tst_qquicktextedit::emptytags_QTBUG_22058()
{
QQuickView canvas(testFileUrl("qtbug-22058.qml"));
diff --git a/tests/auto/qtquick2/qquicktextinput/data/validators.qml b/tests/auto/qtquick2/qquicktextinput/data/validators.qml
index 0a074ce7dc..0ba87e0592 100644
--- a/tests/auto/qtquick2/qquicktextinput/data/validators.qml
+++ b/tests/auto/qtquick2/qquicktextinput/data/validators.qml
@@ -4,19 +4,26 @@ Item {
property variant intInput: intInput
property variant dblInput: dblInput
property variant strInput: strInput
+ property variant unvalidatedInput: unvalidatedInput
width: 800; height: 600;
Column{
TextInput { id: intInput;
+ property bool acceptable: acceptableInput
validator: IntValidator{top: 11; bottom: 2}
}
TextInput { id: dblInput;
+ property bool acceptable: acceptableInput
validator: DoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: DoubleValidator.StandardNotation}
}
TextInput { id: strInput;
+ property bool acceptable: acceptableInput
validator: RegExpValidator { regExp: /[a-zA-z]{2,4}/ }
}
+ TextInput { id: unvalidatedInput
+ property bool acceptable: acceptableInput
+ }
}
}
diff --git a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
index e97756f330..a4b1b1c4bd 100644
--- a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -1219,6 +1219,10 @@ void tst_qquicktextinput::horizontalAlignment()
void tst_qquicktextinput::horizontalAlignment_RightToLeft()
{
+ PlatformInputContext platformInputContext;
+ QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
+ inputPanelPrivate->testContext = &platformInputContext;
+
QQuickView canvas(testFileUrl("horizontalAlignment_RightToLeft.qml"));
QQuickTextInput *textInput = canvas.rootObject()->findChild<QQuickTextInput*>("text");
QVERIFY(textInput != 0);
@@ -1314,26 +1318,42 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft()
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from QInputPanel::inputDirection()
textInput->setText("");
- QCOMPARE(textInput->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ?
- QQuickTextInput::AlignLeft : QQuickTextInput::AlignRight);
- if (qApp->inputPanel()->inputDirection() == Qt::LeftToRight) {
- QCOMPARE(textInputPrivate->boundingRect.left() - textInputPrivate->hscroll, qreal(0));
- } else {
- QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1);
- QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1);
- }
- textInput->setHAlign(QQuickTextInput::AlignRight);
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ QVERIFY(qApp->inputPanel()->inputDirection() == Qt::LeftToRight);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
+ QCOMPARE(textInputPrivate->boundingRect.left() - textInputPrivate->hscroll, qreal(0));
+
+ QSignalSpy cursorRectangleSpy(textInput, SIGNAL(cursorRectangleChanged()));
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QVERIFY(qApp->inputPanel()->inputDirection() == Qt::RightToLeft);
+ QCOMPARE(cursorRectangleSpy.count(), 1);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1);
+ QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1);
+
+ // set input direction while having content
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textInput->setText("a");
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QTest::keyClick(&canvas, Qt::Key_Backspace);
+ QVERIFY(textInput->text().isEmpty());
QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1);
QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1);
- QString componentStr = "import QtQuick 2.0\nTextInput {}";
- QDeclarativeComponent textComponent(&engine);
- textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create());
- QCOMPARE(textObject->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ?
- QQuickTextInput::AlignLeft : QQuickTextInput::AlignRight);
- delete textObject;
+ // input direction changed while not having focus
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textInput->setFocus(false);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ textInput->setFocus(true);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1);
+ QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1);
+
+ textInput->setHAlign(QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1);
+ QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1);
}
void tst_qquicktextinput::verticalAlignment()
@@ -1553,139 +1573,217 @@ void tst_qquicktextinput::validators()
QQuickTextInput *intInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("intInput")));
QVERIFY(intInput);
+ QSignalSpy intSpy(intInput, SIGNAL(acceptableInputChanged()));
intInput->setFocus(true);
QTRY_VERIFY(intInput->hasActiveFocus());
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QCOMPARE(intInput->property("acceptable").toBool(), false);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(intInput->text(), QLatin1String("1"));
QCOMPARE(intInput->hasAcceptableInput(), false);
+ QCOMPARE(intInput->property("acceptable").toBool(), false);
+ QCOMPARE(intSpy.count(), 0);
QTest::keyPress(&canvas, Qt::Key_2);
QTest::keyRelease(&canvas, Qt::Key_2, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(intInput->text(), QLatin1String("1"));
QCOMPARE(intInput->hasAcceptableInput(), false);
+ QCOMPARE(intInput->property("acceptable").toBool(), false);
+ QCOMPARE(intSpy.count(), 0);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QCOMPARE(intInput->text(), QLatin1String("11"));
QCOMPARE(intInput->hasAcceptableInput(), true);
+ QCOMPARE(intInput->property("acceptable").toBool(), true);
+ QCOMPARE(intSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_0);
QTest::keyRelease(&canvas, Qt::Key_0, Qt::NoModifier ,10);
QTest::qWait(50);
QCOMPARE(intInput->text(), QLatin1String("11"));
QCOMPARE(intInput->hasAcceptableInput(), true);
+ QCOMPARE(intInput->property("acceptable").toBool(), true);
+ QCOMPARE(intSpy.count(), 1);
QQuickTextInput *dblInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("dblInput")));
- QTRY_VERIFY(dblInput);
+ QVERIFY(dblInput);
+ QSignalSpy dblSpy(dblInput, SIGNAL(acceptableInputChanged()));
dblInput->setFocus(true);
QVERIFY(dblInput->hasActiveFocus() == true);
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("1"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 0);
QTest::keyPress(&canvas, Qt::Key_2);
QTest::keyRelease(&canvas, Qt::Key_2, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12"));
QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_Period);
QTest::keyRelease(&canvas, Qt::Key_Period, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12."));
QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12.1"));
QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12.11"));
QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12.11"));
QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
// Ensure the validator doesn't prevent characters being removed.
dblInput->setValidator(intInput->validator());
QCOMPARE(dblInput->text(), QLatin1String("12.11"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
QTest::keyPress(&canvas, Qt::Key_Backspace);
QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12.1"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
// Once unacceptable input is in anything goes until it reaches an acceptable state again.
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12.11"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblSpy.count(), 2);
QTest::keyPress(&canvas, Qt::Key_Backspace);
QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12.1"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
QTest::keyPress(&canvas, Qt::Key_Backspace);
QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12."));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
QTest::keyPress(&canvas, Qt::Key_Backspace);
QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("12"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
QTest::keyPress(&canvas, Qt::Key_Backspace);
QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(dblInput->text(), QLatin1String("1"));
QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QCOMPARE(dblInput->text(), QLatin1String("11"));
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblSpy.count(), 3);
QQuickTextInput *strInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("strInput")));
- QTRY_VERIFY(strInput);
+ QVERIFY(strInput);
+ QSignalSpy strSpy(strInput, SIGNAL(acceptableInputChanged()));
strInput->setFocus(true);
QVERIFY(strInput->hasActiveFocus() == true);
+ QCOMPARE(strInput->hasAcceptableInput(), false);
+ QCOMPARE(strInput->property("acceptable").toBool(), false);
QTest::keyPress(&canvas, Qt::Key_1);
QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(strInput->text(), QLatin1String(""));
QCOMPARE(strInput->hasAcceptableInput(), false);
+ QCOMPARE(strInput->property("acceptable").toBool(), false);
+ QCOMPARE(strSpy.count(), 0);
QTest::keyPress(&canvas, Qt::Key_A);
QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(strInput->text(), QLatin1String("a"));
QCOMPARE(strInput->hasAcceptableInput(), false);
+ QCOMPARE(strInput->property("acceptable").toBool(), false);
+ QCOMPARE(strSpy.count(), 0);
QTest::keyPress(&canvas, Qt::Key_A);
QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(strInput->text(), QLatin1String("aa"));
QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_A);
QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(strInput->text(), QLatin1String("aaa"));
QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_A);
QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(strInput->text(), QLatin1String("aaaa"));
QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
QTest::keyPress(&canvas, Qt::Key_A);
QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10);
QTest::qWait(50);
QTRY_COMPARE(strInput->text(), QLatin1String("aaaa"));
QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
+
+ QQuickTextInput *unvalidatedInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("unvalidatedInput")));
+ QVERIFY(unvalidatedInput);
+ QSignalSpy unvalidatedSpy(unvalidatedInput, SIGNAL(acceptableInputChanged()));
+ unvalidatedInput->setFocus(true);
+ QVERIFY(unvalidatedInput->hasActiveFocus() == true);
+ QCOMPARE(unvalidatedInput->hasAcceptableInput(), true);
+ QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true);
+ QTest::keyPress(&canvas, Qt::Key_1);
+ QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1"));
+ QCOMPARE(unvalidatedInput->hasAcceptableInput(), true);
+ QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true);
+ QCOMPARE(unvalidatedSpy.count(), 0);
+ QTest::keyPress(&canvas, Qt::Key_A);
+ QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1a"));
+ QCOMPARE(unvalidatedInput->hasAcceptableInput(), true);
+ QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true);
+ QCOMPARE(unvalidatedSpy.count(), 0);
}
void tst_qquicktextinput::inputMethods()
diff --git a/tests/auto/qtquick2/qquickview/tst_qquickview.cpp b/tests/auto/qtquick2/qquickview/tst_qquickview.cpp
index 69052108cf..0b575c67a1 100644
--- a/tests/auto/qtquick2/qquickview/tst_qquickview.cpp
+++ b/tests/auto/qtquick2/qquickview/tst_qquickview.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
index 96fd85b63b..d9a429cd9b 100644
--- a/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
+++ b/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -1147,9 +1147,9 @@ template <int N> void tst_qquickvisualdatamodel::groups_verify(
QCOMPARE(evaluate<bool>(delegate, "test6"), vMember[i]);
QCOMPARE(evaluate<int>(delegate, "test7") , sIndex[i]);
QCOMPARE(evaluate<bool>(delegate, "test8"), sMember[i]);
- QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("items") , QBool(true));
- QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("visible") , QBool(vMember[i]));
- QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("selected"), QBool(sMember[i]));
+ QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("items") , bool(true));
+ QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("visible") , bool(vMember[i]));
+ QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("selected"), bool(sMember[i]));
}
failed = false;
}
diff --git a/tests/auto/qtquick2/qtquick2.pro b/tests/auto/qtquick2/qtquick2.pro
index 0756ddf9ca..8b8c5c9b9e 100644
--- a/tests/auto/qtquick2/qtquick2.pro
+++ b/tests/auto/qtquick2/qtquick2.pro
@@ -24,6 +24,7 @@ PRIVATETESTS += \
!contains(QT_CONFIG,xmlpatterns):PRIVATETESTS -= qdeclarativexmllistmodel
QUICKTESTS = \
+ qquickaccessible \
qquickanchors \
qquickanimatedimage \
qquickborderimage \