diff options
author | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2019-10-11 16:30:33 +0200 |
---|---|---|
committer | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2019-10-14 14:10:47 +0200 |
commit | 3478f6c4474e86f2431c22533dbffefb48af93a9 (patch) | |
tree | f8d17d3c23409d13c99d72bafedbbcaa3f8547e0 /src | |
parent | 79d7487c89aead1a736f75a5fbf8c154c09924e0 (diff) |
Doc: Describe using QVERIFY to verify validity of QSignalSpy
From https://wiki.qt.io/Writing_Unit_Tests
Change-Id: I3186efe30cde465766800aee1f0a530fb80907fb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/testlib/qsignalspy.qdoc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc index 3352307d69..39639d0a09 100644 --- a/src/testlib/qsignalspy.qdoc +++ b/src/testlib/qsignalspy.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -48,7 +48,7 @@ \snippet code/doc_src_qsignalspy.cpp 1 - \b {Note:} Non-standard data types need to be registered, using + \note Non-standard data types need to be registered, using the qRegisterMetaType() function, before you can create a QSignalSpy. For example: @@ -57,6 +57,18 @@ To retrieve the instance, you can use qvariant_cast: \snippet code/doc_src_qsignalspy.cpp 3 + + \section1 Verifying Signal Emissions + + The QSignalSpy class provides an elegant mechanism for capturing the list + of signals emitted by an object. However, you should verify its validity + after construction. The constructor does a number of sanity checks, such as + verifying that the signal to be spied upon actually exists. To make the + diagnosis of test failures easier, the results of these checks should be + checked by calling \c QVERIFY(spy.isValid()) before proceeding further with + a test. + + \sa QVERIFY() */ /*! \fn QSignalSpy::QSignalSpy(const QObject *object, const char *signal) |