QTestData Class
The QTestData class is a row of test data under construction. More…
| Header | #include <QTestData> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Test) |
| Module | Nt Test C++ Classes |
List of all members, including inherited members
Public Functions
| QTestData & | operator<<(const T &value) |
| QTestData & | operator<<(const char *value) |
| const char * | dataTag() const |
Detailed Description
QTest::newRow() returns a QTestData, and operator<< fills in one cell per column, in the order the columns were added.
QTest::newRow("empty") << QString() << 0;
See also QTest::addColumn().
Differences from Qt
The class cannot be copied. A value of the wrong type stops the test with a fatal message, as a wrong QFETCH() type does; the type must match exactly, so an int is not accepted by a qsizetype column.
Member Function Documentation
const char * QTestData::dataTag() const
Returns the name of this row.
template <typename T>QTestData & QTestData::operator<<(const T &value)
Appends value as the next cell of this row and returns a reference to the row. T must be exactly the type given to QTest::addColumn() for that column.
QTestData & QTestData::operator<<(const char *value)
This is an overloaded function.
Appends the string literal or C string value as the next cell. It may fill a QString column, a QByteArray column or a column of const char *. Returns a reference to the row.