From 40f394ef2e06a6466445e4df54735250939084f0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 5 Jan 2015 21:00:40 +0100 Subject: Add Window.width and Window.height attached properties [ChangeLog][QtQuick] Added Window.width and Window.height attached properties Change-Id: I3ef590a0d3e6fa660ed88992d5ae843deb09c7bc Reviewed-by: Shawn Rutledge --- tests/auto/quick/qquickwindow/data/windowattached.qml | 4 ++++ tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'tests/auto/quick/qquickwindow') diff --git a/tests/auto/quick/qquickwindow/data/windowattached.qml b/tests/auto/quick/qquickwindow/data/windowattached.qml index 0e3f1d4b62..a9f052d55e 100644 --- a/tests/auto/quick/qquickwindow/data/windowattached.qml +++ b/tests/auto/quick/qquickwindow/data/windowattached.qml @@ -7,6 +7,8 @@ Rectangle { height: 100 property bool windowActive: root.Window.active property Item contentItem: root.Window.contentItem + property int windowWidth: root.Window.width + property int windowHeight: root.Window.height Text { objectName: "rectangleWindowText" anchors.centerIn: parent @@ -22,6 +24,8 @@ Rectangle { anchors.centerIn: parent text: (extraWindow.active ? "active" : "inactive") + "\nvisibility: " + Window.visibility property Item contentItem: Window.contentItem + property int windowWidth: Window.width + property int windowHeight: Window.height } } } diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 7c94cf6d17..e019c57ccb 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1978,6 +1978,8 @@ void tst_qquickwindow::attachedProperty() QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(view.rootObject()->property("windowActive").toBool()); QCOMPARE(view.rootObject()->property("contentItem").value(), view.contentItem()); + QCOMPARE(view.rootObject()->property("windowWidth").toInt(), view.width()); + QCOMPARE(view.rootObject()->property("windowHeight").toInt(), view.height()); QQuickWindow *innerWindow = view.rootObject()->findChild("extraWindow"); QVERIFY(innerWindow); @@ -1988,6 +1990,8 @@ void tst_qquickwindow::attachedProperty() QVERIFY(text); QCOMPARE(text->text(), QLatin1String("active\nvisibility: 2")); QCOMPARE(text->property("contentItem").value(), innerWindow->contentItem()); + QCOMPARE(text->property("windowWidth").toInt(), innerWindow->width()); + QCOMPARE(text->property("windowHeight").toInt(), innerWindow->height()); } class RenderJob : public QRunnable -- cgit v1.2.3