Cleanup corelib autotests

Remove various disabled and/or non-helpful debugging code.

Any test diagnostics that are useful should be part of the regular test
output, as the CI system cannot switch on commented-out code when there
is a test failure.  Diagnostics should also be informative -- simply
printing the value of a variable with no other information about what is
being printed (or why it is being printed) is not informative.

Change-Id: I21a6c2121be86001bb57e80f426507b6e619ee9e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2011-11-10 12:59:56 +10:00 committed by Qt by Nokia
parent 3e0dece151
commit 578e6d6834
21 changed files with 11 additions and 93 deletions

View File

@ -64,7 +64,6 @@ public:
protected:
void updateCurrentTime(int currentTime)
{
//qDebug() << this << "update current time: " << currentTime;
QPauseAnimation::updateCurrentTime(currentTime);
++m_updateCurrentTimeCount;
}

View File

@ -1832,12 +1832,8 @@ void tst_QTextCodec::utfHeaders()
QLatin1String ignoreReverseTestOn = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? QLatin1String(" le") : QLatin1String(" be");
QString rowName(QTest::currentDataTag());
/*for (int i = 0; i < encoded.length(); ++i)
qDebug() << hex << " " << (uint)(uchar)encoded.at(i);*/
if (toUnicode) {
QString result = codec->toUnicode(encoded.constData(), encoded.length(), &state);
/*for (int i = 0; i < result.length(); ++i)
qDebug() << hex << " " << (uint)result.at(i).unicode();*/
QCOMPARE(result.length(), unicode.length());
QCOMPARE(result, unicode);

View File

@ -1165,32 +1165,27 @@ public:
public slots:
void finished()
{
// qDebug() << "finished called";
finishedCalled = true;
}
void canceled()
{
// qDebug() << "canceled called";
canceledCalled = true;
}
void resultReady(int index)
{
// qDebug() << "result" << index << "ready";
results.insert(index);
}
void progressRange(int begin, int end)
{
// qDebug() << "progress range" << begin << end;
rangeBegin = begin;
rangeEnd = end;
}
void progress(int progress)
{
// qDebug() << "progress" << progress;
reportedProgress.insert(progress);
}
public:

View File

@ -2171,14 +2171,12 @@ InstanceCounter slowMap(const InstanceCounter &in)
InstanceCounter fastMap(const InstanceCounter &in)
{
QTest::qSleep(rand() % 2 + 1);
// qDebug() << "map " << QThread::currentThread();
return in;
}
void slowReduce(int &result, const InstanceCounter&)
{
QTest::qSleep(rand() % 4 + 1);
// qDebug() << "reduce" << QThread::currentThread();
++result;
}
@ -2204,8 +2202,6 @@ void tst_QtConcurrentMap::throttling()
int results = QtConcurrent::blockingMappedReduced(instances, slowMap, fastReduce);
QCOMPARE(results, itemcount);
qDebug() << (int)currentInstanceCount;
qDebug() << (int)peakInstanceCount;
QCOMPARE(int(currentInstanceCount), itemcount);
QVERIFY(int(peakInstanceCount) < itemcount + allowedTemporaries);
}
@ -2222,8 +2218,6 @@ void tst_QtConcurrentMap::throttling()
int results = QtConcurrent::blockingMappedReduced(instances, fastMap, slowReduce);
QCOMPARE(results, itemcount);
qDebug() << (int)currentInstanceCount;
qDebug() << (int)peakInstanceCount;
QCOMPARE((int)currentInstanceCount, itemcount);
QVERIFY(int(peakInstanceCount) < itemcount + allowedTemporaries);
}

View File

@ -719,7 +719,6 @@ void tst_QThreadPool::tryStartCount()
const int runs = 5;
for (int i = 0; i < runs; ++i) {
// qDebug() << "iteration" << i;
int count = 0;
while (threadPool.tryStart(&task))
++count;

View File

@ -1470,12 +1470,6 @@ void tst_QDataStream::readQImage(QDataStream *s)
// ################ Bug : ref and orig has ff in alpha; readback has 0
// ### (Was like this in 1.44 as well)
//
// for(int i = 0; i < d12.height(); i++)
// for(int j = 0; j < d12.width(); j++)
// if (d12.pixel(j, i) != ref.pixel(j, i))
// qDebug("Feil %i %i", j, i);
//
}
// ************************************

