aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-03-02 13:49:11 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2017-03-02 13:49:11 +0100
commit32c1212f81fcfc7b5e49f85d68b05cd94cd90521 (patch)
tree795a3175173285f4ba5bd15cdc7ae6ec11c556d2 /tests/auto/quick
parent79d3fe1bba4589c7f5780bb505eac7872061ee32 (diff)
parent78dd18a0cd18449e1289e428ea6eca65e28fb114 (diff)
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickflickable/data/hide.qml13
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp20
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp61
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp26
-rw-r--r--tests/auto/quick/qquicklayouts/data/rowlayout/Container2.qml55
-rw-r--r--tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser2.qml46
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml10
-rw-r--r--tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml24
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp30
-rw-r--r--tests/auto/quick/qquickpositioners/data/implicitGridOneItem.qml12
-rw-r--r--tests/auto/quick/qquickpositioners/data/implicitRowOneItem.qml9
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp44
-rw-r--r--tests/auto/quick/qquickwindow/data/windowWithScreen.qml2
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp6
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp32
15 files changed, 378 insertions, 12 deletions
diff --git a/tests/auto/quick/qquickflickable/data/hide.qml b/tests/auto/quick/qquickflickable/data/hide.qml
new file mode 100644
index 0000000000..ab520549e2
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/hide.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Flickable {
+ id: flickable
+ width: 200; height: 200
+ contentWidth: 400; contentHeight: 400
+
+ MouseArea {
+ objectName: "mouseArea"
+ width: 400; height: 400
+ onDoubleClicked: flickable.visible = false
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 1ad691d1c1..9ead271bfe 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -80,6 +80,7 @@ private slots:
void disabled();
void flickVelocity();
void margins();
+ void cancelOnHide();
void cancelOnMouseGrab();
void clickAndDragWhenTransformed();
void flickTwiceUsingTouches();
@@ -1425,6 +1426,25 @@ void tst_qquickflickable::margins()
delete root;
}
+void tst_qquickflickable::cancelOnHide()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("hide.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QVERIFY(window->rootObject());
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable);
+
+ QTest::mouseDClick(window.data(), Qt::LeftButton);
+ QVERIFY(!flickable->isVisible());
+ QVERIFY(!QQuickFlickablePrivate::get(flickable)->pressed);
+}
+
void tst_qquickflickable::cancelOnMouseGrab()
{
QScopedPointer<QQuickView> window(new QQuickView);
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index 4699f947a1..2681f1a966 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -91,6 +91,8 @@ private slots:
void sourceSizeChanges();
void correctStatus();
void highdpi();
+ void highDpiFillModesAndSizes_data();
+ void highDpiFillModesAndSizes();
void hugeImages();
private:
@@ -971,6 +973,65 @@ void tst_qquickimage::highdpi()
delete obj;
}
+void tst_qquickimage::highDpiFillModesAndSizes_data()
+{
+ QTest::addColumn<QQuickImage::FillMode>("fillMode");
+ QTest::addColumn<qreal>("expectedHeightAfterSettingWidthTo100");
+ QTest::addColumn<qreal>("expectedImplicitHeightAfterSettingWidthTo100");
+ QTest::addColumn<qreal>("expectedPaintedWidthAfterSettingWidthTo100");
+ QTest::addColumn<qreal>("expectedPaintedHeightAfterSettingWidthTo100");
+
+ QTest::addRow("Stretch") << QQuickImage::Stretch << 150.0 << 150.0 << 100.0 << 150.0;
+ QTest::addRow("PreserveAspectFit") << QQuickImage::PreserveAspectFit << 100.0 << 100.0 << 100.0 << 100.0;
+ QTest::addRow("PreserveAspectCrop") << QQuickImage::PreserveAspectCrop << 150.0 << 150.0 << 150.0 << 150.0;
+ QTest::addRow("Tile") << QQuickImage::Tile << 150.0 << 150.0 << 100.0 << 150.0;
+ QTest::addRow("TileVertically") << QQuickImage::TileVertically << 150.0 << 150.0 << 100.0 << 150.0;
+ QTest::addRow("TileHorizontally") << QQuickImage::TileHorizontally << 150.0 << 150.0 << 100.0 << 150.0;
+ QTest::addRow("Pad") << QQuickImage::Pad << 150.0 << 150.0 << 150.0 << 150.0;
+}
+
+void tst_qquickimage::highDpiFillModesAndSizes()
+{
+ QFETCH(QQuickImage::FillMode, fillMode);
+ QFETCH(qreal, expectedHeightAfterSettingWidthTo100);
+ QFETCH(qreal, expectedImplicitHeightAfterSettingWidthTo100);
+ QFETCH(qreal, expectedPaintedWidthAfterSettingWidthTo100);
+ QFETCH(qreal, expectedPaintedHeightAfterSettingWidthTo100);
+
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage; }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+
+ engine.rootContext()->setContextProperty("srcImage", testFileUrl("heart-highdpi@2x.png"));
+
+ QScopedPointer<QQuickImage> image(qobject_cast<QQuickImage*>(component.create()));
+ QVERIFY(image);
+ QCOMPARE(image->width(), 150.0);
+ QCOMPARE(image->height(), 150.0);
+ QCOMPARE(image->paintedWidth(), 150.0);
+ QCOMPARE(image->paintedHeight(), 150.0);
+ QCOMPARE(image->implicitWidth(), 150.0);
+ QCOMPARE(image->implicitHeight(), 150.0);
+ QCOMPARE(image->paintedWidth(), 150.0);
+ QCOMPARE(image->paintedHeight(), 150.0);
+
+ // The implicit size should not change when setting any fillMode here.
+ image->setFillMode(fillMode);
+ QCOMPARE(image->fillMode(), fillMode);
+ QCOMPARE(image->implicitWidth(), 150.0);
+ QCOMPARE(image->implicitHeight(), 150.0);
+ QCOMPARE(image->paintedWidth(), 150.0);
+ QCOMPARE(image->paintedHeight(), 150.0);
+
+ image->setWidth(100.0);
+ QCOMPARE(image->width(), 100.0);
+ QCOMPARE(image->height(), expectedHeightAfterSettingWidthTo100);
+ QCOMPARE(image->implicitWidth(), 150.0);
+ QCOMPARE(image->implicitHeight(), expectedImplicitHeightAfterSettingWidthTo100);
+ QCOMPARE(image->paintedWidth(), expectedPaintedWidthAfterSettingWidthTo100);
+ QCOMPARE(image->paintedHeight(), expectedPaintedHeightAfterSettingWidthTo100);
+}
+
void tst_qquickimage::hugeImages()
{
QQuickView view;
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 8d974f4d17..10a3a0bfa8 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -48,7 +48,8 @@ public:
TestItem(QQuickItem *parent = 0)
: QQuickItem(parent), focused(false), pressCount(0), releaseCount(0)
, wheelCount(0), acceptIncomingTouchEvents(true)
- , touchEventReached(false), timestamp(0) {}
+ , touchEventReached(false), timestamp(0)
+ , lastWheelEventPos(0, 0), lastWheelEventGlobalPos(0, 0) {}
bool focused;
int pressCount;
@@ -57,6 +58,8 @@ public:
bool acceptIncomingTouchEvents;
bool touchEventReached;
ulong timestamp;
+ QPoint lastWheelEventPos;
+ QPoint lastWheelEventGlobalPos;
protected:
virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; }
virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
@@ -66,7 +69,13 @@ protected:
touchEventReached = true;
event->setAccepted(acceptIncomingTouchEvents);
}
- virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; timestamp = event->timestamp(); }
+ virtual void wheelEvent(QWheelEvent *event) {
+ event->accept();
+ ++wheelCount;
+ timestamp = event->timestamp();
+ lastWheelEventPos = event->pos();
+ lastWheelEventGlobalPos = event->globalPos();
+ }
};
class TestWindow: public QQuickWindow
@@ -1422,19 +1431,24 @@ void tst_qquickitem::wheelEvent()
const bool shouldReceiveWheelEvents = visible && enabled;
+ const int width = 200;
+ const int height = 200;
+
QQuickWindow window;
- window.resize(200, 200);
+ window.resize(width, height);
window.show();
QTest::qWaitForWindowExposed(&window);
TestItem *item = new TestItem;
- item->setSize(QSizeF(200, 100));
+ item->setSize(QSizeF(width, height));
item->setParentItem(window.contentItem());
item->setEnabled(enabled);
item->setVisible(visible);
- QWheelEvent event(QPoint(100, 50), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ QPoint localPoint(width / 2, height / 2);
+ QPoint globalPoint = window.mapToGlobal(localPoint);
+ QWheelEvent event(localPoint, globalPoint, -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
event.setTimestamp(123456UL);
event.setAccepted(false);
QGuiApplication::sendEvent(&window, &event);
@@ -1443,6 +1457,8 @@ void tst_qquickitem::wheelEvent()
QVERIFY(event.isAccepted());
QCOMPARE(item->wheelCount, 1);
QCOMPARE(item->timestamp, 123456UL);
+ QCOMPARE(item->lastWheelEventPos, localPoint);
+ QCOMPARE(item->lastWheelEventGlobalPos, globalPoint);
} else {
QVERIFY(!event.isAccepted());
QCOMPARE(item->wheelCount, 0);
diff --git a/tests/auto/quick/qquicklayouts/data/rowlayout/Container2.qml b/tests/auto/quick/qquicklayouts/data/rowlayout/Container2.qml
new file mode 100644
index 0000000000..248652e82b
--- /dev/null
+++ b/tests/auto/quick/qquicklayouts/data/rowlayout/Container2.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtQuick.Layouts 1.3
+
+Item {
+ objectName: "qtbug51927-container"
+ visible: true
+
+ default property alias _contents: customContent.data
+
+ ColumnLayout {
+ id: customContent
+ objectName: "qtbug51927-columnLayout"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser2.qml b/tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser2.qml
new file mode 100644
index 0000000000..9def782d4a
--- /dev/null
+++ b/tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser2.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+
+Container2 {
+ visible: true
+ Item {}
+}
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 97860458fe..4346c5283e 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -959,5 +959,15 @@ Item {
// Shouldn't crash.
containerUser.destroy();
}
+
+ function test_defaultPropertyAliasCrashAgain() {
+ var containerUserComponent = Qt.createComponent("rowlayout/ContainerUser2.qml");
+ compare(containerUserComponent.status, Component.Ready);
+
+ var containerUser = createTemporaryObject(containerUserComponent, testCase);
+ verify(containerUser);
+
+ // Shouldn't crash upon destroying containerUser.
+ }
}
}
diff --git a/tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml b/tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml
new file mode 100644
index 0000000000..2b45a19340
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 200
+
+ MouseArea {
+ id: mouseArea
+ objectName: "mouseArea"
+ width: 200
+ height: 200
+
+ drag.target: mouseArea
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: 200
+ drag.threshold: 200
+
+ Rectangle {
+ anchors.fill: parent
+ color: "red"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index c8351b9e18..01bce46ccb 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -88,6 +88,7 @@ private slots:
void invalidDrag_data() { rejectedButton_data(); }
void invalidDrag();
void cancelDragging();
+ void availableDistanceLessThanDragThreshold();
void setDragOnPressed();
void updateMouseAreaPosOnClick();
void updateMouseAreaPosOnResize();
@@ -585,6 +586,35 @@ void tst_QQuickMouseArea::cancelDragging()
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122));
}
+// QTBUG-58347
+void tst_QQuickMouseArea::availableDistanceLessThanDragThreshold()
+{
+ QQuickView view;
+ QByteArray errorMessage;
+ QVERIFY2(initView(view, testFileUrl("availableDistanceLessThanDragThreshold.qml"), true, &errorMessage),
+ errorMessage.constData());
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(view.rootObject());
+
+ QQuickMouseArea *mouseArea = view.rootObject()->findChild<QQuickMouseArea*>("mouseArea");
+ QVERIFY(mouseArea);
+
+ QPoint position(100, 100);
+ QTest::mousePress(&view, Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ position.setX(301);
+ QTest::mouseMove(&view, position);
+ position.setX(501);
+ QTest::mouseMove(&view, position);
+ QVERIFY(mouseArea->drag()->active());
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
+
+ QVERIFY(!mouseArea->drag()->active());
+ QCOMPARE(mouseArea->x(), 200.0);
+}
+
void tst_QQuickMouseArea::setDragOnPressed()
{
QQuickView window;
diff --git a/tests/auto/quick/qquickpositioners/data/implicitGridOneItem.qml b/tests/auto/quick/qquickpositioners/data/implicitGridOneItem.qml
new file mode 100644
index 0000000000..8da9fc270d
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/implicitGridOneItem.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.9
+import PositionerTest 1.0
+
+ImplicitGrid {
+ columns: 2
+ rows: 1
+
+ Text {
+ text: "Text"
+ width: parent.width
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/implicitRowOneItem.qml b/tests/auto/quick/qquickpositioners/data/implicitRowOneItem.qml
new file mode 100644
index 0000000000..25a287cf31
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/implicitRowOneItem.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.9
+import PositionerTest 1.0
+
+ImplicitRow {
+ Text {
+ text: "Text"
+ width: parent.width
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index 1b3939401a..4c4afb7a7b 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -98,6 +98,8 @@ private slots:
void test_attachedproperties();
void test_attachedproperties_data();
void test_attachedproperties_dynamic();
+ void test_useImplicitSize_oneItem_data();
+ void test_useImplicitSize_oneItem();
void populateTransitions_row();
void populateTransitions_row_data();
@@ -304,6 +306,8 @@ void tst_qquickpositioners::moveTransitions_flow_data()
tst_qquickpositioners::tst_qquickpositioners()
{
+ qmlRegisterType<QQuickImplicitRow>("PositionerTest", 1, 0, "ImplicitRow");
+ qmlRegisterType<QQuickImplicitGrid>("PositionerTest", 1, 0, "ImplicitGrid");
}
void tst_qquickpositioners::test_horizontal()
@@ -4004,6 +4008,46 @@ void tst_qquickpositioners::test_attachedproperties_dynamic()
}
+void tst_qquickpositioners::test_useImplicitSize_oneItem_data()
+{
+ QTest::addColumn<QString>("positionerType");
+
+ QTest::newRow("Grid") << "Grid";
+ QTest::newRow("Row") << "Row";
+}
+
+void tst_qquickpositioners::test_useImplicitSize_oneItem()
+{
+ QFETCH(QString, positionerType);
+
+ QQuickView view;
+ view.setSource(testFileUrl(QString::fromLatin1("implicit%1OneItem.qml").arg(positionerType)));
+ QCOMPARE(view.status(), QQuickView::Ready);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QQuickItem *positioner = view.rootObject();
+ QVERIFY(positioner);
+ const qreal oldPositionerImplicitWidth = positioner->implicitWidth();
+
+ QQuickText *text = qobject_cast<QQuickText*>(positioner->childItems().first());
+ QVERIFY(text);
+ const qreal oldTextImplicitWidth = text->implicitWidth();
+ QCOMPARE(positioner->implicitWidth(), text->implicitWidth());
+
+ // Ensure that the implicit size of the positioner changes when the implicit size
+ // of one of its children changes.
+ text->setText(QLatin1String("Even More Text"));
+ const qreal textImplicitWidthIncrease = text->implicitWidth() - oldTextImplicitWidth;
+ QVERIFY(textImplicitWidthIncrease > 0);
+ QTRY_COMPARE(positioner->implicitWidth(), oldPositionerImplicitWidth + textImplicitWidthIncrease);
+
+ // Ensure that the implicit size of the positioner does not change when the
+ // explicit size of one of its children changes.
+ text->setWidth(10);
+ QTRY_COMPARE(positioner->implicitWidth(), oldPositionerImplicitWidth + textImplicitWidthIncrease);
+}
+
QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait)
{
QQuickView *window = new QQuickView(0);
diff --git a/tests/auto/quick/qquickwindow/data/windowWithScreen.qml b/tests/auto/quick/qquickwindow/data/windowWithScreen.qml
index fdc0be3388..2a5a7b7b76 100644
--- a/tests/auto/quick/qquickwindow/data/windowWithScreen.qml
+++ b/tests/auto/quick/qquickwindow/data/windowWithScreen.qml
@@ -3,7 +3,7 @@ import QtQuick.Window 2.3 as Window
Window.Window {
color: "#00FF00"
- targetScreen: Qt.application.screens[0]
+ screen: Qt.application.screens[0]
Item {
objectName: "item"
}
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index d3f43fcd4d..578f737c4d 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -1398,12 +1398,6 @@ void tst_qquickwindow::headless()
if (isGL)
QVERIFY(!window->isSceneGraphInitialized());
}
-#if QT_CONFIG(opengl)
- if (QGuiApplication::platformName() == QLatin1String("windows")
- && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
- QSKIP("Crashes on Windows/ANGLE, QTBUG-42967");
- }
-#endif
// Destroy the native windowing system buffers
window->destroy();
QVERIFY(!window->handle());
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index bb251023c7..b02d60d0c5 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -172,6 +172,7 @@ private slots:
void touchPointDeliveryOrder();
void hoverEnabled();
+ void implicitUngrab();
protected:
bool eventFilter(QObject *, QEvent *event)
@@ -1414,6 +1415,37 @@ void tst_TouchMouse::hoverEnabled()
QVERIFY(!mouseArea2->hovered());
}
+void tst_TouchMouse::implicitUngrab()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("singleitem.qml"));
+ window->show();
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+ EventItem *eventItem = root->findChild<EventItem*>("eventItem1");
+ eventItem->acceptMouse = true;
+ QPoint p1(20, 20);
+ QTest::touchEvent(window.data(), device).press(0, p1);
+
+ QCOMPARE(window->mouseGrabberItem(), eventItem);
+ eventItem->eventList.clear();
+ eventItem->setEnabled(false);
+ QVERIFY(!eventItem->eventList.isEmpty());
+ QCOMPARE(eventItem->eventList.at(0).type, QEvent::UngrabMouse);
+ QTest::touchEvent(window.data(), device).release(0, p1); // clean up potential state
+
+ eventItem->setEnabled(true);
+ QTest::touchEvent(window.data(), device).press(0, p1);
+ eventItem->eventList.clear();
+ eventItem->setVisible(false);
+ QVERIFY(!eventItem->eventList.isEmpty());
+ QCOMPARE(eventItem->eventList.at(0).type, QEvent::UngrabMouse);
+ QTest::touchEvent(window.data(), device).release(0, p1); // clean up potential state
+}
QTEST_MAIN(tst_TouchMouse)
#include "tst_touchmouse.moc"