summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-06-22 08:53:27 +0200
committerMontel Laurent <[email protected]>2016-06-22 08:53:27 +0200
commitc19008331d44a89092552d85586e433672ea86aa (patch)
tree9e60b97566aa63e51b54e56c4abe7952a317d012
parent540fac6ae1f073a0bdbaddf0584edda13aa7970e (diff)
Add autotest for customcategories
-rw-r--r--autotests/data/oneelementdebugandanextract.ini7
-rw-r--r--autotests/loadcategoriesjobtest.cpp23
2 files changed, 30 insertions, 0 deletions
diff --git a/autotests/data/oneelementdebugandanextract.ini b/autotests/data/oneelementdebugandanextract.ini
new file mode 100644
index 0000000..7b727e3
--- /dev/null
+++ b/autotests/data/oneelementdebugandanextract.ini
@@ -0,0 +1,7 @@
+[Rules]
+org.kde.kio.kpasswdserver.warning=true
+org.kde.kio.kpasswdserver.debug=true
+org.kde.kio.kpasswdserver.info=false
+org.kde.kio.kpasswdserver.critical=true
+
+toto.critical=true
diff --git a/autotests/loadcategoriesjobtest.cpp b/autotests/loadcategoriesjobtest.cpp
index 7a47be0..798dcde 100644
--- a/autotests/loadcategoriesjobtest.cpp
+++ b/autotests/loadcategoriesjobtest.cpp
@@ -330,6 +330,18 @@ void LoadCategoriesJobTest::shouldReadRules_data()
<< LoggingCategory::List()
<< qtKdeCategories;
+ // Test with extract elements
+ LoggingCategory::List customCategories;
+ LoggingCategory customTmp;
+ customTmp.logName = QStringLiteral("toto");
+ customTmp.loggingType = LoggingCategory::Critical;
+ customTmp.enabled = true;
+ customCategories.append(tmp);
+
+ QTest::newRow("oneelementdebugandanextract") << QStringLiteral("oneelementdebugandanextract.ini") << QStringLiteral("correct.categories") << false
+ << customCategories
+ << qtKdeCategories;
+
}
void LoadCategoriesJobTest::shouldReadRules()
@@ -354,6 +366,17 @@ void LoadCategoriesJobTest::shouldReadRules()
job.start();
QCOMPARE(job.customCategories().count(), customcategories.count());
+
+
+ Q_FOREACH(const LoggingCategory &cat, job.customCategories()) {
+ qDebug() << "customcategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type "<<cat.loggingType;
+ }
+
+ qDebug() << "AFTER";
+ Q_FOREACH(const LoggingCategory &cat, customcategories) {
+ qDebug() << "qtKdeCategories cat." << cat.description << " logname" << cat.logName << " enabled " << cat.enabled << "type "<<cat.loggingType;
+ }
+
QCOMPARE(job.customCategories(), customcategories);
QCOMPARE(job.foundOverrideRule(), foundoverriderules);