diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-07 14:51:51 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-07 14:34:36 +0000 |
commit | c2b7e55af43518ae1898eddf8611ef617149ca8a (patch) | |
tree | 58707d28d0c8b203b02c0c69507e67498971c665 /tests/auto/controls/data/tst_control.qml | |
parent | bd1080e6a1c78bc65d01f5504bec82ad971d866f (diff) |
auto tests: prefer creating signal spies locally where needed
It is tedious to always add new static SignalSpy instances for each
tested signal. Just create signal spies locally in the same place where
they are used. This makes it much more convenient to create more signal
spies to achieve better coverage. This practice has been already used
in newly written tests.
Change-Id: I7f56c4b3cea0c55c34b85254f69a88ec73b8607f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_control.qml')
-rw-r--r-- | tests/auto/controls/data/tst_control.qml | 23 |
1 files changed, 4 insertions, 19 deletions
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") |