View File

@ -161,7 +161,7 @@ void tst_QFileSystemWatcher::basicTest()
testFile.write(QByteArray("world"));
testFile.close();
// qDebug() << "waiting max 5 seconds for notification for file modification to trigger(1)";
// waiting max 5 seconds for notification for file modification to trigger
timer.start(5000);
eventLoop.exec();
@ -179,7 +179,7 @@ void tst_QFileSystemWatcher::basicTest()
testFile.write(QByteArray("hello universe!"));
testFile.close();
// qDebug() << "waiting max 5 seconds for notification for file modification to trigger (2)";
// waiting max 5 seconds for notification for file modification to trigger
timer.start(5000);
eventLoop.exec();
@ -206,7 +206,7 @@ void tst_QFileSystemWatcher::basicTest()
// change the permissions, should get a signal from the watcher
testFile.setPermissions(QFile::ReadOwner);
// qDebug() << "waiting max 5 seconds for notification for file permission modification to trigger(1)";
// waiting max 5 seconds for notification for file permission modification to trigger
timer.start(5000);
eventLoop.exec();
@ -222,7 +222,7 @@ void tst_QFileSystemWatcher::basicTest()
watcher.removePath(testFile.fileName());
testFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOther);
// qDebug() << "waiting max 5 seconds for notification for file modification to trigger (2)";
// waiting max 5 seconds for notification for file modification to trigger
timer.start(5000);
eventLoop.exec();
@ -234,7 +234,7 @@ void tst_QFileSystemWatcher::basicTest()
// remove the file, should get a signal from the watcher
QVERIFY(testFile.remove());
// qDebug() << "waiting max 5 seconds for notification for file removal to trigger";
// waiting max 5 seconds for notification for file removal to trigger
timer.start(5000);
eventLoop.exec();
@ -251,7 +251,7 @@ void tst_QFileSystemWatcher::basicTest()
testFile.write(QByteArray("hello"));
testFile.close();
// qDebug() << "waiting max 5 seconds for notification for file recreation to trigger";
// waiting max 5 seconds for notification for file recreation to trigger
timer.start(5000);
eventLoop.exec();
@ -292,7 +292,7 @@ void tst_QFileSystemWatcher::watchDirectory()
QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate));
testFile.close();
// qDebug() << "waiting max 5 seconds for notification for file recreationg to trigger";
// waiting max 5 seconds for notification for file recreationg to trigger
timer.start(5000);
eventLoop.exec();
@ -309,7 +309,7 @@ void tst_QFileSystemWatcher::watchDirectory()
// remove the directory, should get a signal from the watcher
QVERIFY(QDir().rmdir("testDir"));
// qDebug() << "waiting max 5 seconds for notification for directory removal to trigger";
// waiting max 5 seconds for notification for directory removal to trigger
timer.start(5000);
eventLoop.exec();
@ -331,7 +331,7 @@ void tst_QFileSystemWatcher::watchDirectory()
if (!QDir().mkdir("testDir"))
QSKIP("Failed to recreate directory, skipping final test.");
// qDebug() << "waiting max 5 seconds for notification for dir recreation to trigger";
// waiting max 5 seconds for notification for dir recreation to trigger
timer.start(5000);
eventLoop.exec();

View File

