diff options
author | Liang Qi <liang.qi@qt.io> | 2019-09-12 08:01:21 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-09-12 08:01:21 +0200 |
commit | c80eb38354854f2ccc7ea070a9857409acc36792 (patch) | |
tree | 806cb68b337ac7c8ab8f9a48538e6e0211f57ed8 /tests | |
parent | d38bac596946c3dd9cce3c0b4127509421dc917d (diff) | |
parent | f19ec4561b4975d68290593b599d3c38d0f9f6d3 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
src/qml/jsruntime/qv4engine.cpp
src/quick/handlers/qquicktaphandler.cpp
src/quick/items/qquicktableview.cpp
Done-With: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Done-With: Ulf Hermann <ulf.hermann@qt.io>
Done-With: Shawn Rutledge <shawn.rutledge@qt.io>
Change-Id: If9558a33f01693ce96420c094e0b57dfff0626cd
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmlcachegen/data/module.mjs | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/data/utils.mjs | 4 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/qmlcachegen.pro | 4 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp | 10 | ||||
-rw-r--r-- | tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml | 89 | ||||
-rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 27 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 23 | ||||
-rw-r--r-- | tests/manual/scenegraph_lancelot/hostinfo.sh | 76 | ||||
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp | 4 |
9 files changed, 155 insertions, 88 deletions
diff --git a/tests/auto/qml/qmlcachegen/data/module.mjs b/tests/auto/qml/qmlcachegen/data/module.mjs new file mode 100644 index 0000000000..6838766329 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/data/module.mjs @@ -0,0 +1,6 @@ + +import { helper } from "utils.mjs" + +export function entry() { + return helper() +} diff --git a/tests/auto/qml/qmlcachegen/data/utils.mjs b/tests/auto/qml/qmlcachegen/data/utils.mjs new file mode 100644 index 0000000000..25a1f38709 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/data/utils.mjs @@ -0,0 +1,4 @@ + +export function helper() { + return "ok" +} diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro index 7bd4414302..53b26ccfae 100644 --- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro +++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro @@ -15,7 +15,9 @@ RESOURCES += \ data/Enums.qml \ data/componentInItem.qml \ data/jsmoduleimport.qml \ - data/script.mjs + data/script.mjs \ + data/module.mjs \ + data/utils.mjs workerscripts_test.files = \ data/worker.js \ diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp index 102acf73d6..f89982f782 100644 --- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp +++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp @@ -65,6 +65,7 @@ private slots: void qrcScriptImport(); void fsScriptImport(); void moduleScriptImport(); + void esModulesViaQJSEngine(); void enums(); @@ -605,6 +606,15 @@ void tst_qmlcachegen::moduleScriptImport() } } +void tst_qmlcachegen::esModulesViaQJSEngine() +{ + QCOMPARE(QFileInfo(":/data/module.mjs").size(), 0); + QJSEngine engine; + QJSValue module = engine.importModule(":/data/module.mjs"); + QJSValue result = module.property("entry").call(); + QCOMPARE(result.toString(), "ok"); +} + void tst_qmlcachegen::enums() { QQmlEngine engine; diff --git a/tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml b/tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml new file mode 100644 index 0000000000..ecc79a9368 --- /dev/null +++ b/tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Window 2.3 + +Item { + width: 640 + height: 450 + + property alias tableView: tableView + property real delegateSize: 10 + property int hideRow: -1 + + TableView { + id: tableView + width: 600 + height: 400 + anchors.margins: 1 + clip: true + delegate: tableViewDelegate + columnSpacing: 1 + rowSpacing: 1 + columnWidthProvider: function(column) { + return -1 + } + rowHeightProvider: function(row) { + if (row === hideRow) + return 0 + return -1 + } + } + + Component { + id: tableViewDelegate + Rectangle { + objectName: "tableViewDelegate" + implicitWidth: row === 0 ? 10 : delegateSize + implicitHeight: column === 0 ? 10 : delegateSize + color: "lightgray" + border.width: 1 + + Text { + id: textItem + anchors.centerIn: parent + text: model.display + renderType: Text.NativeRendering + } + } + } + +} + diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 19967efcd9..889175a228 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -119,6 +119,7 @@ private slots: void checkRowHeightProviderNegativeReturnValue(); void checkRowHeightProviderNotCallable(); void checkForceLayoutFunction(); + void checkForceLayoutEndUpDoingALayout(); void checkContentWidthAndHeight(); void checkPageFlicking(); void checkExplicitContentWidthAndHeight(); @@ -560,6 +561,32 @@ void tst_QQuickTableView::checkForceLayoutFunction() QCOMPARE(fxItem->item->width(), newColumnWidth); } +void tst_QQuickTableView::checkForceLayoutEndUpDoingALayout() +{ + // QTBUG-77074 + // Check that we change the implicit size of the delegate after + // the initial loading, and at the same time hide some rows or + // columns, and then do a forceLayout(), we end up with a + // complete relayout that respects the new implicit size. + LOAD_TABLEVIEW("tweakimplicitsize.qml"); + + auto model = TestModelAsVariant(10, 10); + + tableView->setModel(model); + + WAIT_UNTIL_POLISHED; + + const qreal newDelegateSize = 20; + view->rootObject()->setProperty("delegateSize", newDelegateSize); + // Hide a row, just to force the following relayout to + // do a complete reload (and not just a relayout) + view->rootObject()->setProperty("hideRow", 1); + tableView->forceLayout(); + + for (auto fxItem : tableViewPrivate->loadedItems) + QCOMPARE(fxItem->item->height(), newDelegateSize); +} + void tst_QQuickTableView::checkContentWidthAndHeight() { // Check that contentWidth/Height reports the correct size of the diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 33a6b829bc..facd63027e 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2106,30 +2106,31 @@ void tst_qquicktextedit::mouseSelection() textEditObject->setFocus(focus); textEditObject->setFocusOnPress(focusOnPress); + // Avoid that the last click from the previous test data and the first click in the + // current test data happens so close in time that they are interpreted as a double click. + static const int moreThanDoubleClickInterval = QGuiApplication::styleHints()->mouseDoubleClickInterval() + 1; + // press-and-drag-and-release from x1 to x2 QPoint p1 = textEditObject->positionToRectangle(from).center().toPoint(); QPoint p2 = textEditObject->positionToRectangle(to).center().toPoint(); if (clicks == 2) - QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1, moreThanDoubleClickInterval); else if (clicks == 3) - QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1); + QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1, moreThanDoubleClickInterval); + // cancel the 500ms delta QTestLib adds in order to properly synthesize a triple click within the required interval + QTest::lastMouseTimestamp -= QTest::mouseDoubleClickInterval; QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1); - if (clicks == 2) { - // QTBUG-50022: Since qtbase commit beef975, QTestLib avoids generating - // double click events by adding 500ms delta to release event timestamps. - // Send a double click event by hand to ensure the correct sequence: - // press, release, press, _dbl click_, move, release. - QMouseEvent dblClickEvent(QEvent::MouseButtonDblClick, p1, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QGuiApplication::sendEvent(textEditObject, &dblClickEvent); - } QTest::mouseMove(&window, p2); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2); QTRY_COMPARE(textEditObject->selectedText(), selectedText); // Clicking and shift to clicking between the same points should select the same text. textEditObject->setCursorPosition(0); - if (clicks > 1) + if (clicks > 1) { QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1); + // cancel the 500ms delta QTestLib adds in order to properly synthesize a triple click within the required interval + QTest::lastMouseTimestamp -= QTest::mouseDoubleClickInterval; + } if (clicks != 2) QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1); QTest::mouseClick(&window, Qt::LeftButton, Qt::ShiftModifier, p2); diff --git a/tests/manual/scenegraph_lancelot/hostinfo.sh b/tests/manual/scenegraph_lancelot/hostinfo.sh deleted file mode 100644 index 6bad2ba467..0000000000 --- a/tests/manual/scenegraph_lancelot/hostinfo.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the QtQml module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -# printProperty(): prints a key-value pair from given key and cmd list. -# If running cmd fails, or does not produce any stdout, nothing is printed. -# Arguments: $1: key, $2: cmd, $3: optional, field specification as to cut(1) -f -printProperty () -{ - key=$1 - val=`{ eval $2 ; } 2>/dev/null` - [ -n "$3" ] && val=`echo $val | tr -s '[:blank:]' '\t' | cut -f$3` - [ -n "$val" ] && echo $key: $val -} - -# printEnvVar(): prints a key-value pair from given environment variable name. -# key is printed as "Env_<varname>". -# If the variable is undefined, nothing is printed. -# Arguments: $1: varname - -printEnvVar () -{ - key=Env_$1 - val=`eval 'echo $'$1` - [ -n "$val" ] && echo $key: $val -} - - -# printOnOff(): prints a key-value pair from given environment variable name. -# If variable is defined, value is printed as "<key>-On"; otherwise "<key>-Off". -# Arguments: $1: key $2: varname - -printOnOff () -{ - key=$1 - val=`eval 'echo $'$2` - if [ -z "$val" ] ; then - val=Off - else - val=On - fi - echo $key: $key-$val -} - -# ------------ - -printProperty Uname "uname -a" - -printProperty WlanMAC "ifconfig wlan0 | grep HWaddr" 5 - -printEnvVar QMLSCENE_DEVICE diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp index 3f28d90e7b..95188ec0f8 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp +++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp @@ -81,6 +81,10 @@ tst_Scenegraph::tst_Scenegraph() void tst_Scenegraph::initTestCase() { + const char *backendVarName = "QT_QUICK_BACKEND"; + const QString backend = qEnvironmentVariable(backendVarName, QString::fromLatin1("default")); + QBaselineTest::addClientProperty(QString::fromLatin1(backendVarName), backend); + QByteArray msg; if (!QBaselineTest::connectToBaselineServer(&msg)) QSKIP(msg); |