![]() |
Qt 6.x
The Qt SDK
|
Classes | |
class | AppNapDisabler |
Disables App Nap by registering a background activity. More... | |
Enumerations | |
enum | IdentifierPart { TestObject = 0x1 , TestFunction = 0x2 , TestDataTag = 0x4 , AllParts = 0xFFFF } |
Functions | |
bool | testDataGuiRoles (QAbstractItemModelTester *tester) |
void | generateTestIdentifier (QTestCharBuffer *identifier, int parts) |
bool | appendCharBuffer (QTestCharBuffer *accumulator, const QTestCharBuffer &more) |
static bool | isRunningArmOnX86 () |
template<typename TestedClass , typename PropertyType > | |
void | 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);}) |
template<typename TestedClass , typename PropertyType > | |
void | 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);}) |
template<typename TestedClass , typename PropertyType > | |
void | 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);}) |
void | parseBlackList () |
void | checkBlackLists (const char *slot, const char *data, const char *global) |
static bool | canHandleUnicodeFileNames () |
void | disableWindowRestore () |
bool | macCrashReporterWillShowDialog () |
Variables | |
Q_TESTLIB_EXPORT Qt::MouseButtons | qtestMouseButtons = Qt::NoButton |
Enumerator | |
---|---|
TestObject | |
TestFunction | |
TestDataTag | |
AllParts |
Definition at line 167 of file qabstracttestlogger_p.h.
bool QTestPrivate::appendCharBuffer | ( | QTestCharBuffer * | accumulator, |
const QTestCharBuffer & | more | ||
) |
Definition at line 434 of file qabstracttestlogger.cpp.
References appendCharBuffer(), QTestCharBuffer::constData(), QTestCharBuffer::data(), oldsize, qstrnlen(), and QTestCharBuffer::resize().
Referenced by QTapTestLogger::addIncident(), QTeamCityLogger::addIncident(), QTapTestLogger::addMessage(), and appendCharBuffer().
|
inlinestatic |
Definition at line 37 of file qtesthelpers_p.h.
References QFile::encodeName(), and QByteArrayLiteral.
Q_TESTLIB_EXPORT void QTestPrivate::checkBlackLists | ( | const char * | slot, |
const char * | data, | ||
const char * | global | ||
) |
Definition at line 282 of file qtestblacklist.cpp.
References global, ignoreAll, ignoredTests, and QTestResult::setBlacklistCurrentTest().
Referenced by QuickTestResult::setDataTag(), and QuickTestResult::setFunctionName().
void QTestPrivate::disableWindowRestore | ( | ) |
Disables restoration of previously saved window state. This causes tests to start with a clean slate and prevents the "previous restore failed" dialog from showing if there was a test crash.
Definition at line 20 of file qtestutil_macos.mm.
Referenced by QTest::qInit().
void Q_TESTLIB_EXPORT QTestPrivate::generateTestIdentifier | ( | QTestCharBuffer * | identifier, |
int | parts | ||
) |
Definition at line 416 of file qabstracttestlogger.cpp.
References QTestResult::currentDataTag(), QTestResult::currentGlobalDataTag(), QTestResult::currentTestFunction(), QTestResult::currentTestObjectName(), generateTestIdentifier(), QTest::qt_asprintf(), TestDataTag, TestFunction, testObject(), and TestObject.
Referenced by QJUnitTestLogger::enterTestData(), and generateTestIdentifier().
|
static |
Definition at line 48 of file qemulationdetector_p.h.
bool QTestPrivate::macCrashReporterWillShowDialog | ( | ) |
Definition at line 27 of file qtestutil_macos.mm.
Referenced by hasSystemCrashReporter().
Q_TESTLIB_EXPORT void QTestPrivate::parseBlackList | ( | ) |
Definition at line 246 of file qtestblacklist.cpp.
References QFileDevice::atEnd(), checkCondition(), function, ignoreAll, ignoredTests, QString::indexOf(), QString::isEmpty(), line, QString::mid(), QFile::open(), QTest::qFindTestData(), QStringLiteral, QIODevice::readLine(), QIODeviceBase::ReadOnly, QString::simplified(), QString::size(), QString::startsWith(), and QString::truncate().
Referenced by QTest::qInit(), and QuickTestResult::setProgramName().
|
inline |
Definition at line 58 of file qabstractitemmodeltester.h.
References Qt::BackgroundRole, QVariant::canConvert(), QSqlQueryModel::data(), Qt::DecorationRole, Qt::FontRole, Qt::ForegroundRole, QAbstractTableModel::index(), QVariant::isValid(), model, QAbstractItemModelTester::model(), MODELTESTER_VERIFY, Q_ASSERT, Q_UNUSED, and variant.
Referenced by QAbstractItemModelTesterPrivate::data().
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); } |
||
) |
Basic testing of a read-only bindable property.
This helper function tests the behavior of bindable read-only property propertyName, of type PropertyType
, in class TestedClass
. The caller must supply an instance of TestedClass
and two distinct values, initial and changed, of PropertyType
.
When this function is called, the property's value must be initial. The mutator must, when called, cause the property's value to be revised to changed.
By default {operator==()}
is used to compare values of the property and {QTest::toString()}
is used to generate proper error messages.
If such comparison is not supported for PropertyType
, or the comparison it supports is not appropriate to this property, a custom comparator can be supplied.
Apart from that, a custom represent callback can also be specified to generate a string representation of PropertyType
. If supplied, it must allocate its returned string using {new
char[]}, so that it can be used in place of \l {QTest::toString()}.
Definition at line 342 of file qpropertytesthelper_p.h.
References QFAIL.
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); } |
||
) |
Basic testing of a bindable property.
This helper function tests the behavior of bindable read/write property propertyName, of type PropertyType
, in class TestedClass
. The caller must supply an instance of TestedClass
and two distinct values, initial and changed, of PropertyType
.
Since the first part of the test sets the property to initial, it {must not} be the default value of the property, or the check that it was set will be vacuous.
By default {operator==()}
is used to compare values of the property and {QTest::toString()}
is used to generate proper error messages.
If such comparison is not supported for PropertyType
, or the comparison it supports is not appropriate to this property, a custom comparator can be supplied.
Apart from that, a custom represent callback can also be specified to generate a string representation of PropertyType
. If supplied, it must allocate its returned string using {new
char[]}, so that it can be used in place of \l {QTest::toString()}.
Definition at line 97 of file qpropertytesthelper_p.h.
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); } |
||
) |
Basic testing of a bindable property that is writable only once.
The write-once properties are writable properties which accept only one valid setting of the value ("write"), after which later attempts are ignored.
This helper function tests the behavior of bindable write-once property propertyName, of type PropertyType
, in class TestedClass
. The caller must supply an instance of TestedClass
and two distinct values, initial and changed, of PropertyType
.
The property of instance must not yet have been set when this function is called. The value it has before being set should be passed as prior and a distinct value, that this test can set it to, as changed.
The bindingPreservedOnWrite parameter controls whether this function expects the binding set by this function to be preserved when setting a value directly. The default value is 'true'.
By default {operator==()}
is used to compare values of the property and {QTest::toString()}
is used to generate proper error messages.
If such comparison is not supported for PropertyType
, or the comparison it supports is not appropriate to this property, a custom comparator can be supplied.
Apart from that, a custom represent callback can also be specified to generate a string representation of PropertyType
. If supplied, it must allocate its returned string using {new
char[]}, so that it can be used in place of \l {QTest::toString()}.
Definition at line 238 of file qpropertytesthelper_p.h.
Q_TESTLIB_EXPORT Qt::MouseButtons QTestPrivate::qtestMouseButtons = Qt::NoButton |
Definition at line 451 of file qtestcase.cpp.