@ -333,13 +333,7 @@ void tst_QResourceEngine::checkStructure()
// Test the Dir filter
QFileInfoList list = dir.entryInfoList(QDir::Dirs, QDir::Name);
// for(int i = 0; i < list.size(); ++i)
// qDebug() << "one" << i << list.at(i).fileName();
// for(int i = 0; i < containedDirs.size(); ++i)
// qDebug() << "two" << i << containedDirs.at(i);
// qDebug() << "one" << list.size() << containedDirs.size();
QCOMPARE(list.size(), containedDirs.size());
// qDebug() << "two";
QCOMPARE(list.size(), containedDirs.size());
int i;
for (i=0; i<list.size(); ++i) {

View File

@ -2391,7 +2391,6 @@ void tst_QSettings::testEscapes()
{ \
QVariant v(val); \
QString s = QSettingsPrivate::variantToString(v); \
/*qDebug() << QString("testVariant(): reference=\"%1\" result=\"%2\"").arg(escStr).arg(s); */\
QCOMPARE(s, escStr); \
QCOMPARE(QVariant(QSettingsPrivate::stringToVariant(escStr)), v); \
QVERIFY(val == v.func()); \

View File

@ -74,7 +74,6 @@ private slots:
private:
void setCustomLocations() {
m_thisDir = QFile::decodeName(SRCDIR);
//qDebug() << m_thisDir;
m_thisDir.chop(1); // remove trailing slash!
qputenv("XDG_CONFIG_HOME", QFile::encodeName(m_thisDir));
@ -140,7 +139,6 @@ void tst_qstandardpaths::testLocateAll()
{
#ifdef Q_XDG_PLATFORM
const QStringList appsDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "applications", QStandardPaths::LocateDirectory);
//qDebug() << appsDirs;
foreach (const QString &dir, appsDirs)
QVERIFY2(dir.endsWith(QLatin1String("/share/applications")), qPrintable(dir));

View File

@ -657,10 +657,6 @@ void tst_QAbstractItemModel::dropMimeData()
QtTestModel dst(dst_table);
QtTestModel res(res_table);
// qDebug() << "src" << src.rowCount(QModelIndex()) << src.columnCount(QModelIndex());
// qDebug() << "dst" << dst.rowCount(QModelIndex()) << dst.columnCount(QModelIndex());
// qDebug() << "res" << res.rowCount(QModelIndex()) << res.columnCount(QModelIndex());
// get the mimeData from the "selected" indexes
QModelIndexList selectedIndexes;
for (int i = 0; i < selection.count(); ++i)
@ -679,12 +675,9 @@ void tst_QAbstractItemModel::dropMimeData()
QModelIndex res_idx = res.index(r, c, QModelIndex());
QMap<int, QVariant> dst_data = dst.itemData(dst_idx);
QMap<int, QVariant> res_data = res.itemData(res_idx);
//if(dst_data != res_data)
// qDebug() << r << c << dst_data.value(0).toString() << res_data.value(0).toString();
QCOMPARE(dst_data , res_data);
}
}
}

View File

