aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-11-25 12:39:58 +0100
committerLiang Qi <liang.qi@qt.io>2019-11-25 12:45:06 +0000
commit2bd4f5cd587e258227c69b3124757d7b8e019c9f (patch)
tree6a7cf839b51658b0ca527c57cf0af155a95c4fc7 /tests
parent864eada35653075f49e8b683ba3fd7fdf3f38256 (diff)
parente57f66dc77985eae1023da526ef39d6b3e040255 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/controls/data/tst_splitview.qml102
-rw-r--r--tests/auto/controls/data/tst_swipeview.qml49
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml22
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/16x16/actions/appointment-new.pngbin897 -> 839 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new.pngbin1146 -> 1040 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new@2x.pngbin256 -> 107 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new.pngbin1411 -> 1268 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new@2x.pngbin4075 -> 4017 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original.pngbin1105 -> 1047 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original@2x.pngbin173 -> 107 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted.pngbin1111 -> 1053 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted@2x.pngbin172 -> 107 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/+testselector/appointment-new.pngbin256 -> 107 bytes
-rw-r--r--tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/appointment-new.pngbin4075 -> 4017 bytes
-rw-r--r--tests/auto/qquickimaginestyle/control-assets/button-background.9.pngbin251 -> 138 bytes
-rw-r--r--tests/auto/qquickimaginestyle/data/tst_imagine.qml48
-rw-r--r--tests/auto/qquickimaginestyle/qquickimaginestyle.pro4
-rw-r--r--tests/auto/qquickimaginestyle/test-assets/button-background-1.pngbin0 -> 101 bytes
-rw-r--r--tests/auto/qquickimaginestyle/test-assets/button-background-2.pngbin0 -> 101 bytes
-rw-r--r--tests/auto/qquickmenubar/data/checkHighlightWhenDismissed.qml93
-rw-r--r--tests/auto/qquickmenubar/tst_qquickmenubar.cpp58
-rw-r--r--tests/auto/qquickninepatchimage/data/foo.9.pngbin213 -> 139 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/foo@2x.9.pngbin295 -> 153 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/foo@3x.9.pngbin377 -> 174 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/foo@4x.9.pngbin482 -> 185 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-all.9.pngbin245 -> 169 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-all@2x.9.pngbin341 -> 209 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-all@3x.9.pngbin470 -> 236 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-all@4x.9.pngbin577 -> 265 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-bottomright.9.pngbin246 -> 185 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-bottomright@2x.9.pngbin348 -> 222 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-bottomright@3x.9.pngbin460 -> 249 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-bottomright@4x.9.pngbin565 -> 281 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-topleft.9.pngbin227 -> 155 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-topleft@2x.9.pngbin305 -> 183 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-topleft@3x.9.pngbin420 -> 205 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/inset-topleft@4x.9.pngbin516 -> 225 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/padding.9.pngbin226 -> 162 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/padding@2x.9.pngbin298 -> 153 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/padding@3x.9.pngbin381 -> 176 bytes
-rw-r--r--tests/auto/qquickninepatchimage/data/padding@4x.9.pngbin485 -> 187 bytes
-rw-r--r--tests/auto/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml16
-rw-r--r--tests/auto/qquickpopup/data/tabFence.qml97
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp89
-rw-r--r--tests/manual/systemtrayicon/images/qt_logo_green_256.pngbin3977 -> 3118 bytes
46 files changed, 557 insertions, 24 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d528b848..8612e2c1 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -30,3 +30,6 @@ SUBDIRS += \
revisions \
sanity \
snippets
+
+# Requires lrelease, which isn't always available in CI.
+qtHaveModule(tools): translation
diff --git a/tests/auto/controls/data/tst_splitview.qml b/tests/auto/controls/data/tst_splitview.qml
index a03c09a0..c125b99e 100644
--- a/tests/auto/controls/data/tst_splitview.qml
+++ b/tests/auto/controls/data/tst_splitview.qml
@@ -146,24 +146,14 @@ TestCase {
implicitWidth: defaultHorizontalHandleWidth
implicitHeight: defaultVerticalHandleHeight
color: "#444"
- }
- }
-
- SplitView {
- id: dummyHorizontalSplitView
- handle: handleComponent
-
- Item { objectName: "dummyItem" }
- Item { objectName: "dummyItem" }
- }
-
- SplitView {
- id: dummyVerticalSplitView
- orientation: Qt.Vertical
- handle: handleComponent
- Item { objectName: "dummyItem" }
- Item { objectName: "dummyItem" }
+ Text {
+ text: parent.x + "," + parent.y + " " + parent.width + "x" + parent.height
+ color: "white"
+ anchors.centerIn: parent
+ rotation: 90
+ }
+ }
}
Component {
@@ -851,6 +841,36 @@ TestCase {
}
}
+ Component {
+ id: repeaterSplitViewComponent
+
+ SplitView {
+ anchors.fill: parent
+ handle: handleComponent
+
+ property alias repeater: repeater
+
+ Repeater {
+ id: repeater
+ model: 3
+ delegate: Rectangle {
+ objectName: "rectDelegate" + index
+
+ SplitView.preferredWidth: 25
+
+ color: "#aaff0000"
+
+ Text {
+ text: parent.x + "," + parent.y + " " + parent.width + "x" + parent.height
+ color: "white"
+ rotation: 90
+ anchors.centerIn: parent
+ }
+ }
+ }
+ }
+ }
+
function test_dragHandle_data() {
var splitViewWidth = testCase.width - splitViewMargins * 2
var splitViewHeight = testCase.height - splitViewMargins * 2
@@ -1109,6 +1129,28 @@ TestCase {
{ x: 25 + 100 + defaultHorizontalHandleWidth, y: 0, width: defaultHorizontalHandleWidth, height: splitViewHeight },
{ x: 25 + 100 + defaultHorizontalHandleWidth * 2, y: 0, width: splitViewWidth - 100, height: splitViewHeight }
]
+ },
+ {
+ tag: "repeater",
+ component: repeaterSplitViewComponent,
+ orientation: Qt.Horizontal,
+ fillIndex: 2,
+ handleIndex: 1,
+ newHandlePos: Qt.point(200, testCase.height / 2),
+ expectedGeometriesBeforeDrag: [
+ { x: 0, y: 0, width: 25, height: splitViewHeight },
+ { x: 25, y: 0, width: defaultHorizontalHandleWidth, height: splitViewHeight },
+ { x: 25 + defaultHorizontalHandleWidth, y: 0, width: 25, height: splitViewHeight },
+ { x: 25 * 2 + defaultHorizontalHandleWidth, y: 0, width: defaultHorizontalHandleWidth, height: splitViewHeight },
+ { x: 25 * 2 + defaultHorizontalHandleWidth * 2, y: 0, width: splitViewWidth - 70 , height: splitViewHeight }
+ ],
+ expectedGeometriesAfterDrag: [
+ { x: 0, y: 0, width: 25, height: splitViewHeight },
+ { x: 25, y: 0, width: defaultHorizontalHandleWidth, height: splitViewHeight },
+ { x: 25 + defaultHorizontalHandleWidth, y: 0, width: 105, height: splitViewHeight },
+ { x: 140, y: 0, width: defaultHorizontalHandleWidth, height: splitViewHeight },
+ { x: 150, y: 0, width: 150, height: splitViewHeight }
+ ]
}
]
return data
@@ -1139,6 +1181,7 @@ TestCase {
var targetHandle = handles[data.handleIndex]
mousePress(targetHandle)
verify(control.resizing)
+ // newHandlePos is in scene coordinates, so map it to coordinates local to the handle.
var localPos = testCase.mapToItem(targetHandle, data.newHandlePos.x, data.newHandlePos.y)
mouseMove(targetHandle, localPos.x - targetHandle.width / 2, localPos.y - targetHandle.height / 2)
verify(control.resizing)
@@ -1958,4 +2001,29 @@ TestCase {
mouseRelease(targetHandle, -100, targetHandle.height / 2, Qt.LeftButton)
verify(!control.resizing)
}
+
+ Component {
+ id: oneItemComponent
+
+ SplitView {
+ Item {}
+ }
+ }
+
+ // QTBUG-79270
+ function test_hideSplitViewWithOneItem() {
+ var control = createTemporaryObject(oneItemComponent, testCase)
+ verify(control)
+ // Shouldn't be an assertion failure.
+ control.visible = false
+ }
+
+ // QTBUG-79302: ensure that the Repeater's items are actually generated.
+ // test_dragHandle:repeater tests dragging behavior with a Repeater.
+ function test_repeater(data) {
+ var control = createTemporaryObject(repeaterSplitViewComponent, testCase)
+ verify(control)
+ compare(control.repeater.count, 3)
+ compare(control.contentChildren.length, 3)
+ }
}
diff --git a/tests/auto/controls/data/tst_swipeview.qml b/tests/auto/controls/data/tst_swipeview.qml
index 38af37f7..5775491c 100644
--- a/tests/auto/controls/data/tst_swipeview.qml
+++ b/tests/auto/controls/data/tst_swipeview.qml
@@ -574,4 +574,53 @@ TestCase {
compare(control.itemAt(i).x, 0)
}
}
+
+ Component {
+ id: focusSwipeViewComponent
+
+ SwipeView {
+ id: swipeView
+ anchors.fill: parent
+ focus: true
+
+ property int pressCount
+ property int releaseCount
+ property int rectanglePressCount
+ property int rectangleReleaseCount
+
+ Rectangle {
+ focus: true
+
+ Keys.onPressed: ++swipeView.rectanglePressCount
+ Keys.onReleased: ++swipeView.rectangleReleaseCount
+ }
+
+ Keys.onPressed: ++pressCount
+ Keys.onReleased: ++releaseCount
+ }
+ }
+
+ function test_focus() {
+ if (Qt.styleHints.tabFocusBehavior !== Qt.TabFocusAllControls)
+ skip("This platform only allows tab focus for text controls")
+
+ var control = createTemporaryObject(focusSwipeViewComponent, testCase)
+ verify(control)
+ compare(control.focus, true)
+ compare(control.contentItem.focus, true)
+ compare(control.itemAt(0).focus, true)
+ compare(control.itemAt(0).activeFocus, true)
+
+ keyPress(Qt.Key_A)
+ compare(control.pressCount, 1)
+ compare(control.releaseCount, 0)
+ compare(control.rectanglePressCount, 1)
+ compare(control.rectangleReleaseCount, 0)
+
+ keyRelease(Qt.Key_A)
+ compare(control.pressCount, 1)
+ compare(control.releaseCount, 1)
+ compare(control.rectanglePressCount, 1)
+ compare(control.rectangleReleaseCount, 1)
+ }
}
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index 70579c70..d98a7cc8 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -421,4 +421,26 @@ TestCase {
compare(button2.down, false)
tryCompare(button2.ToolTip, "visible", false)
}
+
+ Component {
+ id: wrapComponent
+
+ Item {
+ ToolTip.text: "This is some very very very very very very very very very very very very"
+ + " very very very very very very very very very very very very very very"
+ + " very very very very very very very very very very very very long text"
+ }
+ }
+
+ // QTBUG-62350
+ function test_wrap() {
+ var item = createTemporaryObject(wrapComponent, testCase)
+ verify(item)
+
+ // Avoid "cannot find window to popup in" warning that can occur if it's made visible too early.
+ item.ToolTip.visible = true
+ tryCompare(item.ToolTip.toolTip, "opened", true)
+ compare(item.ToolTip.toolTip.contentItem.wrapMode, Text.Wrap)
+ verify(item.ToolTip.toolTip.contentItem.width < item.ToolTip.toolTip.contentItem.implicitWidth)
+ }
}
diff --git a/tests/auto/qquickiconimage/icons/testtheme/16x16/actions/appointment-new.png b/tests/auto/qquickiconimage/icons/testtheme/16x16/actions/appointment-new.png
index 18b7c678..4356af95 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/16x16/actions/appointment-new.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/16x16/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new.png
index c6ceca43..d3134a55 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new@2x.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new@2x.png
index f380ebb6..250b94b0 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new@2x.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/+testselector/appointment-new@2x.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new.png
index d676ffd4..04cd010a 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new@2x.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new@2x.png
index 63ae9ce7..a63bbaf4 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new@2x.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/appointment-new@2x.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original.png
index 2d876cc1..c17d1664 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original@2x.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original@2x.png
index c65fbed0..d4411658 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original@2x.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-original@2x.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted.png
index 220a313d..6f7938e3 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted@2x.png b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted@2x.png
index cd66ef69..9215fc42 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted@2x.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22/actions/color-test-tinted@2x.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/+testselector/appointment-new.png b/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/+testselector/appointment-new.png
index f380ebb6..250b94b0 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/+testselector/appointment-new.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/+testselector/appointment-new.png
Binary files differ
diff --git a/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/appointment-new.png b/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/appointment-new.png
index 63ae9ce7..a63bbaf4 100644
--- a/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/appointment-new.png
+++ b/tests/auto/qquickiconimage/icons/testtheme/22x22@2/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qquickimaginestyle/control-assets/button-background.9.png b/tests/auto/qquickimaginestyle/control-assets/button-background.9.png
index 29bd8d7c..18ec9e6f 100644
--- a/tests/auto/qquickimaginestyle/control-assets/button-background.9.png
+++ b/tests/auto/qquickimaginestyle/control-assets/button-background.9.png
Binary files differ
diff --git a/tests/auto/qquickimaginestyle/data/tst_imagine.qml b/tests/auto/qquickimaginestyle/data/tst_imagine.qml
index 03bb9602..b9078d78 100644
--- a/tests/auto/qquickimaginestyle/data/tst_imagine.qml
+++ b/tests/auto/qquickimaginestyle/data/tst_imagine.qml
@@ -54,6 +54,7 @@ import QtTest 1.1
import QtQuick.Templates 2.12 as T
import QtQuick.Controls 2.12
import QtQuick.Controls.Imagine 2.12
+import QtQuick.Controls.Imagine.impl 2.12
TestCase {
id: testCase
@@ -105,4 +106,51 @@ TestCase {
verify(control)
compare(control.font.pixelSize, 80)
}
+
+ Component {
+ id: ninePatchImageComponent
+
+ NinePatchImage {
+ property alias mouseArea: mouseArea
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ // The name of the images isn't important; we just want to check that
+ // going from regular to 9-patch to regular to regular works without crashing.
+ onPressed: parent.source = "qrc:/control-assets/button-background.9.png"
+ onReleased: parent.source = "qrc:/test-assets/button-background-1.png"
+ onClicked: parent.source = "qrc:/test-assets/button-background-2.png"
+ }
+ }
+ }
+
+ Component {
+ id: signalSpyComponent
+
+ SignalSpy {}
+ }
+
+ // QTBUG-78790
+ function test_switchBetween9PatchAndRegular() {
+ var ninePatchImage = createTemporaryObject(ninePatchImageComponent, testCase,
+ { source: "qrc:/test-assets/button-background-1.png" })
+ verify(ninePatchImage)
+
+ var clickSpy = signalSpyComponent.createObject(ninePatchImage,
+ { target: ninePatchImage.mouseArea, signalName: "clicked" })
+ verify(clickSpy.valid)
+
+ var afterRenderingSpy = signalSpyComponent.createObject(ninePatchImage,
+ { target: testCase.Window.window, signalName: "afterRendering" })
+ verify(afterRenderingSpy.valid)
+
+ mousePress(ninePatchImage)
+ // Wait max 1 second - in reality it should take a handful of milliseconds.
+ afterRenderingSpy.wait(1000)
+ mouseRelease(ninePatchImage)
+ compare(clickSpy.count, 1)
+ // Shouldn't result in a crash.
+ afterRenderingSpy.wait(1000)
+ }
}
diff --git a/tests/auto/qquickimaginestyle/qquickimaginestyle.pro b/tests/auto/qquickimaginestyle/qquickimaginestyle.pro
index c421f2dc..4b1a309a 100644
--- a/tests/auto/qquickimaginestyle/qquickimaginestyle.pro
+++ b/tests/auto/qquickimaginestyle/qquickimaginestyle.pro
@@ -7,7 +7,9 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2.conf \
- $$PWD/control-assets/button-background.9.png
+ $$PWD/control-assets/button-background.9.png \
+ $$PWD/test-assets/button-background-1.png \
+ $$PWD/test-assets/button-background-2.png
OTHER_FILES += \
$$PWD/data/*.qml
diff --git a/tests/auto/qquickimaginestyle/test-assets/button-background-1.png b/tests/auto/qquickimaginestyle/test-assets/button-background-1.png
new file mode 100644
index 00000000..980eec3c
--- /dev/null
+++ b/tests/auto/qquickimaginestyle/test-assets/button-background-1.png
Binary files differ
diff --git a/tests/auto/qquickimaginestyle/test-assets/button-background-2.png b/tests/auto/qquickimaginestyle/test-assets/button-background-2.png
new file mode 100644
index 00000000..8e2639d0
--- /dev/null
+++ b/tests/auto/qquickimaginestyle/test-assets/button-background-2.png
Binary files differ
diff --git a/tests/auto/qquickmenubar/data/checkHighlightWhenDismissed.qml b/tests/auto/qquickmenubar/data/checkHighlightWhenDismissed.qml
new file mode 100644
index 00000000..072fa6b1
--- /dev/null
+++ b/tests/auto/qquickmenubar/data/checkHighlightWhenDismissed.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** 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
+
+ApplicationWindow {
+ width: 300
+ height: 300
+ visible: true
+ MenuBar {
+ id: mb
+ objectName: "menuBar"
+ width: parent.width
+ Menu {
+ title: "StaticMenu"
+ MenuItem {
+ text: "Cut"
+ }
+ MenuItem {
+ text: "Copy"
+ }
+ MenuItem {
+ text: "Paste"
+ }
+ }
+ }
+ Component {
+ id: cmp
+ Menu {
+ title: "DynamicMenu"
+ MenuItem {
+ text: "Cut"
+ }
+ MenuItem {
+ text: "Copy"
+ }
+ MenuItem {
+ text: "Paste"
+ }
+ }
+ }
+ Component.onCompleted: {
+ mb.addMenu(cmp.createObject(mb))
+ }
+}
diff --git a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp
index 9a22d26f..2fb1a02b 100644
--- a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp
+++ b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp
@@ -60,6 +60,7 @@ private slots:
void keys();
void mnemonics();
void addRemove();
+ void checkHighlightWhenMenuDismissed();
};
void tst_qquickmenubar::delegate()
@@ -564,6 +565,63 @@ void tst_qquickmenubar::addRemove()
QVERIFY(menuBarItem1.isNull());
}
+void tst_qquickmenubar::checkHighlightWhenMenuDismissed()
+{
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Mouse highlight not functional on offscreen/minimal platforms");
+
+ QQmlApplicationEngine engine(testFileUrl("checkHighlightWhenDismissed.qml"));
+ QScopedPointer<QQuickApplicationWindow> window(qobject_cast<QQuickApplicationWindow *>(engine.rootObjects().value(0)));
+ QVERIFY(window);
+
+ centerOnScreen(window.data());
+ moveMouseAway(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+
+ QQuickMenuBar *menuBar = window->findChild<QQuickMenuBar *>("menuBar");
+ QVERIFY(menuBar);
+
+ QQuickMenu *staticMenu = menuBar->menuAt(0);
+ QQuickMenu *dynamicMenu = menuBar->menuAt(1);
+ QVERIFY(staticMenu && dynamicMenu);
+ QQuickMenuBarItem *staticMenuBarItem = qobject_cast<QQuickMenuBarItem *>(staticMenu->parentItem());
+ QQuickMenuBarItem *dynamicMenuBarItem = qobject_cast<QQuickMenuBarItem *>(dynamicMenu->parentItem());
+ QVERIFY(staticMenuBarItem && dynamicMenuBarItem);
+
+ // highlight the static MenuBarItem and open the menu
+ QTest::mouseMove(window.data(), staticMenuBarItem->mapToScene(
+ QPointF(staticMenuBarItem->width() / 2, staticMenuBarItem->height() / 2)).toPoint());
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier,
+ staticMenuBarItem->mapToScene(QPointF(staticMenuBarItem->width() / 2, staticMenuBarItem->height() / 2)).toPoint());
+ QCOMPARE(staticMenuBarItem->isHighlighted(), true);
+ QCOMPARE(staticMenu->isVisible(), true);
+ QTRY_COMPARE(staticMenu->isOpened(), true);
+
+ // click a menu item to dismiss the menu and unhighlight the static MenuBarItem
+ QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(staticMenu->itemAt(0));
+ QVERIFY(menuItem);
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier,
+ menuItem->mapToScene(QPointF(menuItem->width() / 2, menuItem->height() / 2)).toPoint());
+ QCOMPARE(staticMenuBarItem->isHighlighted(), false);
+
+ // highlight the dynamic MenuBarItem and open the menu
+ QTest::mouseMove(window.data(), dynamicMenuBarItem->mapToScene(
+ QPointF(dynamicMenuBarItem->width() / 2, dynamicMenuBarItem->height() / 2)).toPoint());
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier,
+ dynamicMenuBarItem->mapToScene(QPointF(dynamicMenuBarItem->width() / 2, dynamicMenuBarItem->height() / 2)).toPoint());
+ QCOMPARE(dynamicMenuBarItem->isHighlighted(), true);
+ QCOMPARE(dynamicMenu->isVisible(), true);
+ QTRY_COMPARE(dynamicMenu->isOpened(), true);
+
+ // click a menu item to dismiss the menu and unhighlight the dynamic MenuBarItem
+ menuItem = qobject_cast<QQuickMenuItem *>(dynamicMenu->itemAt(0));
+ QVERIFY(menuItem);
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier,
+ menuItem->mapToScene(QPointF(menuItem->width() / 2, menuItem->height() / 2)).toPoint());
+ QCOMPARE(dynamicMenuBarItem->isHighlighted(), false);
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_qquickmenubar)
#include "tst_qquickmenubar.moc"
diff --git a/tests/auto/qquickninepatchimage/data/foo.9.png b/tests/auto/qquickninepatchimage/data/foo.9.png
index 51246990..bac09a4d 100644
--- a/tests/auto/qquickninepatchimage/data/foo.9.png
+++ b/tests/auto/qquickninepatchimage/data/foo.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/foo@2x.9.png b/tests/auto/qquickninepatchimage/data/foo@2x.9.png
index c8dc30a3..43e4b478 100644
--- a/tests/auto/qquickninepatchimage/data/foo@2x.9.png
+++ b/tests/auto/qquickninepatchimage/data/foo@2x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/foo@3x.9.png b/tests/auto/qquickninepatchimage/data/foo@3x.9.png
index 00ea4e05..4d199c84 100644
--- a/tests/auto/qquickninepatchimage/data/foo@3x.9.png
+++ b/tests/auto/qquickninepatchimage/data/foo@3x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/foo@4x.9.png b/tests/auto/qquickninepatchimage/data/foo@4x.9.png
index ea73340a..018b8341 100644
--- a/tests/auto/qquickninepatchimage/data/foo@4x.9.png
+++ b/tests/auto/qquickninepatchimage/data/foo@4x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-all.9.png b/tests/auto/qquickninepatchimage/data/inset-all.9.png
index e08ef9c7..a1899429 100644
--- a/tests/auto/qquickninepatchimage/data/inset-all.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-all.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-all@2x.9.png b/tests/auto/qquickninepatchimage/data/inset-all@2x.9.png
index 96d1c0e8..d00d719c 100644
--- a/tests/auto/qquickninepatchimage/data/inset-all@2x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-all@2x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-all@3x.9.png b/tests/auto/qquickninepatchimage/data/inset-all@3x.9.png
index 215ce27e..6130fd50 100644
--- a/tests/auto/qquickninepatchimage/data/inset-all@3x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-all@3x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-all@4x.9.png b/tests/auto/qquickninepatchimage/data/inset-all@4x.9.png
index 35e53101..2c2d1694 100644
--- a/tests/auto/qquickninepatchimage/data/inset-all@4x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-all@4x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-bottomright.9.png b/tests/auto/qquickninepatchimage/data/inset-bottomright.9.png
index c4c37dff..2b3e58cb 100644
--- a/tests/auto/qquickninepatchimage/data/inset-bottomright.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-bottomright.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-bottomright@2x.9.png b/tests/auto/qquickninepatchimage/data/inset-bottomright@2x.9.png
index 3d64036f..70aceb61 100644
--- a/tests/auto/qquickninepatchimage/data/inset-bottomright@2x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-bottomright@2x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-bottomright@3x.9.png b/tests/auto/qquickninepatchimage/data/inset-bottomright@3x.9.png
index 115184d9..032400ce 100644
--- a/tests/auto/qquickninepatchimage/data/inset-bottomright@3x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-bottomright@3x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-bottomright@4x.9.png b/tests/auto/qquickninepatchimage/data/inset-bottomright@4x.9.png
index 2ec7cbef..d5cf85aa 100644
--- a/tests/auto/qquickninepatchimage/data/inset-bottomright@4x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-bottomright@4x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-topleft.9.png b/tests/auto/qquickninepatchimage/data/inset-topleft.9.png
index 9cc5f43d..05a2ff70 100644
--- a/tests/auto/qquickninepatchimage/data/inset-topleft.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-topleft.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-topleft@2x.9.png b/tests/auto/qquickninepatchimage/data/inset-topleft@2x.9.png
index a4ca2b12..a88f87a5 100644
--- a/tests/auto/qquickninepatchimage/data/inset-topleft@2x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-topleft@2x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-topleft@3x.9.png b/tests/auto/qquickninepatchimage/data/inset-topleft@3x.9.png
index 73f3595a..16349d22 100644
--- a/tests/auto/qquickninepatchimage/data/inset-topleft@3x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-topleft@3x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/inset-topleft@4x.9.png b/tests/auto/qquickninepatchimage/data/inset-topleft@4x.9.png
index 78baa463..160fab61 100644
--- a/tests/auto/qquickninepatchimage/data/inset-topleft@4x.9.png
+++ b/tests/auto/qquickninepatchimage/data/inset-topleft@4x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/padding.9.png b/tests/auto/qquickninepatchimage/data/padding.9.png
index 5b4f0960..8a65afad 100644
--- a/tests/auto/qquickninepatchimage/data/padding.9.png
+++ b/tests/auto/qquickninepatchimage/data/padding.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/padding@2x.9.png b/tests/auto/qquickninepatchimage/data/padding@2x.9.png
index 44eb1943..101fc0cb 100644
--- a/tests/auto/qquickninepatchimage/data/padding@2x.9.png
+++ b/tests/auto/qquickninepatchimage/data/padding@2x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/padding@3x.9.png b/tests/auto/qquickninepatchimage/data/padding@3x.9.png
index d1563448..e07a93a2 100644
--- a/tests/auto/qquickninepatchimage/data/padding@3x.9.png
+++ b/tests/auto/qquickninepatchimage/data/padding@3x.9.png
Binary files differ
diff --git a/tests/auto/qquickninepatchimage/data/padding@4x.9.png b/tests/auto/qquickninepatchimage/data/padding@4x.9.png
index e86cce69..a3506444 100644
--- a/tests/auto/qquickninepatchimage/data/padding@4x.9.png
+++ b/tests/auto/qquickninepatchimage/data/padding@4x.9.png
Binary files differ
diff --git a/tests/auto/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml b/tests/auto/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml
new file mode 100644
index 00000000..b9606eb2
--- /dev/null
+++ b/tests/auto/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.13
+import QtQuick.Window 2.13
+import QtQuick.Controls 2.13
+
+Window {
+ width: 400
+ height: 400
+ Popup {
+ objectName: "popup"
+ visible: true
+ width: 200
+ height: 200
+ anchors.centerIn: parent
+ closePolicy: Popup.CloseOnEscape
+ }
+}
diff --git a/tests/auto/qquickpopup/data/tabFence.qml b/tests/auto/qquickpopup/data/tabFence.qml
new file mode 100644
index 00000000..2cf408e9
--- /dev/null
+++ b/tests/auto/qquickpopup/data/tabFence.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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.15
+import QtQuick.Layouts 1.15
+import QtQuick.Window 2.15
+import QtQuick.Controls 2.15
+
+ApplicationWindow {
+ width: 400
+ height: 400
+ objectName: "Rectangle"
+
+ property alias dialog: dialog
+ property alias outsideButton1: outsideButton1
+ property alias outsideButton2: outsideButton2
+ property alias dialogButton1: dialogButton1
+ property alias dialogButton2: dialogButton2
+
+ ColumnLayout {
+ Button {
+ id: outsideButton1
+ text: "Button1"
+ }
+ Button {
+ id: outsideButton2
+ text: "Button2"
+ }
+ }
+
+ Dialog {
+ id: dialog
+ objectName: "Dialog"
+ width: 200
+ height: 200
+ anchors.centerIn: parent
+ visible: true
+
+ ColumnLayout {
+ Button {
+ id: dialogButton1
+ text: "Button3"
+ }
+ Button {
+ id: dialogButton2
+ text: "Button4"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index e1e2c470..fc2ac881 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -82,6 +82,7 @@ private slots:
void cursorShape();
void componentComplete();
void closeOnEscapeWithNestedPopups();
+ void closeOnEscapeWithVisiblePopup();
void enabled();
void orientation_data();
void orientation();
@@ -91,6 +92,7 @@ private slots:
void countChanged();
void toolTipCrashOnClose();
void setOverlayParentToNull();
+ void tabFence();
};
void tst_QQuickPopup::initTestCase()
@@ -906,6 +908,8 @@ void tst_QQuickPopup::cursorShape()
// which is itself over an item with a different shape.
QQuickApplicationHelper helper(this, QStringLiteral("cursor.qml"));
QQuickApplicationWindow *window = helper.appWindow;
+ centerOnScreen(window);
+ moveMouseAway(window);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1020,6 +1024,21 @@ void tst_QQuickPopup::closeOnEscapeWithNestedPopups()
QCOMPARE(stackView->depth(), 1);
}
+void tst_QQuickPopup::closeOnEscapeWithVisiblePopup()
+{
+ QQuickApplicationHelper helper(this, QStringLiteral("closeOnEscapeWithVisiblePopup.qml"));
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickPopup *popup = window->findChild<QQuickPopup *>("popup");
+ QVERIFY(popup);
+ QTRY_VERIFY(popup->isOpened());
+
+ QTest::keyClick(window, Qt::Key_Escape);
+ QTRY_VERIFY(!popup->isVisible());
+}
+
void tst_QQuickPopup::enabled()
{
QQuickPopup popup;
@@ -1199,9 +1218,11 @@ void tst_QQuickPopup::toolTipCrashOnClose()
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.");
+ // The warning only occurs with debug builds for some reason.
+ // In any case, the warning is irrelevant, but using ShaderEffectSource is important, so we ignore it.
+#ifdef QT_DEBUG
+ QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+#endif
QVERIFY(QTest::qWaitForWindowActive(window));
QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2));
@@ -1217,9 +1238,9 @@ void tst_QQuickPopup::setOverlayParentToNull()
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.");
+#ifdef QT_DEBUG
+ QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+#endif
QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(QMetaObject::invokeMethod(window, "nullifyOverlayParent"));
@@ -1231,6 +1252,62 @@ void tst_QQuickPopup::setOverlayParentToNull()
// While nullifying the overlay parent doesn't make much sense, it shouldn't crash.
}
+void tst_QQuickPopup::tabFence()
+{
+ if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls)
+ QSKIP("This platform only allows tab focus for text controls");
+
+ QQuickApplicationHelper helper(this, "tabFence.qml");
+
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickPopup *popup = window->property("dialog").value<QQuickPopup*>();
+ QVERIFY(popup);
+ popup->open();
+ popup->setModal(true);
+
+ QQuickButton *outsideButton1 = window->property("outsideButton1").value<QQuickButton*>();
+ QVERIFY(outsideButton1);
+ QQuickButton *outsideButton2 = window->property("outsideButton2").value<QQuickButton*>();
+ QVERIFY(outsideButton2);
+ QQuickButton *dialogButton1 = window->property("dialogButton1").value<QQuickButton*>();
+ QVERIFY(dialogButton1);
+ QQuickButton *dialogButton2 = window->property("dialogButton2").value<QQuickButton*>();
+ QVERIFY(dialogButton2);
+
+ // When modal, focus loops between the two external buttons
+ outsideButton1->forceActiveFocus();
+ QVERIFY(outsideButton1->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(outsideButton2->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(outsideButton1->hasActiveFocus());
+
+ // Same thing for dialog's buttons
+ dialogButton1->forceActiveFocus();
+ QVERIFY(dialogButton1->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(dialogButton2->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(dialogButton1->hasActiveFocus());
+
+ popup->setModal(false);
+
+ // When not modal, focus goes in and out of the dialog
+ outsideButton1->forceActiveFocus();
+ QVERIFY(outsideButton1->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(outsideButton2->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(dialogButton1->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(dialogButton2->hasActiveFocus());
+ QTest::keyClick(window, Qt::Key_Tab);
+ QVERIFY(outsideButton1->hasActiveFocus());
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_QQuickPopup)
#include "tst_qquickpopup.moc"
diff --git a/tests/manual/systemtrayicon/images/qt_logo_green_256.png b/tests/manual/systemtrayicon/images/qt_logo_green_256.png
index 92243fd5..a7b16ba4 100644
--- a/tests/manual/systemtrayicon/images/qt_logo_green_256.png
+++ b/tests/manual/systemtrayicon/images/qt_logo_green_256.png
Binary files differ