diff options
-rw-r--r-- | tests/auto/controls/data/tst_button.qml | 9 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_buttongroup.qml | 33 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 34 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_control.qml | 23 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_popup.qml | 73 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_rangeslider.qml | 36 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_scrollbar.qml | 18 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 22 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_spinbox.qml | 37 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_stackview.qml | 12 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_swipeview.qml | 17 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tabbar.qml | 20 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_toolbutton.qml | 40 |
13 files changed, 92 insertions, 282 deletions
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml index f8717a88..1de43426 100644 --- a/tests/auto/controls/data/tst_button.qml +++ b/tests/auto/controls/data/tst_button.qml @@ -62,6 +62,11 @@ TestCase { } } + Component { + id: signalSpy + SignalSpy { } + } + function test_text() { var control = button.createObject(testCase) verify(control) @@ -179,8 +184,6 @@ TestCase { return "actual event:" + JSON.stringify(actual) + ", expected event:" + JSON.stringify(expected) } - SignalSpy { id: clickSpy; signalName: "clicked" } - function test_autoRepeat() { var control = button.createObject(testCase) verify(control) @@ -192,7 +195,7 @@ TestCase { control.forceActiveFocus() verify(control.activeFocus) - clickSpy.target = control + var clickSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"}) verify(clickSpy.valid) var repeatCount = 2 diff --git a/tests/auto/controls/data/tst_buttongroup.qml b/tests/auto/controls/data/tst_buttongroup.qml index bb0ffe00..754e4f0b 100644 --- a/tests/auto/controls/data/tst_buttongroup.qml +++ b/tests/auto/controls/data/tst_buttongroup.qml @@ -55,30 +55,9 @@ TestCase { ButtonGroup { } } - SignalSpy { - id: checkedButtonSpy - signalName: "checkedButtonChanged" - } - - SignalSpy { - id: buttonsSpy - signalName: "buttonsChanged" - } - - function init() { - verify(!checkedButtonSpy.target) - compare(checkedButtonSpy.count, 0) - - verify(!buttonsSpy.target) - compare(buttonsSpy.count, 0) - } - - function cleanup() { - checkedButtonSpy.target = null - checkedButtonSpy.clear() - - buttonsSpy.target = null - buttonsSpy.clear() + Component { + id: signalSpy + SignalSpy { } } function test_null() { @@ -105,7 +84,7 @@ TestCase { var group = buttonGroup.createObject(testCase) verify(group) - checkedButtonSpy.target = group + var checkedButtonSpy = signalSpy.createObject(testCase, {target: group, signalName: "checkedButtonChanged"}) verify(checkedButtonSpy.valid) verify(!group.checkedButton) @@ -176,7 +155,7 @@ TestCase { var group = buttonGroup.createObject(testCase) verify(group) - buttonsSpy.target = group + var buttonsSpy = signalSpy.createObject(testCase, {target: group, signalName: "buttonsChanged"}) verify(buttonsSpy.valid) compare(group.buttons.length, 0) @@ -301,7 +280,7 @@ TestCase { var group = buttonGroup.createObject(testCase) verify(group) - buttonsSpy.target = group + var buttonsSpy = signalSpy.createObject(testCase, {target: group, signalName: "buttonsChanged"}) verify(buttonsSpy.valid) var button1 = button.createObject(testCase, {objectName: "button1", checked: true}) diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 479b1002..97ba7ea4 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -51,16 +51,6 @@ TestCase { when: windowShown name: "ComboBox" - SignalSpy { - id: activatedSpy - signalName: "activated" - } - - SignalSpy { - id: highlightedSpy - signalName: "highlighted" - } - Component { id: signalSpy SignalSpy { } @@ -80,22 +70,6 @@ TestCase { } } - function init() { - verify(!activatedSpy.target) - compare(activatedSpy.count, 0) - - verify(!highlightedSpy.target) - compare(highlightedSpy.count, 0) - } - - function cleanup() { - activatedSpy.target = null - activatedSpy.clear() - - highlightedSpy.target = null - highlightedSpy.clear() - } - function test_defaults() { var control = comboBox.createObject(testCase) verify(control) @@ -332,10 +306,10 @@ TestCase { var control = comboBox.createObject(testCase, {model: 3}) verify(control) - activatedSpy.target = control + var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"}) verify(activatedSpy.valid) - highlightedSpy.target = control + var highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"}) verify(highlightedSpy.valid) waitForRendering(control) @@ -544,10 +518,10 @@ TestCase { var control = comboBox.createObject(testCase, {model: 3}) verify(control) - activatedSpy.target = control + var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"}) verify(activatedSpy.valid) - highlightedSpy.target = control + var highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"}) verify(highlightedSpy.valid) mouseClick(control) diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml index 4b7a60dc..9ecbed93 100644 --- a/tests/auto/controls/data/tst_control.qml +++ b/tests/auto/controls/data/tst_control.qml @@ -71,21 +71,6 @@ TestCase { SignalSpy { } } - SignalSpy { - id: mirroredSpy - signalName: "mirroredChanged" - } - - SignalSpy { - id: availableWidthSpy - signalName: "availableWidthChanged" - } - - SignalSpy { - id: availableHeightSpy - signalName: "availableHeightChanged" - } - function test_padding() { var control = component.createObject(testCase) verify(control) @@ -150,10 +135,10 @@ TestCase { var control = component.createObject(testCase) verify(control) - availableWidthSpy.target = control - availableHeightSpy.target = control - + var availableWidthSpy = signalSpy.createObject(control, {target: control, signalName: "availableWidthChanged"}) verify(availableWidthSpy.valid) + + var availableHeightSpy = signalSpy.createObject(control, {target: control, signalName: "availableHeightChanged"}) verify(availableHeightSpy.valid) var availableWidthChanges = 0 @@ -222,7 +207,7 @@ TestCase { var control = component.createObject(testCase) verify(control) - mirroredSpy.target = control + var mirroredSpy = signalSpy.createObject(control, {target: control, signalName: "mirroredChanged"}) verify(mirroredSpy.valid) control.locale = Qt.locale("en_US") diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml index 8d8f94b7..82fcbf8b 100644 --- a/tests/auto/controls/data/tst_popup.qml +++ b/tests/auto/controls/data/tst_popup.qml @@ -72,65 +72,28 @@ TestCase { Rectangle { } } - SignalSpy { - id: availableWidthSpy - signalName: "availableWidthChanged" - } - - SignalSpy { - id: availableHeightSpy - signalName: "availableHeightChanged" - } - - SignalSpy { - id: paddingSpy - signalName: "paddingChanged" - } - - SignalSpy { - id: topPaddingSpy - signalName: "topPaddingChanged" - } - - SignalSpy { - id: leftPaddingSpy - signalName: "leftPaddingChanged" - } - - SignalSpy { - id: rightPaddingSpy - signalName: "rightPaddingChanged" - } - - SignalSpy { - id: bottomPaddingSpy - signalName: "bottomPaddingChanged" - } - - SignalSpy { - id: xSpy - signalName: "xChanged" - } - - SignalSpy { - id: ySpy - signalName: "yChanged" + Component { + id: signalSpy + SignalSpy { } } function test_padding() { var control = popupTemplate.createObject(testCase) verify(control) - paddingSpy.target = control - topPaddingSpy.target = control - leftPaddingSpy.target = control - rightPaddingSpy.target = control - bottomPaddingSpy.target = control - + var paddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "paddingChanged"}) verify(paddingSpy.valid) + + var topPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "topPaddingChanged"}) verify(topPaddingSpy.valid) + + var leftPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "leftPaddingChanged"}) verify(leftPaddingSpy.valid) + + var rightPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "rightPaddingChanged"}) verify(rightPaddingSpy.valid) + + var bottomPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "bottomPaddingChanged"}) verify(bottomPaddingSpy.valid) var paddingChanges = 0 @@ -229,10 +192,10 @@ TestCase { var control = popupTemplate.createObject(testCase) verify(control) - availableWidthSpy.target = control - availableHeightSpy.target = control - + var availableWidthSpy = signalSpy.createObject(testCase, {target: control, signalName: "availableWidthChanged"}) verify(availableWidthSpy.valid) + + var availableHeightSpy = signalSpy.createObject(testCase, {target: control, signalName: "availableHeightChanged"}) verify(availableHeightSpy.valid) var availableWidthChanges = 0 @@ -302,10 +265,10 @@ TestCase { verify(control) verify(control.visible) - xSpy.target = control - ySpy.target = control - + var xSpy = signalSpy.createObject(testCase, {target: control, signalName: "xChanged"}) verify(xSpy.valid) + + var ySpy = signalSpy.createObject(testCase, {target: control, signalName: "yChanged"}) verify(ySpy.valid) // moving outside margins does not trigger change notifiers diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml index 581a079c..3167be0b 100644 --- a/tests/auto/controls/data/tst_rangeslider.qml +++ b/tests/auto/controls/data/tst_rangeslider.qml @@ -50,14 +50,9 @@ TestCase { when: windowShown name: "RangeSlider" - SignalSpy { - id: firstPressedSpy - signalName: "pressedChanged" - } - - SignalSpy { - id: secondPressedSpy - signalName: "pressedChanged" + Component { + id: signalSpy + SignalSpy { } } Component { @@ -84,21 +79,6 @@ TestCase { } } - function init() { - verify(!firstPressedSpy.target) - compare(firstPressedSpy.count, 0) - - verify(!secondPressedSpy.target) - compare(secondPressedSpy.count, 0) - } - - function cleanup() { - firstPressedSpy.target = null - firstPressedSpy.clear() - secondPressedSpy.target = null - secondPressedSpy.clear() - } - function test_defaults() { var control = sliderComponent.createObject(testCase) verify(control) @@ -303,10 +283,10 @@ TestCase { var control = sliderComponent.createObject(testCase, { orientation: data.orientation }) verify(control) - firstPressedSpy.target = control.first + var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"}) verify(firstPressedSpy.valid) - secondPressedSpy.target = control.second + var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"}) verify(secondPressedSpy.valid) mousePress(control, control.width * 0.25, control.height * 0.75, Qt.LeftButton) @@ -473,7 +453,7 @@ TestCase { var pressedCount = 0 - firstPressedSpy.target = control.first + var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"}) verify(firstPressedSpy.valid) control.first.handle.forceActiveFocus() @@ -511,7 +491,7 @@ TestCase { control.stepSize = 0.25 pressedCount = 0; - secondPressedSpy.target = control.second + var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"}) verify(secondPressedSpy.valid) control.second.handle.forceActiveFocus() @@ -553,7 +533,7 @@ TestCase { var control = sliderComponent.createObject(testCase, { leftPadding: 10, rightPadding: 20 }) verify(control) - firstPressedSpy.target = control.first + var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"}) verify(firstPressedSpy.valid) mousePress(control, control.first.handle.x, control.first.handle.y, Qt.LeftButton) diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml index 7dc60d97..f8ac936e 100644 --- a/tests/auto/controls/data/tst_scrollbar.qml +++ b/tests/auto/controls/data/tst_scrollbar.qml @@ -50,9 +50,9 @@ TestCase { when: windowShown name: "ScrollBar" - SignalSpy{ - id: pressedSpy - signalName: "pressedChanged" + Component { + id: signalSpy + SignalSpy { } } Component { @@ -72,16 +72,6 @@ TestCase { } } - function init() { - verify(!pressedSpy.target) - compare(pressedSpy.count, 0) - } - - function cleanup() { - pressedSpy.target = null - pressedSpy.clear() - } - function test_attach() { var container = flickable.createObject(testCase) verify(container) @@ -165,7 +155,7 @@ TestCase { var control = scrollBar.createObject(testCase, data.properties) verify(control) - pressedSpy.target = control + var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) verify(pressedSpy.valid) mousePress(control, 0, 0, Qt.LeftButton) diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index bec4d236..4a698076 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -50,9 +50,9 @@ TestCase { when: windowShown name: "Slider" - SignalSpy{ - id: pressedSpy - signalName: "pressedChanged" + Component { + id: signalSpy + SignalSpy { } } Component { @@ -60,16 +60,6 @@ TestCase { Slider { } } - function init() { - verify(!pressedSpy.target) - compare(pressedSpy.count, 0) - } - - function cleanup() { - pressedSpy.target = null - pressedSpy.clear() - } - function test_defaults() { var control = slider.createObject(testCase) verify(control) @@ -232,7 +222,7 @@ TestCase { var control = slider.createObject(testCase, {orientation: data.orientation}) verify(control) - pressedSpy.target = control + var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) verify(pressedSpy.valid) mousePress(control, 0, 0, Qt.LeftButton) @@ -308,7 +298,7 @@ TestCase { var pressedCount = 0 - pressedSpy.target = control + var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) verify(pressedSpy.valid) control.forceActiveFocus() @@ -380,7 +370,7 @@ TestCase { var control = slider.createObject(testCase, {leftPadding: 10, rightPadding: 20}) verify(control) - pressedSpy.target = control + var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) verify(pressedSpy.valid) mousePress(control, 0, 0, Qt.LeftButton) diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml index b370a05f..a62128d2 100644 --- a/tests/auto/controls/data/tst_spinbox.qml +++ b/tests/auto/controls/data/tst_spinbox.qml @@ -50,14 +50,9 @@ TestCase { when: windowShown name: "SpinBox" - SignalSpy{ - id: upPressedSpy - signalName: "pressedChanged" - } - - SignalSpy{ - id: downPressedSpy - signalName: "pressedChanged" + Component { + id: signalSpy + SignalSpy { } } Component { @@ -65,20 +60,6 @@ TestCase { SpinBox { } } - function init() { - verify(!upPressedSpy.target) - compare(upPressedSpy.count, 0) - verify(!downPressedSpy.target) - compare(downPressedSpy.count, 0) - } - - function cleanup() { - upPressedSpy.target = null - upPressedSpy.clear() - downPressedSpy.target = null - downPressedSpy.clear() - } - function test_defaults() { var control = spinBox.createObject(testCase) verify(control) @@ -190,9 +171,12 @@ TestCase { var control = spinBox.createObject(testCase, {stepSize: 50}) verify(control) - upPressedSpy.target = control.up + var upPressedSpy = signalSpy.createObject(control, {target: control.up, signalName: "pressedChanged"}) verify(upPressedSpy.valid) + var downPressedSpy = signalSpy.createObject(control, {target: control.down, signalName: "pressedChanged"}) + verify(downPressedSpy.valid) + mousePress(control.up.indicator) compare(upPressedSpy.count, 1) compare(control.up.pressed, true) @@ -225,9 +209,6 @@ TestCase { compare(control.down.pressed, false) compare(control.value, control.to) - downPressedSpy.target = control.down - verify(downPressedSpy.valid) - control.value = 50; mousePress(control.down.indicator) compare(downPressedSpy.count, 1) @@ -271,10 +252,10 @@ TestCase { var upPressedCount = 0 var downPressedCount = 0 - upPressedSpy.target = control.up + var upPressedSpy = signalSpy.createObject(control, {target: control.up, signalName: "pressedChanged"}) verify(upPressedSpy.valid) - downPressedSpy.target = control.down + var downPressedSpy = signalSpy.createObject(control, {target: control.down, signalName: "pressedChanged"}) verify(downPressedSpy.valid) control.forceActiveFocus() diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml index ab6ce332..28a22306 100644 --- a/tests/auto/controls/data/tst_stackview.qml +++ b/tests/auto/controls/data/tst_stackview.qml @@ -59,6 +59,11 @@ TestCase { StackView { } } + Component { + id: signalSpy + SignalSpy { } + } + function test_initialItem() { var control1 = stackView.createObject(testCase) verify(control1) @@ -87,18 +92,13 @@ TestCase { control.destroy() } - SignalSpy { - id: busySpy - signalName: "busyChanged" - } - function test_busy() { var control = stackView.createObject(testCase) verify(control) compare(control.busy, false) var busyCount = 0 - busySpy.target = control + var busySpy = signalSpy.createObject(control, {target: control, signalName: "busyChanged"}) verify(busySpy.valid) control.push(component) diff --git a/tests/auto/controls/data/tst_swipeview.qml b/tests/auto/controls/data/tst_swipeview.qml index df22bb09..3afcdf16 100644 --- a/tests/auto/controls/data/tst_swipeview.qml +++ b/tests/auto/controls/data/tst_swipeview.qml @@ -60,20 +60,16 @@ TestCase { Text { } } - SignalSpy { - id: currentItemChangedSpy - signalName: "currentItemChanged" - } - - function cleanup() { - currentItemChangedSpy.clear() - currentItemChangedSpy.target = null + Component { + id: signalSpy + SignalSpy { } } function test_current() { var control = swipeView.createObject(testCase) - currentItemChangedSpy.target = control + var currentItemChangedSpy = signalSpy.createObject(testCase, {target: control, signalName: "currentItemChanged"}) + verify(currentItemChangedSpy.valid) compare(control.count, 0) compare(control.currentIndex, -1) @@ -146,7 +142,8 @@ TestCase { control.currentIndexChanged.connect(verifyCurrentIndexCountDiff) control.countChanged.connect(verifyCurrentIndexCountDiff) - currentItemChangedSpy.target = control; + var currentItemChangedSpy = signalSpy.createObject(testCase, {target: control, signalName: "currentItemChanged"}) + verify(currentItemChangedSpy.valid) compare(control.count, 0) compare(control.currentIndex, -1) diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml index eee3205f..9268f765 100644 --- a/tests/auto/controls/data/tst_tabbar.qml +++ b/tests/auto/controls/data/tst_tabbar.qml @@ -85,19 +85,9 @@ TestCase { } } - SignalSpy { - id: contentChildrenSpy - signalName: "contentChildrenChanged" - } - - function init() { - verify(!contentChildrenSpy.target) - compare(contentChildrenSpy.count, 0) - } - - function cleanup() { - contentChildrenSpy.target = null - contentChildrenSpy.clear() + Component { + id: signalSpy + SignalSpy { } } function test_defaults() { @@ -176,7 +166,7 @@ TestCase { control.currentIndexChanged.connect(verifyCurrentIndexCountDiff) control.countChanged.connect(verifyCurrentIndexCountDiff) - contentChildrenSpy.target = control + var contentChildrenSpy = signalSpy.createObject(testCase, {target: control, signalName: "contentChildrenChanged"}) verify(contentChildrenSpy.valid) compare(control.count, 0) @@ -293,7 +283,7 @@ TestCase { return true } - contentChildrenSpy.target = control + var contentChildrenSpy = signalSpy.createObject(testCase, {target: control, signalName: "contentChildrenChanged"}) verify(contentChildrenSpy.valid) verify(compareObjectNames(control.contentData, ["object", "button1", "timer", "button2", ""])) diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml index 1417c8e2..73431ca6 100644 --- a/tests/auto/controls/data/tst_toolbutton.qml +++ b/tests/auto/controls/data/tst_toolbutton.qml @@ -50,19 +50,9 @@ TestCase { when: windowShown name: "ToolButton" - SignalSpy { - id: pressedSpy - signalName: "pressedChanged" - } - - SignalSpy { - id: downSpy - signalName: "downChanged" - } - - SignalSpy { - id: clickedSpy - signalName: "clicked" + Component { + id: signalSpy + SignalSpy { } } Component { @@ -70,20 +60,6 @@ TestCase { ToolButton { } } - function init() { - verify(!pressedSpy.target) - verify(!clickedSpy.target) - compare(pressedSpy.count, 0) - compare(clickedSpy.count, 0) - } - - function cleanup() { - pressedSpy.target = null - clickedSpy.target = null - pressedSpy.clear() - clickedSpy.clear() - } - function test_text() { var control = toolButton.createObject(testCase) verify(control) @@ -101,11 +77,13 @@ TestCase { var control = toolButton.createObject(testCase) verify(control) - pressedSpy.target = control - downSpy.target = control - clickedSpy.target = control + var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) verify(pressedSpy.valid) + + var downSpy = signalSpy.createObject(control, {target: control, signalName: "downChanged"}) verify(downSpy.valid) + + var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"}) verify(clickedSpy.valid) // check @@ -170,7 +148,7 @@ TestCase { var control = toolButton.createObject(testCase) verify(control) - clickedSpy.target = control + var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"}) verify(clickedSpy.valid) control.forceActiveFocus() |