Qt 4.8
Public Functions | Private Functions | Properties | Friends | List of all members
QTestData Class Reference

#include <qtestdata.h>

Public Functions

void append (int type, const void *data)
 
void * data (int index) const
 
int dataCount () const
 
const char * dataTag () const
 
QTestTableparent () const
 
 ~QTestData ()
 

Private Functions

 QTestData (const char *tag=0, QTestTable *parent=0)
 

Properties

QTestDataPrivated
 

Friends

class QTestTable
 

Detailed Description

Definition at line 59 of file qtestdata.h.

Constructors and Destructors

◆ ~QTestData()

QTestData::~QTestData ( )

Definition at line 75 of file qtestdata.cpp.

76 {
77  for (int i = 0; i < d->dataCount; ++i) {
78  if (d->data[i])
80  }
81  delete [] d->data;
82  delete [] d->tag;
83  delete d;
84 }
static void destroy(int type, void *data)
Destroys the data, assuming it is of the type given.
Definition: qmetatype.cpp:1263
int elementTypeId(int index) const
Definition: qtesttable.cpp:212
QTestDataPrivate * d
Definition: qtestdata.h:76
QTestTable * parent
Definition: qtestdata.cpp:59

◆ QTestData()

QTestData::QTestData ( const char *  tag = 0,
QTestTable parent = 0 
)
private

Definition at line 64 of file qtestdata.cpp.

65 {
66  QTEST_ASSERT(tag);
67  QTEST_ASSERT(parent);
68  d = new QTestDataPrivate;
69  d->tag = qstrdup(tag);
70  d->parent = parent;
71  d->data = new void *[parent->elementCount()];
72  memset(d->data, 0, parent->elementCount() * sizeof(void*));
73 }
QTestTable * parent() const
Definition: qtestdata.cpp:107
int elementCount() const
Definition: qtesttable.cpp:165
QTestDataPrivate * d
Definition: qtestdata.h:76
Q_CORE_EXPORT char * qstrdup(const char *)
#define QTEST_ASSERT(cond)
Definition: qtestassert.h:53
QTestTable * parent
Definition: qtestdata.cpp:59

Functions

◆ append()

void QTestData::append ( int  type,
const void *  data 
)

Definition at line 86 of file qtestdata.cpp.

Referenced by operator<<().

87 {
89  if (d->parent->elementTypeId(d->dataCount) != type) {
90  qDebug("expected data of type '%s', got '%s' for element %d of data with tag '%s'",
93  d->dataCount, d->tag);
94  QTEST_ASSERT(false);
95  }
97  ++d->dataCount;
98 }
int type
Definition: qmetatype.cpp:239
static void * construct(int type, const void *copy=0)
Returns a copy of copy, assuming it is of type type.
Definition: qmetatype.cpp:1042
Q_CORE_EXPORT void qDebug(const char *,...)
int elementTypeId(int index) const
Definition: qtesttable.cpp:212
int elementCount() const
Definition: qtesttable.cpp:165
void * data(int index) const
Definition: qtestdata.cpp:100
QTestDataPrivate * d
Definition: qtestdata.h:76
static const char * typeName(int type)
Returns the type name associated with the given type, or 0 if no matching type was found...
Definition: qmetatype.cpp:406
#define QTEST_ASSERT(cond)
Definition: qtestassert.h:53
QTestTable * parent
Definition: qtestdata.cpp:59

◆ data()

void * QTestData::data ( int  index) const

Definition at line 100 of file qtestdata.cpp.

Referenced by QTest::fetchData(), and QTest::qElementData().

101 {
102  QTEST_ASSERT(index >= 0);
103  QTEST_ASSERT(index < d->parent->elementCount());
104  return d->data[index];
105 }
QTestTable * parent() const
Definition: qtestdata.cpp:107
int elementCount() const
Definition: qtesttable.cpp:165
QTestDataPrivate * d
Definition: qtestdata.h:76
#define QTEST_ASSERT(cond)
Definition: qtestassert.h:53
quint16 index

◆ dataCount()

int QTestData::dataCount ( ) const

Definition at line 117 of file qtestdata.cpp.

Referenced by QTest::fetchData().

118 {
119  return d->dataCount;
120 }
QTestDataPrivate * d
Definition: qtestdata.h:76

◆ dataTag()

const char * QTestData::dataTag ( ) const

Definition at line 112 of file qtestdata.cpp.

Referenced by QTestResult::currentDataTag(), QTestResult::currentGlobalDataTag(), QTest::qInvokeTestMethod(), and QTest::qPrintDataTags().

113 {
114  return d->tag;
115 }
QTestDataPrivate * d
Definition: qtestdata.h:76

◆ parent()

QTestTable * QTestData::parent ( ) const

Definition at line 107 of file qtestdata.cpp.

Referenced by QTest::fetchData(), and QTest::qElementData().

108 {
109  return d->parent;
110 }
QTestDataPrivate * d
Definition: qtestdata.h:76
QTestTable * parent
Definition: qtestdata.cpp:59

Friends and Related Functions

◆ QTestTable

friend class QTestTable
friend

Definition at line 71 of file qtestdata.h.

Properties

◆ d

QTestDataPrivate* QTestData::d
private

Definition at line 76 of file qtestdata.h.


The documentation for this class was generated from the following files: