diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-25 14:54:04 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-27 11:57:56 +0000 |
commit | 5cdfc0d4dfc4be29c0e8271526058e24e9b6cc27 (patch) | |
tree | 86b051c3cccc395d5b0e795f23c9cbf1ae87c65b /tests/auto | |
parent | 763b247911cb58663c749e44064e2ab6fc3396f8 (diff) |
tst_dialog: get rid of waitForRendering()
The intention is to wait until a dialog and its content is fully open
and visible. While waitForRendering() does the job, it can sometimes
take a bit of unnecessary extra time. Using SignalSpy to wait for
opened() allows the test to continue immediately after the enter
transition is finished.
Change-Id: I86f2d524c616981148988f67dfed09c79002f7a9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_dialog.qml | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml index 6b18a323..2f3d2a6b 100644 --- a/tests/auto/controls/data/tst_dialog.qml +++ b/tests/auto/controls/data/tst_dialog.qml @@ -87,8 +87,12 @@ TestCase { function test_accept() { var control = createTemporaryObject(dialog, testCase) + var openedSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "opened"}) + verify(openedSpy.valid) + control.open() - waitForRendering(control.contentItem) + openedSpy.wait() + compare(openedSpy.count, 1) verify(control.visible) var acceptedSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "accepted"}) @@ -102,8 +106,12 @@ TestCase { function test_reject() { var control = createTemporaryObject(dialog, testCase) + var openedSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "opened"}) + verify(openedSpy.valid) + control.open() - waitForRendering(control.contentItem) + openedSpy.wait() + compare(openedSpy.count, 1) verify(control.visible) var rejectedSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rejected"}) @@ -226,8 +234,12 @@ TestCase { var control = createTemporaryObject(dialog, testCase, {width: 100, height: 100}) verify(control) + var openedSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "opened"}) + verify(openedSpy.valid) + control.open() - waitForRendering(control.contentItem) + openedSpy.wait() + compare(openedSpy.count, 1) verify(control.visible) compare(control.width, 100) @@ -315,8 +327,12 @@ TestCase { var control = createTemporaryObject(dialog, testCase, {spacing: 20, width: 100, height: 100}) verify(control) + var openedSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "opened"}) + verify(openedSpy.valid) + control.open() - waitForRendering(control.contentItem) + openedSpy.wait() + compare(openedSpy.count, 1) verify(control.visible) control.contentItem.visible = data.content |