aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_popup.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-05-09 12:06:42 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-05-09 12:16:46 +0000
commitf6aed94ff0e134fe6bd2309aa5d23fa1c6250305 (patch)
tree2b1c1c5d3c5a94fe63fe9218adf001305e47953d /tests/auto/controls/data/tst_popup.qml
parenta57c31e5ed5a4b4649084aa528ed75f25d0881e1 (diff)
Popup: make x() and y() return the effective coordinates
And trigger change signals appropriately. This makes it possible for the iOS style to know where the ComboBox popup is actually positioned so it can visualize the popup curve appropriately. Change-Id: I6cec6cbf220736c658357aee10f6d31e08531ba2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_popup.qml')
-rw-r--r--tests/auto/controls/data/tst_popup.qml50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
index 6953ebbf..3e0dc274 100644
--- a/tests/auto/controls/data/tst_popup.qml
+++ b/tests/auto/controls/data/tst_popup.qml
@@ -107,6 +107,16 @@ TestCase {
signalName: "bottomPaddingChanged"
}
+ SignalSpy {
+ id: xSpy
+ signalName: "xChanged"
+ }
+
+ SignalSpy {
+ id: ySpy
+ signalName: "yChanged"
+ }
+
function test_padding() {
var control = popupTemplate.createObject(testCase)
verify(control)
@@ -287,6 +297,46 @@ TestCase {
control.destroy()
}
+ function test_position() {
+ var control = popupControl.createObject(testCase, {visible: true, leftMargin: 10, topMargin: 20, width: 100, height: 100})
+ verify(control)
+ verify(control.visible)
+
+ xSpy.target = control
+ ySpy.target = control
+
+ verify(xSpy.valid)
+ verify(ySpy.valid)
+
+ // moving outside margins does not trigger change notifiers
+ control.x = -100
+ compare(control.x, 10)
+ compare(control.y, 20)
+ compare(xSpy.count, 0)
+ compare(ySpy.count, 0)
+
+ control.y = -200
+ compare(control.x, 10)
+ compare(control.y, 20)
+ compare(xSpy.count, 0)
+ compare(ySpy.count, 0)
+
+ // moving within margins triggers change notifiers
+ control.x = 30
+ compare(control.x, 30)
+ compare(control.y, 20)
+ compare(xSpy.count, 1)
+ compare(ySpy.count, 0)
+
+ control.y = 40
+ compare(control.x, 30)
+ compare(control.y, 40)
+ compare(xSpy.count, 1)
+ compare(ySpy.count, 1)
+
+ control.destroy()
+ }
+
function test_margins() {
var control = popupControl.createObject(testCase, {width: 100, height: 100})
verify(control)