aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro3
-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 -> 211 bytes
-rw-r--r--tests/auto/qquickimaginestyle/test-assets/button-background-2.pngbin0 -> 211 bytes
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp14
6 files changed, 62 insertions, 7 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/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..244b707b
--- /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..54f5ecd8
--- /dev/null
+++ b/tests/auto/qquickimaginestyle/test-assets/button-background-2.png
Binary files differ
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index 4d238663..8a8cd143 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -1197,9 +1197,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));
@@ -1215,9 +1217,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"));