Blow up earlier when adding test rows without columns.

Previously, the assertation triggered was rather unhelpful:
 QFATAL : tst_QHash::qhash_qt4() ASSERT: "d->dataCount <
  d->parent->elementCount()" in file qtestdata.cpp,  line 88"

We now try a bit harder to be user-friendly.

Change-Id: I2e3a5ae27914d44fc1dc89af2a084e3d798fe221
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Robin Burchell 2012-01-20 01:55:51 +02:00 committed by Qt by Nokia
parent 7827c1861f
commit fdedb49b76

View File

@ -2286,6 +2286,7 @@ QTestData &QTest::newRow(const char *dataTag)
QTEST_ASSERT_X(dataTag, "QTest::newRow()", "Data tag can not be null");
QTestTable *tbl = QTestTable::currentTestTable();
QTEST_ASSERT_X(tbl, "QTest::newRow()", "Cannot add testdata outside of a _data slot.");
QTEST_ASSERT_X(tbl->elementCount(), "QTest::newRow()", "Must add columns before attempting to add rows.");
return *tbl->newData(dataTag);
}