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>
protected:
void updateCurrentTime(int currentTime)
{
- //qDebug() << this << "update current time: " << currentTime;
QPauseAnimation::updateCurrentTime(currentTime);
++m_updateCurrentTimeCount;
}
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);
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:
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;
}
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);
}
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);
}
const int runs = 5;
for (int i = 0; i < runs; ++i) {
-// qDebug() << "iteration" << i;
int count = 0;
while (threadPool.tryStart(&task))
++count;
// ################ 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);
-//
}
// ************************************
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();
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();
// 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();
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();
// 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();
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();
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();
// 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();
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();
// 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) {
{ \
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()); \
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));
{
#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));
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)
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);
}
}
-
}
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
{
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))
// 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
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");
}
// 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);
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)
if (removeRecursively) {
QFETCH(int, recursiveRow);
QFETCH(int, recursiveCount);
- //qDebug() << recursiveRow << recursiveCount;
removeRecursively = false;
QCOMPARE(currentModel->removeRows(recursiveRow, recursiveCount, parent), true);
}
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);
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");
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);
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;
if (insertRecursively) {
QFETCH(int, recursiveRow);
QFETCH(int, recursiveCount);
- //qDebug() << recursiveRow << recursiveCount;
insertRecursively = false;
QCOMPARE(currentModel->insertRows(recursiveRow, recursiveCount, parent), true);
}
void tst_QThread::idealThreadCount()
{
QVERIFY(QThread::idealThreadCount() > 0);
- qDebug() << "Available cpu cores:" << QThread::idealThreadCount();
+ qDebug() << "Ideal thread count:" << QThread::idealThreadCount();
}
void tst_QThread::isFinished()
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));
{
QFETCH( QByteArray, ba );
QByteArray compressed = ::qCompress( ba );
- //qDebug( "size uncompressed: %d size compressed: %d", ba.size(), compressed.size() );
QTEST( ::qUncompress( compressed ), "ba" );
}
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
{
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;
}
while(javaIt.hasNext()) {
++i;
javaIt.next();
- //qDebug(javaIt.value());
QVERIFY(javaIt.value() == testMap.value(i));
}
testString = javaIt.value();
testString1 = javaIt.peekNext().value();
javaIt.next();
- //qDebug(testString + " " + testString1 + " " + javaIt.peekPrevious().value());
QVERIFY(javaIt.value() == testString1);
QCOMPARE(javaIt.peekPrevious().value(), testString1);
}
testString1 = javaIt.peekPrevious().value();
javaIt.previous();
QVERIFY(javaIt.value() == testString1);
- //qDebug(testString + testString1 + javaIt.peekNext().value());
QCOMPARE(javaIt.peekNext().value(), testString1);
}
}
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
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;
}
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);
}
// 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());
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(),