#include "test.h"
#include <QSignalSpy>
+void XdxfTest::getNew() {
+ XdxfPlugin xdxfPlugin(this);
+ Settings *settings=new Settings;
+ settings->setValue("path","dict.xdxf");
+ CommonDictInterface *xdxfPlugin2 = xdxfPlugin.getNew(settings);
+ QList<Translation*> te6=xdxfPlugin2->searchWordList("*",8);
+ QCOMPARE(te6.size(),8);
+}
+
void XdxfTest::search() {
/*test for English-Polish dictionary */
- XdxfPlugin xdxfPlugin(this);
- xdxfPlugin.setPatch("dict.xdxf");
- xdxfPlugin.search("wino");
- QCOMPARE(xdxfPlugin.search("."), QString("kropka\n"));
- QCOMPARE(xdxfPlugin.search("1"), QString("one\n"));
+ XdxfPlugin xdxfPluginB(this);
+// xdxfPlugin.setPatch("dict.xdxf");
+
+ Settings *settings=new Settings;
+ settings->setValue("path","dict.xdxf");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+ xdxfPlugin->search("wino");
+ QCOMPARE(xdxfPlugin->search("."), QString("kropka\n"));
+ QCOMPARE(xdxfPlugin->search("1"), QString("one\n"));
}
void XdxfTest::searchWordList() {
/*test for English-Polish dictionary */
- XdxfPlugin xdxfPlugin(this);
- xdxfPlugin.setPatch("dict.xdxf");
- QList<Translation*> te=xdxfPlugin.searchWordList(".",10);
+ XdxfPlugin xdxfPluginB(this);
+// xdxfPlugin.setPatch("dict.xdxf");
+
+ Settings *settings=new Settings;
+ settings->setValue("path","dict.xdxf");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+ QList<Translation*> te=xdxfPlugin->searchWordList(".",10);
if(te.size()>0)
QCOMPARE(te.at(0)->key(), QString("."));
- QList<Translation*> te2=xdxfPlugin.searchWordList("1",10);
+ QList<Translation*> te2=xdxfPlugin->searchWordList("1",10);
QCOMPARE(te2.size(),5);
- QList<Translation*> te3=xdxfPlugin.searchWordList("1",2);
+ QList<Translation*> te3=xdxfPlugin->searchWordList("1",2);
QCOMPARE(te3.size(),2);
- QList<Translation*> te4=xdxfPlugin.searchWordList("ho*SE",10);
+ QList<Translation*> te4=xdxfPlugin->searchWordList("ho*SE",10);
QCOMPARE(te4.at(0)->key(), QString("house"));
- QList<Translation*> te5=xdxfPlugin.searchWordList("*");
+ QList<Translation*> te5=xdxfPlugin->searchWordList("*");
QCOMPARE(te5.size(),8);
- QList<Translation*> te6=xdxfPlugin.searchWordList("*",8);
+ QList<Translation*> te6=xdxfPlugin->searchWordList("*",8);
QCOMPARE(te6.size(),8);
}
void XdxfTest::stop() {
/*test for English-Polish dictionary */
- CommonDictInterface *xdxfPlugin = new XdxfPlugin(this);
- xdxfPlugin.setPatch("dict.xdxf");
+ XdxfPlugin xdxfPluginB(this);
+// xdxfPlugin.setPatch("dict.xdxf");
+
+ Settings *settings=new Settings;
+ settings->setValue("path","dict.xdxf");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
QString string("*");
QFuture<QList<Translation*> > future = QtConcurrent::run(xdxfPlugin, &CommonDictInterface::searchWordList, string, 10);
QCOMPARE(te5.size(),8);
}
-void XdxfTest::getNew() {
- XdxfPlugin xdxfPlugin(this);
- Settings *settings=new Settings;
- settings->setValue("path","dict.xdxf");
- CommonDictInterface *xdxfPlugin2 = xdxfPlugin.getNew(settings);
- QList<Translation*> te6=xdxfPlugin2->searchWordList("*",8);
- QCOMPARE(te6.size(),8);
-}
void XdxfTest::langFrom() {
/*test for English-Polish dictionary */
- XdxfPlugin xdxfPlugin(this);
- xdxfPlugin.setPatch("dict.xdxf");
- xdxfPlugin.searchWordList("rope",10);
- QCOMPARE(xdxfPlugin.langFrom(), QString("ENG"));
+ XdxfPlugin xdxfPluginB(this);
+// xdxfPlugin.setPatch("dict.xdxf");
+
+ Settings *settings=new Settings;
+ settings->setValue("path","dict.xdxf");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+ xdxfPlugin->searchWordList("rope",10);
+ QCOMPARE(xdxfPlugin->langFrom(), QString("ENG"));
}
QTEST_MAIN(XdxfTest)