Merge branch 'master' into qmake
[mdictionary] / tests / XdxfPluginTests / test.cpp
index 429b135..f7bfed6 100644 (file)
@@ -28,6 +28,7 @@ void XdxfTest::getNew() {
     Settings *settings=new Settings;
     settings->setValue("path","../tests/dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QList<Translation*> te6=xdxfPlugin->searchWordList("*",8);
     QCOMPARE(te6.size(),8);
@@ -42,6 +43,7 @@ void XdxfTest::searchFile() {
     Settings *settings=new Settings;
     settings->setValue("path","../tests/dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QCOMPARE(xdxfPlugin->search("."), QString("<key>.</key><t>kropka</t>"));
     QCOMPARE(xdxfPlugin->search("1"), QString("<key>1</key><t>one</t>"));
@@ -58,6 +60,8 @@ void XdxfTest::makeCache()
     settings->setValue("path","../tests/dict.xdxf");
     settings->setValue("generateCache", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
+
     QCOMPARE(xdxfPlugin->settings()->value("cached"),tr("true"));
 
     xdxfPlugin->clean();
@@ -70,6 +74,7 @@ void XdxfTest::searchCache() {
     settings->setValue("path","../tests/dict.xdxf");
     settings->setValue("generateCache", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QCOMPARE(xdxfPlugin->settings()->value("cached"),tr("true"));
     QCOMPARE(xdxfPlugin->search("."), QString("<key>.</key><t>kropka</t>"));
@@ -86,6 +91,7 @@ void XdxfTest::searchWordListCache(){
     settings->setValue("path","../tests/dict.xdxf");
     settings->setValue("generateCache", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QList<Translation*> te = xdxfPlugin->searchWordList(".", 10);
     if(te.size()>0)
@@ -130,6 +136,7 @@ void XdxfTest::searchWordListFile() {
     Settings *settings=new Settings;
     settings->setValue("path","../tests/dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QList<Translation*> te = xdxfPlugin->searchWordList(".", 10);
     if(te.size()>0)
@@ -174,6 +181,7 @@ void XdxfTest::stop() {
     Settings *settings=new Settings;
     settings->setValue("path","../tests/dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QString string("*");
     QFuture<QList<Translation*> > future = QtConcurrent::run(xdxfPlugin,
@@ -187,11 +195,11 @@ void XdxfTest::stop() {
 
 
 void XdxfTest::langFrom() {
-
     XdxfPlugin xdxfPluginB(this);
     Settings *settings=new Settings;
     settings->setValue("path","../tests/dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     QCOMPARE(xdxfPlugin->langFrom(), QString("ENG"));
 
@@ -217,6 +225,7 @@ void XdxfTest::timeCache() {
     settings->setValue("path","../../../../../../dict.xdxf");
     settings->setValue("generateCache", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     out<<"\n<date>" + date.currentDate().toString("dd.MM.yyyy") +" ";
     out<<timer.currentTime().toString(Qt::TextDate) + "</date>";
@@ -264,6 +273,7 @@ void XdxfTest::timeFile() {
     Settings *settings=new Settings;
     settings->setValue("path","../../../../../../dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     timer.start();
     xdxfPlugin->search("Bantu");
@@ -309,6 +319,7 @@ void  XdxfTest::timeCacheNormalize() {
     settings->setValue("generateCache", "true");
     settings->setValue("strip_accents", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     out<<"\n<type> Cache with strip accent </type> <time>" << timer.elapsed();
     out<<"</time>";
@@ -342,6 +353,7 @@ void  XdxfTest::removeAccents() {
 
     XdxfPluginSub xdxf;
     xdxf.settings()->setValue(QString("strip_accents"), QString("true"));
+
     QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("nóżka")), QString("nozka"));
     QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("motor")), QString("motor"));
     QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("nÓżKa")), QString("nozka"));
@@ -372,6 +384,7 @@ void XdxfTest::timeFileNormalize(){
     settings->setValue("path","../../../../../../dict.xdxf");
     settings->setValue("strip_accents", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+    delete settings;
 
     timer.start();
     xdxfPlugin->search("Bantu");
@@ -396,7 +409,6 @@ void XdxfTest::timeFileNormalize(){
     File.close();
     xdxfPlugin->clean();
     delete xdxfPlugin;
-
 }
 
 QTEST_MAIN(XdxfTest)