QCOMPARE(te11.at(0)->key(), QString("house"));
xdxfPlugin->clean();
+ QList<Translation*> te12 = xdxfPlugin->searchWordList("1",10);
+ QCOMPARE(te2.size(), 5);
+
delete xdxfPlugin;
}
delete settings;
QCOMPARE(xdxfPlugin->langFrom(), QString("ENG"));
+ QCOMPARE(xdxfPlugin->langTo(), QString("POL"));
+ QCOMPARE(xdxfPlugin->name(), QString("English-Polish dictionary"));
+ QCOMPARE(xdxfPlugin->infoNote(), QString("Copyright: http://www.freelang.net/dictionary/; Version: 1.0"));
+ QCOMPARE(xdxfPlugin->type(), QString("xdxf"));
xdxfPlugin->clean();
delete xdxfPlugin;
}
+void XdxfTest::isAvailable() {
+ XdxfPlugin xdxfPluginB(this);
+ Settings *settings=new Settings;
+ settings->setValue("path","../XdxfPluginTests/dict.xdxf");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+ delete settings;
+
+ QCOMPARE(xdxfPlugin->isAvailable(), true);
+
+ xdxfPlugin->clean();
+ delete xdxfPlugin;
+}
+
+void XdxfTest::removeAccents() {
+ qDebug()<<"\n";
+ 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"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("ławka")), QString("lawka"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("éàèùâêîôûëïüÿäöüç")), QString("eaeuaeioueiuyaouc"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("íőűúó")), QString("iouuo"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("-ę")), QString("-e"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\"e\"")), QString("\"e\""));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("'e'")), QString("'e'"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\\e")), QString("e"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\\")), QString(""));
+}
+
void XdxfTest::timeCache() {
qDebug()<<"\n";
QTime timer;
qDebug()<<"Error: could not open file";
return;
}
- if(!QFile::exists("../../../../../../dict.xdxf")) {
+ if(!QFile::exists("../../../dict.xdxf")) {
qDebug()<<"Error: could not open dict file";
return;
}
timer.start();
XdxfPlugin xdxfPluginB(this);
Settings *settings=new Settings;
- settings->setValue("path","../../../../../../dict.xdxf");
+ settings->setValue("path","../../../dict.xdxf");
settings->setValue("generateCache", "true");
CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
delete settings;
void XdxfTest::timeFile() {
qDebug()<<"\n";
QTime timer;
- QDate date;
QFile File("../XdxfPluginTests/time.xml");
if(!File.open(QFile::ReadWrite | QFile::Text)) {
qDebug()<<"Error: could not open file";
return;
}
- if(!QFile::exists("../../../../../../dict.xdxf")) {
+ if(!QFile::exists("../../../dict.xdxf")) {
qDebug()<<"Error: could not open dict file";
return;
}
XdxfPlugin xdxfPluginB(this);
Settings *settings=new Settings;
- if(!QFile::exists("../../../../../../dict.xdxf"))
+ if(!QFile::exists("../../../dict.xdxf"))
return;
- settings->setValue("path","../../../../../../dict.xdxf");
+ settings->setValue("path","../../../dict.xdxf");
CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
delete settings;
void XdxfTest::timeCacheNormalize() {
qDebug()<<"\n";
QTime timer;
- QDate date;
QFile File("../XdxfPluginTests/time.xml");
if(!File.open(QFile::ReadWrite | QFile::Text)) {
qDebug()<<"Error: could not open file";
return;
}
- if(!QFile::exists("../../../../../../dict.xdxf")) {
+ if(!QFile::exists("../../../dict.xdxf")) {
qDebug()<<"Error: could not open dict file";
return;
}
XdxfPlugin xdxfPluginB(this);
Settings *settings=new Settings;
- settings->setValue("path","../../../../../../dict.xdxf");
+ settings->setValue("path","../../../dict.xdxf");
settings->setValue("generateCache", "true");
settings->setValue("strip_accents", "true");
CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
delete xdxfPlugin;
}
-void XdxfTest::removeAccents() {
- qDebug()<<"\n";
- 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"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("ławka")), QString("lawka"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("éàèùâêîôûëïüÿäöüç")), QString("eaeuaeioueiuyaouc"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("íőűúó")), QString("iouuo"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("-ę")), QString("-e"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\"e\"")), QString("\"e\""));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("'e'")), QString("'e'"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\\e")), QString("e"));
- QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\\")), QString(""));
-}
-
void XdxfTest::timeFileNormalize(){
qDebug()<<"\n";
QTime timer;
- QDate date;
QFile File("../XdxfPluginTests/time.xml");
if(!File.open(QFile::ReadWrite | QFile::Text)) {
qDebug()<<"Error: could not open file";
return;
}
- if(!QFile::exists("../../../../../../dict.xdxf")) {
+ if(!QFile::exists("../../../dict.xdxf")) {
qDebug()<<"Error: could not open dict file";
return;
}
XdxfPlugin xdxfPluginB(this);
Settings *settings=new Settings;
- settings->setValue("path","../../../../../../dict.xdxf");
+ settings->setValue("path","../../../dict.xdxf");
settings->setValue("strip_accents", "true");
CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
delete settings;