Commit 08bb5ade authored by Laurent Montel's avatar Laurent Montel 😁

Astyle kdelibs

parent 8540c2a5
...@@ -82,7 +82,7 @@ void KDebugSettingUtilTest::shouldParseQtLoggingLine_data() ...@@ -82,7 +82,7 @@ void KDebugSettingUtilTest::shouldParseQtLoggingLine_data()
QTest::newRow("validenabledwithtypedebug") << QStringLiteral("toto.debug=true") << QStringLiteral("toto") << KDebugSettingsUtil::LoadLoggingCategory::Debug << true << true; QTest::newRow("validenabledwithtypedebug") << QStringLiteral("toto.debug=true") << QStringLiteral("toto") << KDebugSettingsUtil::LoadLoggingCategory::Debug << true << true;
QTest::newRow("invalid") << QStringLiteral("dd") << QString() << KDebugSettingsUtil::LoadLoggingCategory::Unknown << false << false; QTest::newRow("invalid") << QStringLiteral("dd") << QString() << KDebugSettingsUtil::LoadLoggingCategory::Unknown << false << false;
QTest::newRow("invalidWithoutEnabledDisabled") << QStringLiteral("dd=")<< QStringLiteral("dd") << KDebugSettingsUtil::LoadLoggingCategory::All << false << true; QTest::newRow("invalidWithoutEnabledDisabled") << QStringLiteral("dd=") << QStringLiteral("dd") << KDebugSettingsUtil::LoadLoggingCategory::All << false << true;
} }
void KDebugSettingUtilTest::shouldParseQtLoggingLine() void KDebugSettingUtilTest::shouldParseQtLoggingLine()
......
...@@ -91,9 +91,8 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -91,9 +91,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("emptywithlistkdeloggingcategories") << QStringLiteral("rulebeforerulessectionfiles.ini") << QStringLiteral("correct.categories") << false QTest::newRow("emptywithlistkdeloggingcategories") << QStringLiteral("rulebeforerulessectionfiles.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
qtKdeCategories.clear(); qtKdeCategories.clear();
tmp.description = QStringLiteral("KPasswdServer (KIO)"); tmp.description = QStringLiteral("KPasswdServer (KIO)");
...@@ -126,15 +125,13 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -126,15 +125,13 @@ void LoadCategoriesJobTest::shouldReadRules_data()
tmp.enabled = true; tmp.enabled = true;
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("oneelementoff") << QStringLiteral("oneelementoff.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementoff") << QStringLiteral("oneelementoff.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
QTest::newRow("oneelementonelineoff") << QStringLiteral("oneelementonelineoff.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementonelineoff") << QStringLiteral("oneelementonelineoff.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
qtKdeCategories.clear(); qtKdeCategories.clear();
tmp.description = QStringLiteral("KPasswdServer (KIO)"); tmp.description = QStringLiteral("KPasswdServer (KIO)");
...@@ -167,14 +164,13 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -167,14 +164,13 @@ void LoadCategoriesJobTest::shouldReadRules_data()
tmp.enabled = true; tmp.enabled = true;
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("oneelementall") << QStringLiteral("oneelementall.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementall") << QStringLiteral("oneelementall.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
QTest::newRow("oneelementonelineall") << QStringLiteral("oneelementonelineall.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementonelineall") << QStringLiteral("oneelementonelineall.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
qtKdeCategories.clear(); qtKdeCategories.clear();
tmp.description = QStringLiteral("KPasswdServer (KIO)"); tmp.description = QStringLiteral("KPasswdServer (KIO)");
...@@ -207,14 +203,13 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -207,14 +203,13 @@ void LoadCategoriesJobTest::shouldReadRules_data()
tmp.enabled = true; tmp.enabled = true;
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("oneelementinfo") << QStringLiteral("oneelementinfo.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementinfo") << QStringLiteral("oneelementinfo.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
QTest::newRow("oneelementinfo") << QStringLiteral("oneelementinfobis.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementinfo") << QStringLiteral("oneelementinfobis.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
qtKdeCategories.clear(); qtKdeCategories.clear();
tmp.description = QStringLiteral("KPasswdServer (KIO)"); tmp.description = QStringLiteral("KPasswdServer (KIO)");
...@@ -247,10 +242,9 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -247,10 +242,9 @@ void LoadCategoriesJobTest::shouldReadRules_data()
tmp.enabled = true; tmp.enabled = true;
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("oneelementwarning") << QStringLiteral("oneelementwarning.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementwarning") << QStringLiteral("oneelementwarning.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
qtKdeCategories.clear(); qtKdeCategories.clear();
tmp.description = QStringLiteral("KPasswdServer (KIO)"); tmp.description = QStringLiteral("KPasswdServer (KIO)");
...@@ -283,18 +277,16 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -283,18 +277,16 @@ void LoadCategoriesJobTest::shouldReadRules_data()
tmp.enabled = true; tmp.enabled = true;
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("oneelementcritical") << QStringLiteral("oneelementcritical.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementcritical") << QStringLiteral("oneelementcritical.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
QTest::newRow("oneelementonelinecritical") << QStringLiteral("oneelementonelinecritical.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementonelinecritical") << QStringLiteral("oneelementonelinecritical.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
QTest::newRow("oneelementtwolinecritical") << QStringLiteral("oneelementonelinecritical.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementtwolinecritical") << QStringLiteral("oneelementonelinecritical.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
qtKdeCategories.clear(); qtKdeCategories.clear();
tmp.description = QStringLiteral("KPasswdServer (KIO)"); tmp.description = QStringLiteral("KPasswdServer (KIO)");
...@@ -327,10 +319,9 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -327,10 +319,9 @@ void LoadCategoriesJobTest::shouldReadRules_data()
tmp.enabled = true; tmp.enabled = true;
qtKdeCategories.append(tmp); qtKdeCategories.append(tmp);
QTest::newRow("oneelementdebug") << QStringLiteral("oneelementdebug.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementdebug") << QStringLiteral("oneelementdebug.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List() << LoggingCategory::List()
<< qtKdeCategories; << qtKdeCategories;
// Test with extract elements // Test with extract elements
LoggingCategory::List customCategories; LoggingCategory::List customCategories;
...@@ -341,8 +332,8 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -341,8 +332,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
customCategories.append(customTmp); customCategories.append(customTmp);
QTest::newRow("oneelementdebugandanextract") << QStringLiteral("oneelementdebugandanextract.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementdebugandanextract") << QStringLiteral("oneelementdebugandanextract.ini") << QStringLiteral("correct.categories") << false
<< customCategories << customCategories
<< qtKdeCategories; << qtKdeCategories;
// Test with extract elements // Test with extract elements
customCategories.clear(); customCategories.clear();
...@@ -352,8 +343,8 @@ void LoadCategoriesJobTest::shouldReadRules_data() ...@@ -352,8 +343,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
customCategories.append(customTmp); customCategories.append(customTmp);
QTest::newRow("oneelementdebugandanextract") << QStringLiteral("oneelementdebugandanextractfalse.ini") << QStringLiteral("correct.categories") << false QTest::newRow("oneelementdebugandanextract") << QStringLiteral("oneelementdebugandanextractfalse.ini") << QStringLiteral("correct.categories") << false
<< customCategories << customCategories
<< qtKdeCategories; << qtKdeCategories;
} }
...@@ -381,13 +372,13 @@ void LoadCategoriesJobTest::shouldReadRules() ...@@ -381,13 +372,13 @@ void LoadCategoriesJobTest::shouldReadRules()
QCOMPARE(job.customCategories().count(), customcategories.count()); QCOMPARE(job.customCategories().count(), customcategories.count());
#ifdef DEBUG_RESULT #ifdef DEBUG_RESULT
Q_FOREACH(const LoggingCategory &cat, job.customCategories()) { Q_FOREACH (const LoggingCategory &cat, job.customCategories()) {
qDebug() << "customcategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type "<<cat.loggingType; qDebug() << "customcategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type " << cat.loggingType;
} }
qDebug() << "AFTER"; qDebug() << "AFTER";
Q_FOREACH(const LoggingCategory &cat, customcategories) { Q_FOREACH (const LoggingCategory &cat, customcategories) {
qDebug() << "customcategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type "<<cat.loggingType; qDebug() << "customcategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type " << cat.loggingType;
} }
#endif #endif
...@@ -398,17 +389,16 @@ void LoadCategoriesJobTest::shouldReadRules() ...@@ -398,17 +389,16 @@ void LoadCategoriesJobTest::shouldReadRules()
QCOMPARE(job.qtKdeCategories().count(), qtkdecategories.count()); QCOMPARE(job.qtKdeCategories().count(), qtkdecategories.count());
#ifdef DEBUG_RESULT #ifdef DEBUG_RESULT
Q_FOREACH(const LoggingCategory &cat, job.qtKdeCategories()) { Q_FOREACH (const LoggingCategory &cat, job.qtKdeCategories()) {
qDebug() << "qtKdeCategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type "<<cat.loggingType; qDebug() << "qtKdeCategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type " << cat.loggingType;
} }
qDebug() << "AFTER"; qDebug() << "AFTER";
Q_FOREACH(const LoggingCategory &cat, qtkdecategories) { Q_FOREACH (const LoggingCategory &cat, qtkdecategories) {
qDebug() << "qtKdeCategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type "<<cat.loggingType; qDebug() << "qtKdeCategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type " << cat.loggingType;
} }
#endif #endif
QCOMPARE(job.qtKdeCategories(), qtkdecategories); QCOMPARE(job.qtKdeCategories(), qtkdecategories);
} }
QTEST_MAIN(LoadCategoriesJobTest) QTEST_MAIN(LoadCategoriesJobTest)
...@@ -36,5 +36,4 @@ private Q_SLOTS: ...@@ -36,5 +36,4 @@ private Q_SLOTS:
void shouldReadRules(); void shouldReadRules();
}; };
#endif // LOADCATEGORIESJOBTEST_H #endif // LOADCATEGORIESJOBTEST_H
...@@ -76,7 +76,7 @@ void ConfigureCustomSettingWidget::setRule(const QString &rule) ...@@ -76,7 +76,7 @@ void ConfigureCustomSettingWidget::setRule(const QString &rule)
const KDebugSettingsUtil::LoadLoggingCategory cat = KDebugSettingsUtil::parseLineLoggingQtCategory(rule); const KDebugSettingsUtil::LoadLoggingCategory cat = KDebugSettingsUtil::parseLineLoggingQtCategory(rule);
mCategoryLineEdit->setText(cat.logName); mCategoryLineEdit->setText(cat.logName);
mEnableCategory->setChecked(cat.enabled); mEnableCategory->setChecked(cat.enabled);
switch(cat.type) { switch (cat.type) {
case KDebugSettingsUtil::LoadLoggingCategory::Unknown: case KDebugSettingsUtil::LoadLoggingCategory::Unknown:
break; break;
case KDebugSettingsUtil::LoadLoggingCategory::Info: case KDebugSettingsUtil::LoadLoggingCategory::Info:
......
...@@ -86,7 +86,7 @@ void CustomDebugSettingsPage::fillList(const LoggingCategory::List &list) ...@@ -86,7 +86,7 @@ void CustomDebugSettingsPage::fillList(const LoggingCategory::List &list)
Q_FOREACH (const LoggingCategory &cat, list) { Q_FOREACH (const LoggingCategory &cat, list) {
QString ruleStr; QString ruleStr;
ruleStr = cat.logName; ruleStr = cat.logName;
switch(cat.loggingType) { switch (cat.loggingType) {
case LoggingCategory::All: case LoggingCategory::All:
break; break;
case LoggingCategory::Info: case LoggingCategory::Info:
...@@ -123,9 +123,9 @@ LoggingCategory::List CustomDebugSettingsPage::rules() ...@@ -123,9 +123,9 @@ LoggingCategory::List CustomDebugSettingsPage::rules()
LoggingCategory tmp; LoggingCategory tmp;
tmp.enabled = cat.enabled; tmp.enabled = cat.enabled;
tmp.logName = cat.logName; tmp.logName = cat.logName;
switch(cat.type) { switch (cat.type) {
case KDebugSettingsUtil::LoadLoggingCategory::Unknown: case KDebugSettingsUtil::LoadLoggingCategory::Unknown:
break; break;
case KDebugSettingsUtil::LoadLoggingCategory::Info: case KDebugSettingsUtil::LoadLoggingCategory::Info:
tmp.loggingType = LoggingCategory::Info; tmp.loggingType = LoggingCategory::Info;
break; break;
......
...@@ -223,7 +223,7 @@ void KDebugSettingsDialog::slotInsertCategories() ...@@ -223,7 +223,7 @@ void KDebugSettingsDialog::slotInsertCategories()
if (!path.isEmpty()) { if (!path.isEmpty()) {
const KdeLoggingCategory::List insertCategoriesList = KDebugSettingsUtil::readLoggingCategoriesForInserting(path, mCategories); const KdeLoggingCategory::List insertCategoriesList = KDebugSettingsUtil::readLoggingCategoriesForInserting(path, mCategories);
LoggingCategory::List newCategories; LoggingCategory::List newCategories;
Q_FOREACH(const KdeLoggingCategory &cat, insertCategoriesList) { Q_FOREACH (const KdeLoggingCategory &cat, insertCategoriesList) {
LoggingCategory loggingCat; LoggingCategory loggingCat;
loggingCat.description = cat.description; loggingCat.description = cat.description;
loggingCat.logName = cat.logName; loggingCat.logName = cat.logName;
......
...@@ -188,8 +188,8 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString ...@@ -188,8 +188,8 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString
if (rulesSections) { if (rulesSections) {
KDebugSettingsUtil::LoadLoggingCategory cat = parseLineLoggingQtCategory(line); KDebugSettingsUtil::LoadLoggingCategory cat = parseLineLoggingQtCategory(line);
qDebug()<<" line "<< line; qDebug() << " line " << line;
qDebug()<<"enable "<<cat.enabled << " valid : "<< cat.isValid(); qDebug() << "enable " << cat.enabled << " valid : " << cat.isValid();
if (cat.isValid()) { if (cat.isValid()) {
if (cat.enabled) { if (cat.enabled) {
KDebugSettingsUtil::LoadLoggingCategory nextCat = hashLoadLoggingCategories.value(cat.logName); KDebugSettingsUtil::LoadLoggingCategory nextCat = hashLoadLoggingCategories.value(cat.logName);
...@@ -208,12 +208,12 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString ...@@ -208,12 +208,12 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString
} else { } else {
KDebugSettingsUtil::LoadLoggingCategory nextCat = hashLoadLoggingCategories.value(cat.logName); KDebugSettingsUtil::LoadLoggingCategory nextCat = hashLoadLoggingCategories.value(cat.logName);
if (!nextCat.isValid()) { if (!nextCat.isValid()) {
cat.enabled =false; cat.enabled = false;
hashLoadLoggingCategories.insert(cat.logName, cat); hashLoadLoggingCategories.insert(cat.logName, cat);
} else { } else {
if (!nextCat.enabled) { if (!nextCat.enabled) {
nextCat.type |= cat.type; nextCat.type |= cat.type;
nextCat.enabled =false; nextCat.enabled = false;
hashLoadLoggingCategories[cat.logName] = nextCat; hashLoadLoggingCategories[cat.logName] = nextCat;
} }
} }
...@@ -235,7 +235,7 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString ...@@ -235,7 +235,7 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString
} else { } else {
cat.loggingType = LoggingCategory::Off; cat.loggingType = LoggingCategory::Off;
} }
qDebug() << "SSSSSSSSSSSSSSSSSS cat.enable"<<cat.enabled; qDebug() << "SSSSSSSSSSSSSSSSSS cat.enable" << cat.enabled;
} else if ((value.type & LoadLoggingCategory::Debug) && } else if ((value.type & LoadLoggingCategory::Debug) &&
(value.type & LoadLoggingCategory::Info) && (value.type & LoadLoggingCategory::Info) &&
(value.type & LoadLoggingCategory::Warning) && (value.type & LoadLoggingCategory::Warning) &&
...@@ -261,7 +261,7 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString ...@@ -261,7 +261,7 @@ LoggingCategory::List KDebugSettingsUtil::readLoggingQtCategories(const QString
} else if (value.type & LoadLoggingCategory::Off) { } else if (value.type & LoadLoggingCategory::Off) {
cat.loggingType = LoggingCategory::Off; cat.loggingType = LoggingCategory::Off;
} else if (value.type & LoadLoggingCategory::Unknown) { } else if (value.type & LoadLoggingCategory::Unknown) {
qDebug()<<" OFF "<< cat.logName; qDebug() << " OFF " << cat.logName;
cat.loggingType = LoggingCategory::Off; cat.loggingType = LoggingCategory::Off;
} }
//qDebug()<<"cat.loggingType"<<cat.loggingType; //qDebug()<<"cat.loggingType"<<cat.loggingType;
......
...@@ -56,9 +56,9 @@ struct LoadLoggingCategory { ...@@ -56,9 +56,9 @@ struct LoadLoggingCategory {
bool operator ==(const LoadLoggingCategory &other) const bool operator ==(const LoadLoggingCategory &other) const
{ {
qDebug()<< " enabled "<< enabled << " other.enabled :"<<other.enabled; qDebug() << " enabled " << enabled << " other.enabled :" << other.enabled;
qDebug()<< " logname "<< logName << " other.logName :"<<other.logName; qDebug() << " logname " << logName << " other.logName :" << other.logName;
qDebug()<<" type"<<type << " other.type "<< other.type; qDebug() << " type" << type << " other.type " << other.type;
return (enabled == other.enabled) && return (enabled == other.enabled) &&
(type == other.type) && (type == other.type) &&
(logName == other.logName); (logName == other.logName);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "kdeloggingcategory.h" #include "kdeloggingcategory.h"
#include "loggingcategory.h" #include "loggingcategory.h"
class LoadCategoriesJob class LoadCategoriesJob
{ {
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment