aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/calendar/data/tst_monthgrid.qml9
-rw-r--r--tests/auto/calendar/data/tst_weeknumbercolumn.qml8
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml8
-rw-r--r--tests/auto/controls/data/tst_dial.qml18
-rw-r--r--tests/auto/controls/data/tst_textarea.qml68
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml9
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml27
-rw-r--r--tests/auto/focus/BLACKLIST3
-rw-r--r--tests/auto/focus/tst_focus.cpp8
-rw-r--r--tests/auto/qquickdrawer/tst_qquickdrawer.cpp10
-rw-r--r--tests/auto/qquickmaterialstyle/data/tst_material.qml35
-rw-r--r--tests/auto/qquickpopup/data/toolTipCrashOnClose.qml94
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp48
-rw-r--r--tests/auto/translation/data/dialogButtonBox.qml61
-rw-r--r--tests/auto/translation/qtbase_fr.ts22
-rw-r--r--tests/auto/translation/translation.pro19
-rw-r--r--tests/auto/translation/tst_translation.cpp100
17 files changed, 484 insertions, 63 deletions
diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml
index 25c8378b..6d125712 100644
--- a/tests/auto/calendar/data/tst_monthgrid.qml
+++ b/tests/auto/calendar/data/tst_monthgrid.qml
@@ -148,28 +148,29 @@ TestCase {
control.month = 0
compare(control.month, 0)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: month -1 is out of range [0...11]")
+
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month -1 is out of range \[0...11\]$/)
control.month = -1
compare(control.month, 0)
control.month = 11
compare(control.month, 11)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: month 12 is out of range [0...11]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month 12 is out of range \[0...11\]$/)
control.month = 12
compare(control.month, 11)
control.year = -271820
compare(control.year, -271820)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: year -271821 is out of range [-271820...275759]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year -271821 is out of range \[-271820...275759\]$/)
control.year = -271821
compare(control.year, -271820)
control.year = 275759
compare(control.year, 275759)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: year 275760 is out of range [-271820...275759]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year 275760 is out of range \[-271820...275759\]$/)
control.year = 275760
compare(control.year, 275759)
diff --git a/tests/auto/calendar/data/tst_weeknumbercolumn.qml b/tests/auto/calendar/data/tst_weeknumbercolumn.qml
index f94fed43..d1b50339 100644
--- a/tests/auto/calendar/data/tst_weeknumbercolumn.qml
+++ b/tests/auto/calendar/data/tst_weeknumbercolumn.qml
@@ -93,28 +93,28 @@ TestCase {
control.month = 0
compare(control.month, 0)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: month -1 is out of range [0...11]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month -1 is out of range \[0...11\]$/)
control.month = -1
compare(control.month, 0)
control.month = 11
compare(control.month, 11)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: month 12 is out of range [0...11]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month 12 is out of range \[0...11\]$/)
control.month = 12
compare(control.month, 11)
control.year = -271820
compare(control.year, -271820)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: year -271821 is out of range [-271820...275759]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year -271821 is out of range \[-271820...275759\]$/)
control.year = -271821
compare(control.year, -271820)
control.year = 275759
compare(control.year, 275759)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: year 275760 is out of range [-271820...275759]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year 275760 is out of range \[-271820...275759\]$/)
control.year = 275760
compare(control.year, 275759)
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index 80155f69..ee26a6d6 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -599,7 +599,7 @@ TestCase {
AbstractButton {
action: Action {
text: "Default"
- icon.name: "default"
+ icon.name: checked ? "checked" : "unchecked"
icon.source: "qrc:/icons/default.png"
checkable: true
checked: true
@@ -617,6 +617,7 @@ TestCase {
compare(control.checkable, true)
compare(control.checked, true)
compare(control.enabled, false)
+ compare(control.icon.name, "checked")
var textSpy = signalSpy.createObject(control, { target: control, signalName: "textChanged" })
verify(textSpy.valid)
@@ -630,6 +631,7 @@ TestCase {
compare(control.checkable, false) // propagates
compare(control.checked, false) // propagates
compare(control.enabled, true) // propagates
+ compare(control.icon.name, "unchecked") // propagates
compare(textSpy.count, 1)
// changes via button
@@ -637,19 +639,23 @@ TestCase {
control.checkable = true
control.checked = true
control.enabled = false
+ control.icon.name = "default"
compare(control.text, "Button")
compare(control.checkable, true)
compare(control.checked, true)
compare(control.enabled, false)
+ compare(control.icon.name, "default")
compare(control.action.text, "Action") // does NOT propagate
compare(control.action.checkable, true) // propagates
compare(control.action.checked, true) // propagates
compare(control.action.enabled, true) // does NOT propagate
+ compare(control.action.icon.name, control.action.checked ? "checked" : "unchecked") // does NOT propagate
compare(textSpy.count, 2)
// remove the action so that only the button's properties are left
control.action = null
compare(control.text, "Button")
+ compare(control.icon.name, "default")
compare(textSpy.count, 2)
// setting an action while button has a particular property set
diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml
index cd2f6112..86999594 100644
--- a/tests/auto/controls/data/tst_dial.qml
+++ b/tests/auto/controls/data/tst_dial.qml
@@ -470,15 +470,15 @@ TestCase {
function test_snapMode_data(immediate) {
return [
- { tag: "NoSnap", snapMode: Slider.NoSnap, from: 0, to: 2, values: [0, 0, 1], positions: [0, 0.5, 0.5] },
- { tag: "SnapAlways (0..2)", snapMode: Slider.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapAlways (1..3)", snapMode: Slider.SnapAlways, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapAlways (-1..1)", snapMode: Slider.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] },
- { tag: "SnapAlways (1..-1)", snapMode: Slider.SnapAlways, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapOnRelease (0..2)", snapMode: Slider.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapOnRelease (1..3)", snapMode: Slider.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [immediate ? 0.0 : 0.5, 0.5, 0.5] },
- { tag: "SnapOnRelease (1..-1)", snapMode: Slider.SnapOnRelease, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] }
+ { tag: "NoSnap", snapMode: Dial.NoSnap, from: 0, to: 2, values: [0, 0, 1], positions: [0, 0.5, 0.5] },
+ { tag: "SnapAlways (0..2)", snapMode: Dial.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapAlways (1..3)", snapMode: Dial.SnapAlways, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapAlways (-1..1)", snapMode: Dial.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] },
+ { tag: "SnapAlways (1..-1)", snapMode: Dial.SnapAlways, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (0..2)", snapMode: Dial.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (1..3)", snapMode: Dial.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (-1..1)", snapMode: Dial.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [immediate ? 0.0 : 0.5, 0.5, 0.5] },
+ { tag: "SnapOnRelease (1..-1)", snapMode: Dial.SnapOnRelease, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] }
]
}
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index ee40c9b7..1e455ffc 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -688,4 +688,72 @@ TestCase {
compare(control.background.width, 100)
compare(control.background.height, 100)
}
+
+ // QTBUG-76369
+ Component {
+ id: testResizeBackground
+ Item {
+ width: 200
+ height: 200
+ property alias textArea: textArea
+ ScrollView {
+ anchors.fill: parent
+ ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
+ TextArea {
+ id: textArea
+ // workaround test failing due to default insets on Imagine
+ topInset: undefined
+ leftInset: undefined
+ rightInset: undefined
+ bottomInset: undefined
+ wrapMode : TextEdit.WordWrap
+ readOnly: false
+ selectByMouse: true
+ focus: true
+ text: "test message"
+
+ background: Rectangle {
+ y: parent.height - height - textArea.bottomPadding / 2
+ implicitWidth: 120
+ height: textArea.activeFocus ? 2 : 1
+ }
+ }
+ }
+ }
+ }
+
+ function test_resize_background() {
+ var control = createTemporaryObject(testResizeBackground, testCase)
+
+ compare(control.textArea.background.width, control.width)
+ compare(control.textArea.background.height, 1)
+ control.width = 400
+ control.height = 400
+ compare(control.textArea.background.width, control.width)
+ compare(control.textArea.background.height, 1)
+ control.width = 200
+ control.height = 200
+ compare(control.textArea.background.width, control.width)
+ compare(control.textArea.background.height, 1)
+
+ // hasBackgroundWidth=true
+ control.textArea.background.width = 1
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, 1)
+ control.width = 400
+ control.height = 400
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, 1)
+ // hasBackgroundHeight=false
+ control.textArea.background.height = undefined
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, 0)
+ control.textArea.background.y = 0
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, control.height)
+ control.width = 200
+ control.height = 200
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, control.height)
+ }
}
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index 18911895..70579c70 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -205,6 +205,15 @@ TestCase {
else
control.visible = true
compare(control.visible, true)
+ // wait a bit to make sure that it's still visible
+ wait(50)
+ compare(control.visible, true)
+ // re-arm for another 200 ms
+ control.timeout = 200
+ compare(control.visible, true)
+ // ensure that it's still visible after 150 ms (where old timeout < 150 < new timeout)
+ wait(150)
+ compare(control.visible, true)
tryCompare(control, "visible", false)
}
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index c9cc10d7..5b3ef6e3 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -54,8 +54,8 @@ import QtQuick.Controls 2.12
TestCase {
id: testCase
- width: 200
- height: 200
+ width: 300
+ height: 300
visible: true
when: windowShown
name: "Tumbler"
@@ -513,6 +513,7 @@ TestCase {
Text {
text: parent.displacement.toFixed(2)
anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
}
property real displacement: Tumbler.displacement
@@ -1236,4 +1237,24 @@ TestCase {
// 5 - 2 = 3
compare(tumbler.currentIndex, 3);
}
+
+ function test_displacementAfterResizing() {
+ createTumbler({
+ width: 200,
+ wrap: false,
+ delegate: displacementDelegate,
+ model: 30,
+ visibleItemCount: 7,
+ currentIndex: 15
+ })
+
+ var delegate = findChild(tumblerView, "delegate15")
+ verify(delegate)
+
+ tryCompare(delegate, "displacement", 0)
+
+ // Resizing the Tumbler shouldn't affect the displacement.
+ tumbler.height *= 1.4
+ tryCompare(delegate, "displacement", 0)
+ }
}
diff --git a/tests/auto/focus/BLACKLIST b/tests/auto/focus/BLACKLIST
new file mode 100644
index 00000000..730d3844
--- /dev/null
+++ b/tests/auto/focus/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-78261
+[policy]
+opensuse-leap
diff --git a/tests/auto/focus/tst_focus.cpp b/tests/auto/focus/tst_focus.cpp
index 958b996b..8a1b36ad 100644
--- a/tests/auto/focus/tst_focus.cpp
+++ b/tests/auto/focus/tst_focus.cpp
@@ -232,7 +232,9 @@ void tst_focus::policy()
QVERIFY(!control->hasActiveFocus());
// Qt::WheelFocus
- QWheelEvent wheelEvent(QPoint(control->width() / 2, control->height() / 2), 10, Qt::NoButton, Qt::NoModifier);
+ QWheelEvent wheelEvent(QPointF(control->width() / 2, control->height() / 2), QPointF(),
+ QPoint(), QPoint(0, 10), Qt::NoButton, Qt::NoModifier,
+ Qt::NoScrollPhase, false);
QGuiApplication::sendEvent(control, &wheelEvent);
QVERIFY(!control->hasActiveFocus());
QVERIFY(!control->hasVisualFocus());
@@ -403,7 +405,9 @@ void tst_focus::scope()
QVERIFY(control->hasActiveFocus());
// Qt::WheelFocus
- QWheelEvent wheelEvent(QPoint(control->width() / 2, control->height() / 2), 10, Qt::NoButton, Qt::NoModifier);
+ QWheelEvent wheelEvent(QPointF(control->width() / 2, control->height() / 2), QPointF(),
+ QPoint(), QPoint(0, 10), Qt::NoButton, Qt::NoModifier,
+ Qt::NoScrollPhase, false);
QGuiApplication::sendEvent(control, &wheelEvent);
QVERIFY(!child->hasActiveFocus());
QVERIFY(control->hasActiveFocus());
diff --git a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
index 816f9b67..7644cacf 100644
--- a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
+++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
@@ -350,7 +350,8 @@ void tst_QQuickDrawer::position()
QVERIFY(drawer);
drawer->setEdge(edge);
- QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, press);
+ // Give it some time (50 ms) before the press to avoid flakiness on OpenSUSE: QTBUG-77946
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, press, 50);
QTest::mouseMove(window, from);
QTest::mouseMove(window, to);
QCOMPARE(drawer->position(), position);
@@ -403,7 +404,8 @@ void tst_QQuickDrawer::dragMargin()
int leftX = qMax<int>(0, dragMargin);
int leftDistance = startDragDistance + drawer->width() * 0.45;
QVERIFY(leftDistance > QGuiApplication::styleHints()->startDragDistance());
- QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(leftX, drawer->height() / 2));
+ // Give it some time (50 ms) before the press to avoid flakiness on OpenSUSE: QTBUG-77946
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(leftX, drawer->height() / 2), 50);
QTest::mouseMove(window, QPoint(leftX + startDragDistance, drawer->height() / 2));
QTest::mouseMove(window, QPoint(leftX + leftDistance, drawer->height() / 2));
QCOMPARE(drawer->position(), dragFromLeft);
@@ -613,7 +615,9 @@ void tst_QQuickDrawer::wheel_data()
static bool sendWheelEvent(QQuickItem *item, const QPoint &localPos, int degrees)
{
QQuickWindow *window = item->window();
- QWheelEvent wheelEvent(localPos, item->window()->mapToGlobal(localPos), QPoint(0, 0), QPoint(0, 8 * degrees), 0, Qt::Vertical, Qt::NoButton, 0);
+ QWheelEvent wheelEvent(localPos, item->window()->mapToGlobal(localPos), QPoint(0, 0),
+ QPoint(0, 8 * degrees), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase,
+ false);
QSpontaneKeyEvent::setSpontaneous(&wheelEvent);
return qGuiApp->notify(window, &wheelEvent);
}
diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml
index 45bc0dab..9f2456b8 100644
--- a/tests/auto/qquickmaterialstyle/data/tst_material.qml
+++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml
@@ -715,39 +715,4 @@ TestCase {
control.destroy()
}
-
- Component {
- id: testResizeBackground
- Item {
- width: 200
- height: 200
- property alias textArea: textArea
- ScrollView {
- anchors.fill: parent
- ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
- TextArea {
- id: textArea
- wrapMode : TextEdit.WordWrap
- readOnly: false
- selectByMouse: true
- focus: true
- text: "test message"
- }
- }
- }
- }
-
- function test_resize_background() {
- var control = testCase.createTemporaryObject(testResizeBackground, testCase)
- compare(control.textArea.background.height, 1)
- compare(control.textArea.background.width, control.width)
- control.width = 400
- control.height = 400
- compare(control.textArea.background.height, 1)
- compare(control.textArea.background.width, control.width)
- control.width = 200
- control.height = 200
- compare(control.textArea.background.height, 1)
- compare(control.textArea.background.width, control.width)
- }
}
diff --git a/tests/auto/qquickpopup/data/toolTipCrashOnClose.qml b/tests/auto/qquickpopup/data/toolTipCrashOnClose.qml
new file mode 100644
index 00000000..8de14f4c
--- /dev/null
+++ b/tests/auto/qquickpopup/data/toolTipCrashOnClose.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, 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.13
+import QtQuick.Window 2.13
+import QtQuick.Controls 2.13
+import QtGraphicalEffects 1.13
+
+Window {
+ width: 640
+ height: 480
+
+ readonly property bool toolTipOpened: mouseArea.ToolTip.toolTip.opened
+
+ Component.onCompleted: contentItem.objectName = "windowContentItem"
+
+ // For the setOverlayParentToNull test.
+ function nullifyOverlayParent() {
+ Overlay.overlay.parent = null
+ }
+
+ Item {
+ objectName: "outerItem"
+ anchors.fill: parent
+
+ Item {
+ objectName: "innerItem"
+ anchors.fill: parent
+
+ ColorOverlay {
+ objectName: "colorOverlay"
+ source: parent
+ anchors.fill: parent
+ }
+
+ MouseArea {
+ id: mouseArea
+ objectName: "mouseArea"
+ anchors.fill: parent
+ hoverEnabled: true
+
+ ToolTip.visible: containsMouse
+ ToolTip.text: "ToolTip text"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index c2f876b8..e1e2c470 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -89,6 +89,8 @@ private slots:
void disabledPalette();
void disabledParentPalette();
void countChanged();
+ void toolTipCrashOnClose();
+ void setOverlayParentToNull();
};
void tst_QQuickPopup::initTestCase()
@@ -494,7 +496,7 @@ void tst_QQuickPopup::closePolicy()
QTRY_VERIFY(popup->isOpened());
// press outside popup and its parent
- QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1));
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1), 50);
if (closePolicy.testFlag(QQuickPopup::CloseOnPressOutside) || closePolicy.testFlag(QQuickPopup::CloseOnPressOutsideParent))
QTRY_VERIFY(!popup->isVisible());
else
@@ -741,7 +743,9 @@ void tst_QQuickPopup::wheel_data()
static bool sendWheelEvent(QQuickItem *item, const QPoint &localPos, int degrees)
{
QQuickWindow *window = item->window();
- QWheelEvent wheelEvent(localPos, item->window()->mapToGlobal(localPos), QPoint(0, 0), QPoint(0, 8 * degrees), 0, Qt::Vertical, Qt::NoButton, 0);
+ QWheelEvent wheelEvent(localPos, item->window()->mapToGlobal(localPos), QPoint(0, 0),
+ QPoint(0, 8 * degrees), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase,
+ false);
QSpontaneKeyEvent::setSpontaneous(&wheelEvent);
return qGuiApp->notify(window, &wheelEvent);
}
@@ -1187,6 +1191,46 @@ void tst_QQuickPopup::countChanged()
QVERIFY(window->setProperty("isModel1", false));
QTRY_COMPARE(window->property("count").toInt(), 2);
}
+
+// QTBUG-73243
+void tst_QQuickPopup::toolTipCrashOnClose()
+{
+ QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml");
+
+ QQuickWindow *window = helper.window;
+ window->show();
+ // TODO: Using ignoreMessage() fails in CI with macOS for release builds,
+ // so for now we let the warning through.
+// QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2));
+ QTRY_VERIFY(window->property("toolTipOpened").toBool());
+
+ QVERIFY(window->close());
+ // Shouldn't crash.
+}
+
+void tst_QQuickPopup::setOverlayParentToNull()
+{
+ QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml");
+
+ QQuickWindow *window = helper.window;
+ window->show();
+ // TODO: Using ignoreMessage() fails in CI with macOS for release builds,
+ // so for now we let the warning through.
+// QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QVERIFY(QMetaObject::invokeMethod(window, "nullifyOverlayParent"));
+
+ QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2));
+ QTRY_VERIFY(window->property("toolTipOpened").toBool());
+
+ QVERIFY(window->close());
+ // While nullifying the overlay parent doesn't make much sense, it shouldn't crash.
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_QQuickPopup)
#include "tst_qquickpopup.moc"
diff --git a/tests/auto/translation/data/dialogButtonBox.qml b/tests/auto/translation/data/dialogButtonBox.qml
new file mode 100644
index 00000000..03a3ae0e
--- /dev/null
+++ b/tests/auto/translation/data/dialogButtonBox.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, 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.13
+import QtQuick.Controls 2.13
+
+Item {
+ property Dialog dialog: Dialog {
+ width: 300
+ height: 300
+ visible: true
+ standardButtons: DialogButtonBox.Save | DialogButtonBox.Discard
+ }
+}
diff --git a/tests/auto/translation/qtbase_fr.ts b/tests/auto/translation/qtbase_fr.ts
new file mode 100644
index 00000000..a2a05a07
--- /dev/null
+++ b/tests/auto/translation/qtbase_fr.ts
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fr_FR">
+<context>
+ <name>QPlatformTheme</name>
+ <message>
+ <source>Save</source>
+ <translation>Enregistrer</translation>
+ </message>
+ <message>
+ <source>Discard</source>
+ <translation>Ne pas tenir compte</translation>
+ </message>
+</context>
+<context>
+ <name>QGnomeTheme</name>
+ <message>
+ <source>&amp;Save</source>
+ <translation>&amp;Enregistrer</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/translation/translation.pro b/tests/auto/translation/translation.pro
new file mode 100644
index 00000000..d2d9d6ee
--- /dev/null
+++ b/tests/auto/translation/translation.pro
@@ -0,0 +1,19 @@
+CONFIG += testcase
+TARGET = tst_translation
+SOURCES += tst_translation.cpp
+
+macos:CONFIG -= app_bundle
+
+QT += testlib gui-private quicktemplates2-private
+
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/*.qml
+
+# We only want to run lrelease, which is why we use EXTRA_TRANSLATIONS.
+EXTRA_TRANSLATIONS = qtbase_fr.ts
+# Embed the translations in a qrc file.
+CONFIG += lrelease embed_translations
diff --git a/tests/auto/translation/tst_translation.cpp b/tests/auto/translation/tst_translation.cpp
new file mode 100644
index 00000000..9cbca915
--- /dev/null
+++ b/tests/auto/translation/tst_translation.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/qtest.h>
+#include "../shared/visualtestutil.h"
+
+#include <QtCore/qtranslator.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+#include <QtQuickTemplates2/private/qquickdialog_p.h>
+#include <QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>
+
+using namespace QQuickVisualTestUtil;
+
+class tst_translation : public QQmlDataTest
+{
+ Q_OBJECT
+
+private slots:
+ void dialogButtonBox();
+};
+
+void tst_translation::dialogButtonBox()
+{
+ QQuickView view(testFileUrl("dialogButtonBox.qml"));
+ if (view.status() != QQuickView::Ready)
+ QFAIL("Failed to load QML file");
+ view.show();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
+ QQuickDialog *dialog = view.rootObject()->property("dialog").value<QQuickDialog*>();
+ QVERIFY(dialog);
+
+ QQuickDialogButtonBox *dialogButtonBox = qobject_cast<QQuickDialogButtonBox*>(dialog->footer());
+ QVERIFY(dialogButtonBox);
+
+ QQuickAbstractButton *saveButton = dialogButtonBox->standardButton(QPlatformDialogHelper::Save);
+ QVERIFY(saveButton);
+ QString defaultSaveText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Save);
+ defaultSaveText = QPlatformTheme::removeMnemonics(defaultSaveText);
+ QCOMPARE(saveButton->text(), defaultSaveText);
+
+ QQuickAbstractButton *discardButton = dialogButtonBox->standardButton(QPlatformDialogHelper::Discard);
+ QVERIFY(discardButton);
+ QString defaultDiscardText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Discard);
+ defaultDiscardText = QPlatformTheme::removeMnemonics(defaultDiscardText);
+ QCOMPARE(discardButton->text(), defaultDiscardText);
+
+ QTranslator translator;
+ QVERIFY(translator.load(":/i18n/qtbase_fr.qm"));
+ QVERIFY(qApp->installTranslator(&translator));
+ view.engine()->retranslate();
+
+ QString translatedSaveText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Save);
+ translatedSaveText = QPlatformTheme::removeMnemonics(translatedSaveText);
+ QCOMPARE(saveButton->text(), translatedSaveText);
+
+ QString translatedDiscardText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Discard);
+ translatedDiscardText = QPlatformTheme::removeMnemonics(translatedDiscardText);
+ QCOMPARE(discardButton->text(), translatedDiscardText);
+}
+
+QTEST_MAIN(tst_translation)
+
+#include "tst_translation.moc"