@ -57,9 +57,6 @@ Q_DECLARE_METATYPE(QModelIndex)
the tests specified by modelstotest.cpp and any extra data needed for that particular test.
setupWithNoTestData() fills the QTest data with just the tests and is used by most tests.
There are some basic qDebug statements sprikled about that might be helpfull for fixing
your issues.
*/
class tst_QItemModel : public QObject
{
@ -410,9 +407,6 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent,
else
QCOMPARE(currentModel->hasChildren(parent), false);
//qDebug() << "parent:" << currentModel->data(parent).toString() << "rows:" << rows
// << "columns:" << columns << "parent column:" << parent.column();
QCOMPARE(currentModel->hasIndex(rows+1, 0, parent), false);
for (int r = 0; r < rows; ++r) {
if (currentModel->canFetchMore(parent))
@ -455,7 +449,6 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent,
// recursivly go down
if (currentModel->hasChildren(index) && currentDepth < 5) {
//qDebug() << r << c << "has children" << currentModel->rowCount(index);
checkChildren(currentModel, index, ++currentDepth);
// Because this is recursive we will return at the first failure rather then
// reporting it over and over
@ -846,8 +839,6 @@ void tst_QItemModel::remove()
return;
}
//qDebug() << "remove start:" << start << "count:" << count << "rowCount:" << currentModel->rowCount(parentOfRemoved);
// When a row or column is removed there should be two signals.
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
qRegisterMetaType<QModelIndex>("QModelIndex");
@ -912,7 +903,6 @@ void tst_QItemModel::remove()
}
// The row count should only change *after* rowsAboutToBeRemoved has been emitted
//qDebug() << beforeRemoveRowCount << afterAboutToRemoveRowCount << afterRemoveRowCount << currentModel->rowCount(parentOfRemoved);
if (shouldSucceed) {
if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0){
QCOMPARE(afterAboutToRemoveRowCount, beforeRemoveRowCount);
@ -1022,7 +1012,6 @@ void verifyState(QAbstractItemModel *currentModel) {
void tst_QItemModel::slot_rowsAboutToRemove(const QModelIndex &parent)
{
QVERIFY(parentOfRemoved == parent);
//qDebug() << "slot_rowsAboutToRemove" << currentModel->rowCount(parent);
afterAboutToRemoveRowCount = currentModel->rowCount(parent);
// hasChildren() should still work
if (afterAboutToRemoveRowCount > 0)
@ -1036,7 +1025,6 @@ void tst_QItemModel::slot_rowsAboutToRemove(const QModelIndex &parent)
if (removeRecursively) {
QFETCH(int, recursiveRow);
QFETCH(int, recursiveCount);
//qDebug() << recursiveRow << recursiveCount;
removeRecursively = false;
QCOMPARE(currentModel->removeRows(recursiveRow, recursiveCount, parent), true);
}
@ -1045,7 +1033,6 @@ void tst_QItemModel::slot_rowsAboutToRemove(const QModelIndex &parent)
void tst_QItemModel::slot_rowsRemoved(const QModelIndex &parent)
{
QVERIFY(parentOfRemoved == parent);
//qDebug() << "slot_rowsRemoved" << currentModel->rowCount(parent);
afterRemoveRowCount = currentModel->rowCount(parent);
if (afterRemoveRowCount > 0)
QCOMPARE(currentModel->hasChildren(parent), true);
@ -1188,8 +1175,6 @@ void tst_QItemModel::insert()
return;
}
//qDebug() << "insert start:" << start << "count:" << count << "rowCount:" << currentModel->rowCount(parentOfInserted);
// When a row or column is inserted there should be two signals.
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
qRegisterMetaType<QModelIndex>("QModelIndex");
@ -1250,7 +1235,6 @@ void tst_QItemModel::insert()
QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals);
}
// The row count should only change *after* rowsAboutToBeInserted has been emitted
//qDebug() << beforeInsertRowCount << afterAboutToInsertRowCount << afterInsertRowCount << currentModel->rowCount(parentOfInserted);
if (shouldSucceed) {
if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0) {
QCOMPARE(afterAboutToInsertRowCount, beforeInsertRowCount);
@ -1342,7 +1326,6 @@ void tst_QItemModel::insert()
void tst_QItemModel::slot_rowsAboutToInserted(const QModelIndex &parent)
{
QVERIFY(parentOfInserted == parent);
//qDebug() << "slot_rowsAboutToInsert" << currentModel->rowCount(parent);
afterAboutToInsertRowCount = currentModel->rowCount(parent);
bool hasChildren = currentModel->hasChildren(parent);
bool hasDimensions = currentModel->columnCount(parent) > 0 && currentModel->rowCount(parent) > 0;
@ -1353,7 +1336,6 @@ void tst_QItemModel::slot_rowsAboutToInserted(const QModelIndex &parent)
if (insertRecursively) {
QFETCH(int, recursiveRow);
QFETCH(int, recursiveCount);
//qDebug() << recursiveRow << recursiveCount;
insertRecursively = false;
QCOMPARE(currentModel->insertRows(recursiveRow, recursiveCount, parent), true);
}

View File

@ -293,7 +293,7 @@ void tst_QThread::currentThread()
void tst_QThread::idealThreadCount()
{
QVERIFY(QThread::idealThreadCount() > 0);
qDebug() << "Available cpu cores:" << QThread::idealThreadCount();
qDebug() << "Ideal thread count:" << QThread::idealThreadCount();
}
void tst_QThread::isFinished()

View File

@ -256,10 +256,6 @@ void tst_QBitArray::fill()
for (i = 0; i < N-M; ++i) {
a.fill(true, i, i + M);
/*
for (int k = 0; k < N; ++k)
qDebug("%*s%d", k, "", a.at(k));
*/
for (j = 0; j < N; ++j) {
if (j >= i && j < i + M) {
QVERIFY(a.at(j));

View File

@ -184,7 +184,6 @@ void tst_QByteArray::qCompress()
{
QFETCH( QByteArray, ba );
QByteArray compressed = ::qCompress( ba );
//qDebug( "size uncompressed: %d size compressed: %d", ba.size(), compressed.size() );
QTEST( ::qUncompress( compressed ), "ba" );
}

View File

@ -539,7 +539,6 @@ void tst_QDateTime::toString_enumformat()
QCOMPARE(str2, QString("1995-05-20T12:34:56"));
QString str3 = dt1.toString(Qt::LocalDate);
qDebug() << str3;
QVERIFY(!str3.isEmpty());
//check for date/time components in any order
//year may be 2 or 4 digits

View File

@ -94,22 +94,17 @@ class MyClass
{
public:
MyClass() { ++count;
// qDebug("creating MyClass count=%d", count);
}
MyClass( const QString& c) {
count++; str = c;
// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
}
~MyClass() {
count--;
// qDebug("deleting MyClass '%s' count = %d", str.latin1(), count);
}
MyClass( const MyClass& c ) {
count++; str = c.str;
// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
}
MyClass &operator =(const MyClass &o) {
// qDebug("copying MyClass '%s'", o.str.latin1());
str = o.str; return *this;
}
@ -916,7 +911,6 @@ void tst_QHash::iterators()
while(javaIt.hasNext()) {
++i;
javaIt.next();
//qDebug(javaIt.value());
QVERIFY(javaIt.value() == testMap.value(i));
}
@ -934,7 +928,6 @@ void tst_QHash::iterators()
testString = javaIt.value();
testString1 = javaIt.peekNext().value();
javaIt.next();
//qDebug(testString + " " + testString1 + " " + javaIt.peekPrevious().value());
QVERIFY(javaIt.value() == testString1);
QCOMPARE(javaIt.peekPrevious().value(), testString1);
}
@ -943,7 +936,6 @@ void tst_QHash::iterators()
testString1 = javaIt.peekPrevious().value();
javaIt.previous();
QVERIFY(javaIt.value() == testString1);
//qDebug(testString + testString1 + javaIt.peekNext().value());
QCOMPARE(javaIt.peekNext().value(), testString1);
}
}

View File

@ -153,13 +153,11 @@ void tst_QList::append() const
list2.append(three);
list2.append(four);
list1.append(list2);
qDebug() << list1;
listTotal.append(one);
listTotal.append(two);
listTotal.append(three);
listTotal.append(four);
QCOMPARE(list1, listTotal);
}
void tst_QList::prepend() const

View File

@ -86,22 +86,17 @@ class MyClass
public:
MyClass() {
++count;
// qDebug("creating MyClass count=%d", count);
}
MyClass( const QString& c) {
count++; str = c;
// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
}
~MyClass() {
count--;
// qDebug("deleting MyClass '%s' count = %d", str.latin1(), count);
}
MyClass( const MyClass& c ) {
count++; str = c.str;
// qDebug("creating MyClass '%s' count = %d", str.latin1(), count);
}
MyClass &operator =(const MyClass &o) {
// qDebug("copying MyClass '%s'", o.str.latin1());
str = o.str; return *this;
}

View File

@ -242,7 +242,6 @@ void tst_QTextBoundaryFinder::isAtWordStart()
for(int i=0; i < txt.length(); ++i) {
finder.setPosition(i);
QTextBoundaryFinder::BoundaryReasons r = finder.boundaryReasons();
// qDebug() << i << r;
QCOMPARE((r & QTextBoundaryFinder::StartWord) != 0, start.contains(i) == true);
QCOMPARE((r & QTextBoundaryFinder::EndWord) != 0, end.contains(i) == true);
}
@ -277,7 +276,6 @@ void tst_QTextBoundaryFinder::isAtBoundaryLine()
// break? - - - - + - +
QChar s[] = { 0x0061, 0x00AD, 0x0062, 0x0009, 0x0063, 0x0064 };
QString text(s, sizeof(s)/sizeof(s[0]));
// qDebug() << "text = " << text << ", length = " << text.length();
QTextBoundaryFinder finder(QTextBoundaryFinder::Line, text.constData(), text.length(), /*buffer*/0, /*buffer size*/0);
finder.setPosition(0);
QVERIFY(finder.isAtBoundary());

View File

@ -341,8 +341,6 @@ public:
QString expectedFilePath;
const int index = m_atts.top().index(QString(), QLatin1String("OUTPUT"));
//qDebug() << "Running test case:" << id;
if(index != -1)
{
expectedFilePath = m_baseURI.top().resolved(m_atts.top().value(QString(),