summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qloggingcategory
diff options
context:
space:
mode:
authorGiorgos Tsiapaliokas <terietor@gmail.com>2013-11-29 15:21:03 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-10 16:28:30 +0100
commitd61e7743078197f7409e863ff1d2243da7d0335f (patch)
tree45109f1b1b89807c78f8d7597a91ad99e10e7160 /tests/auto/corelib/io/qloggingcategory
parent3d08681169b5194cdc9e61fbf6fac9c4346147d8 (diff)
Print qCDebugs in arbitrary categories by default
The debug output of all categories will be visible by default, except from the "qt.*" categories. "qt.*" categories are private and their default debug output will be hidden. [ChangeLog][QtCore][Logging] Enable qCDebug's for all categories except qt one's Change-Id: Ibe147c8bbe0835a63b3de782288b9c3251321d8f Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tests/auto/corelib/io/qloggingcategory')
-rw-r--r--tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
index 26f10385b3..47a5d6044e 100644
--- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
+++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
@@ -271,8 +271,8 @@ private slots:
QCOMPARE(defaultCategory.isEnabled(QtCriticalMsg), true);
QLoggingCategory customCategory("custom");
- QCOMPARE(customCategory.isDebugEnabled(), false);
- QCOMPARE(customCategory.isEnabled(QtDebugMsg), false);
+ QCOMPARE(customCategory.isDebugEnabled(), true);
+ QCOMPARE(customCategory.isEnabled(QtDebugMsg), true);
QCOMPARE(customCategory.isWarningEnabled(), true);
QCOMPARE(customCategory.isEnabled(QtWarningMsg), true);
QCOMPARE(customCategory.isCriticalEnabled(), true);
@@ -309,7 +309,7 @@ private slots:
QLoggingCategory cat("custom");
QCOMPARE(customCategoryFilterArgs, QStringList() << "custom");
- QVERIFY(cat.isDebugEnabled());
+ QVERIFY(!cat.isDebugEnabled());
customCategoryFilterArgs.clear();
// install default filter
@@ -319,7 +319,7 @@ private slots:
QCOMPARE(customCategoryFilterArgs.size(), 0);
QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
- QVERIFY(!cat.isDebugEnabled());
+ QVERIFY(cat.isDebugEnabled());
// install default filter
currentFilter =
@@ -328,7 +328,7 @@ private slots:
QCOMPARE(customCategoryFilterArgs.size(), 0);
QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
- QVERIFY(!cat.isDebugEnabled());
+ QVERIFY(cat.isDebugEnabled());
}
void qDebugMacros()
@@ -397,8 +397,12 @@ private slots:
QLoggingCategory customCategory("custom");
// Check custom debug
logMessage.clear();
+ buf = QStringLiteral("custom.debug: Check debug with no filter active");
+ qCDebug(customCategory, "Check debug with no filter active");
+ QCOMPARE(logMessage, buf);
+
qCDebug(customCategory) << "Check debug with no filter active";
- QCOMPARE(logMessage, QString());
+ QCOMPARE(logMessage, buf);
// Check custom warning
buf = QStringLiteral("custom.warning: Check warning with no filter active");
@@ -414,16 +418,16 @@ private slots:
QLoggingCategory::installFilter(customCategoryFilter);
// Check custom debug
- buf = QStringLiteral("custom.debug: Check debug with filter active");
+ logMessage.clear();
qCDebug(customCategory) << "Check debug with filter active";
- QCOMPARE(logMessage, buf);
+ QCOMPARE(logMessage, QString());
// Check different macro/category variants
buf = QStringLiteral("tst.log.debug: Check debug with no filter active");
qCDebug(TST_LOG) << "Check debug with no filter active";
- QCOMPARE(logMessage, buf);
+ QCOMPARE(logMessage, QString());
qCDebug(TST_LOG, "Check debug with no filter active");
- QCOMPARE(logMessage, buf);
+ QCOMPARE(logMessage, QString());
buf = QStringLiteral("tst.log.warning: Check warning with no filter active");
qCWarning(TST_LOG) << "Check warning with no filter active";
QCOMPARE(logMessage, buf);
@@ -441,8 +445,9 @@ private slots:
// Check custom debug
logMessage.clear();
+ buf = QStringLiteral("custom.debug: Check debug with no filter active");
qCDebug(customCategory) << "Check debug with no filter active";
- QCOMPARE(logMessage, QString());
+ QCOMPARE(logMessage, buf);
}
void checkLegacyMessageLogger()
@@ -477,11 +482,11 @@ private slots:
QCOMPARE(cleanLogLine(logMessage), cleanLogLine(buf));
// Check category debug
- logMessage = "should not change";
- buf = logMessage;
+ buf = QStringLiteral("tst.log.debug: Check category Debug with no log active");
qCDebug(TST_LOG) << "Check category Debug with no log active";
QCOMPARE(logMessage, buf);
+
// Check default warning
buf = QStringLiteral("tst.log.warning: Check category Warning with no log active");
qCWarning(TST_LOG) << "Check category Warning with no log active";
@@ -763,8 +768,7 @@ private slots:
{
// "" -> custom category
QLoggingCategory mycategoryobject1("");
- logMessage = "no change";
- QString buf = QStringLiteral("no change");
+ QString buf = QStringLiteral(".debug: My Category Object");
qCDebug(mycategoryobject1) << "My Category Object";
QCOMPARE(cleanLogLine(logMessage), cleanLogLine(buf));