aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2026-06-08 10:29:05 +0200
committerAlbert Astals Cid <aacid@kde.org>2026-09-28 21:01:19 +0000
commit0136bdc2f3ca34c60e4d2c13c020175202523344 (patch)
tree983ee611b6966dc20c79af16cc8258487fa676d5 /tests
parent83d091dcb160d3f0c4a8bc9df8b8a9a934ac82a1 (diff)
Expose 4 QScreen properties to QML
Task-number: QTBUG-147270 Change-Id: I33c6fc8cc823c1e15fa0451ad1b213aa4471f39e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickscreen/data/screen.qml6
-rw-r--r--tests/auto/quick/qquickscreen/tst_qquickscreen.cpp8
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickscreen/data/screen.qml b/tests/auto/quick/qquickscreen/data/screen.qml
index 5ae008df17..c6c354d8be 100644
--- a/tests/auto/quick/qquickscreen/data/screen.qml
+++ b/tests/auto/quick/qquickscreen/data/screen.qml
@@ -1,5 +1,5 @@
import QtQuick 2.0
-import QtQuick.Window 2.3 as Window
+import QtQuick.Window 6.13 as Window
Item {
width: 100
@@ -11,6 +11,10 @@ Item {
property real devicePixelRatio: Window.Screen.devicePixelRatio
property int vx: Window.Screen.virtualX
property int vy: Window.Screen.virtualY
+ property rect screenGeometry: Window.Screen.geometry
+ property rect screenAvailableGeometry: Window.Screen.availableGeometry
+ property rect desktopGeometry: Window.Screen.desktopGeometry
+ property rect availableDesktopGeometry: Window.Screen.availableDesktopGeometry
property int screenCount: Qt.application.screens.length
diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
index 74d50eed22..11c4c5e119 100644
--- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
+++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
@@ -49,6 +49,10 @@ void tst_qquickscreen::basicProperties()
QVERIFY(screen->devicePixelRatio() >= 1.0);
QCOMPARE(screen->geometry().x(), root->property("vx").toInt());
QCOMPARE(screen->geometry().y(), root->property("vy").toInt());
+ QCOMPARE(screen->geometry(), root->property("screenGeometry").toRect());
+ QCOMPARE(screen->availableGeometry(), root->property("screenAvailableGeometry").toRect());
+ QCOMPARE(screen->virtualGeometry(), root->property("desktopGeometry").toRect());
+ QCOMPARE(screen->availableVirtualGeometry(), root->property("availableDesktopGeometry").toRect());
QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().size());
}
@@ -105,6 +109,10 @@ void tst_qquickscreen::fullScreenList()
QCOMPARE(screenList[i]->devicePixelRatio(), info->devicePixelRatio());
QCOMPARE(screenList[i]->geometry().x(), info->virtualX());
QCOMPARE(screenList[i]->geometry().y(), info->virtualY());
+ QCOMPARE(screenList[i]->geometry(), info->geometry());
+ QCOMPARE(screenList[i]->availableGeometry(), info->availableGeometry());
+ QCOMPARE(screenList[i]->virtualGeometry(), info->desktopGeometry());
+ QCOMPARE(screenList[i]->availableVirtualGeometry(), info->availableDesktopGeometry());
}
}