changed the format of translation display
[mdictionary] / trunk / src / plugins / xdxf / tests / test.cpp
index 4e43c2e..8500794 100644 (file)
@@ -40,9 +40,9 @@ void XdxfTest::searchFile() {
     settings->setValue("path","../tests/dict.xdxf");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
 
-    QCOMPARE(xdxfPlugin->search("."), QString("<t>kropka</t>"));
-    QCOMPARE(xdxfPlugin->search("1"), QString("<t>one</t>"));
-    QCOMPARE(xdxfPlugin->search("test"), QString("<t><c c=\"FF00FF\">kro</c>test01<pos>krowa</pos></t>"));
+    QCOMPARE(xdxfPlugin->search("."), QString("<key>.</key><t>kropka</t>"));
+    QCOMPARE(xdxfPlugin->search("1"), QString("<key>1</key><t>one</t>"));
+    QCOMPARE(xdxfPlugin->search("test"), QString("<key>test</key><t><c c=\"FF00FF\">kro</c>test01<pos>krowa</pos></t>"));
 }
 
 void XdxfTest::makeCache()
@@ -53,6 +53,7 @@ void XdxfTest::makeCache()
     settings->setValue("generateCache", "true");
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
     QCOMPARE(xdxfPlugin->settings()->value("cached"),tr("true"));
+    delete xdxfPlugin;
 }
 
 void XdxfTest::searchCache() {
@@ -63,9 +64,11 @@ void XdxfTest::searchCache() {
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
 
     QCOMPARE(xdxfPlugin->settings()->value("cached"),tr("true"));
-    QCOMPARE(xdxfPlugin->search("."), QString("<t>kropka</t>"));
-    QCOMPARE(xdxfPlugin->search("1"), QString("<t>one</t>"));
-    QCOMPARE(xdxfPlugin->search("test"), QString("<t><c c=\"FF00FF\">kro</c>test01<pos>krowa</pos></t>"));
+    QCOMPARE(xdxfPlugin->search("."), QString("<key>.</key><t>kropka</t>"));
+    QCOMPARE(xdxfPlugin->search("1"), QString("<key>1</key><t>one</t>"));
+    QCOMPARE(xdxfPlugin->search("test"), QString("<key>test</key><t><c c=\"FF00FF\">kro</c>test01<pos>krowa</pos></t>"));
+
+    delete xdxfPlugin;
 }
 
 void XdxfTest::searchWordListCache(){
@@ -107,6 +110,8 @@ void XdxfTest::searchWordListCache(){
 
     QList<Translation*> te11 = xdxfPlugin->searchWordList("h**?*?**e");
         QCOMPARE(te11.at(0)->key(), QString("house"));
+
+    delete xdxfPlugin;
 }
 
 void XdxfTest::searchWordListFile() {
@@ -149,6 +154,7 @@ void XdxfTest::searchWordListFile() {
     QList<Translation*> te11 = xdxfPlugin->searchWordList("h**?*?**e");
         QCOMPARE(te11.at(0)->key(), QString("house"));
 
+    delete xdxfPlugin;
 }
 
 void XdxfTest::stop() {
@@ -163,6 +169,8 @@ void XdxfTest::stop() {
     QFuture<QList<Translation*> > future = QtConcurrent::run(xdxfPlugin, &CommonDictInterface::searchWordList, string, 10);
     QList<Translation*> te5 = future.result();
     QCOMPARE(te5.size(), 9);
+
+    delete xdxfPlugin;
 }
 
 
@@ -174,6 +182,8 @@ void XdxfTest::langFrom() {
     CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
 
     QCOMPARE(xdxfPlugin->langFrom(), QString("ENG"));
+
+    delete xdxfPlugin;
 }
 
 QTEST_MAIN(XdxfTest)