![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <QtCore/QObject>
#include <QtCore/QProperty>
#include <QtTest/QSignalSpy>
#include <QTest>
#include <private/qglobal_p.h>
#include <cstdio>
#include <memory>
#include <optional>
Go to the source code of this file.
Namespaces | |
namespace | QTestPrivate |
Macros | |
#define | QPROPERTY_TEST_COMPARISON_HELPER(actual, expected, comparator, represent) |
Typedefs | |
template<typename T> | |
using | QTestPrivate::OptionalWrapper = std::optional<T> |
Functions | |
template<typename TestedClass, typename PropertyType> | |
void | QTestPrivate::testReadWritePropertyBasics (TestedClass &instance, const PropertyType &initial, const PropertyType &changed, const char *propertyName, std::function< bool(const PropertyType &, const PropertyType &)> comparator=[](const PropertyType &lhs, const PropertyType &rhs) { return lhs==rhs;}, std::function< char *(const PropertyType &)> represent=[](const PropertyType &val) { return QTest::toString(val);}, std::function< std::unique_ptr< TestedClass >(void)> helperConstructor=[]() { return std::make_unique< TestedClass >();}) |
template<typename TestedClass, typename PropertyType> | |
void | QTestPrivate::testReadWritePropertyBasics (TestedClass &instance, const PropertyType &initial, const PropertyType &changed, const char *propertyName, std::function< std::unique_ptr< TestedClass >(void)> helperConstructor) |
template<typename TestedClass, typename PropertyType> | |
void | QTestPrivate::testWriteOncePropertyBasics (TestedClass &instance, const PropertyType &prior, const PropertyType &changed, const char *propertyName, bool bindingPreservedOnWrite=true, std::function< bool(const PropertyType &, const PropertyType &)> comparator=[](const PropertyType &lhs, const PropertyType &rhs) { return lhs==rhs;}, std::function< char *(const PropertyType &)> represent=[](const PropertyType &val) { return QTest::toString(val);}, std::function< std::unique_ptr< TestedClass >(void)> helperConstructor=[]() { return std::make_unique< TestedClass >();}) |
template<typename TestedClass, typename PropertyType> | |
void | QTestPrivate::testWriteOncePropertyBasics (TestedClass &instance, const PropertyType &prior, const PropertyType &changed, const char *propertyName, bool bindingPreservedOnWrite, std::function< std::unique_ptr< TestedClass >(void)> helperConstructor) |
template<typename TestedClass, typename PropertyType> | |
void | QTestPrivate::testReadOnlyPropertyBasics (TestedClass &instance, const PropertyType &initial, const PropertyType &changed, const char *propertyName, std::function< void()> mutator=[]() { QFAIL("Data modifier function must be provided");}, std::function< bool(const PropertyType &, const PropertyType &)> comparator=[](const PropertyType &lhs, const PropertyType &rhs) { return lhs==rhs;}, std::function< char *(const PropertyType &)> represent=[](const PropertyType &val) { return QTest::toString(val);}) |
#define QPROPERTY_TEST_COMPARISON_HELPER | ( | actual, | |
expected, | |||
comparator, | |||
represent ) |
This helper macro is used as a wrapper around \l QVERIFY2() to provide a detailed error message in case of failure. It is intended to be used only in the helper functions below.
The custom comparator method is used to check if the actual and expected values are equal or not.
The macro uses a custom represent callback to generate the string representation of actual and expected.
The error message is close to the one provided by the \l QCOMPARE() macro. Specifically the implementation is taken from the formatFailMessage()
function, which is defined in the qtestresult.cpp
file.
Definition at line 74 of file qpropertytesthelper_p.h.