dictionaryReader.readNextStartElement();
if(!dictionaryReader.atEnd())
a = dictionaryReader.readElementText();
- if(regWord.exactMatch(a) && i<limit) {
+ if(regWord.exactMatch(a) && (i<limit || limit==0)) {
bool ok=true;
Translation *tran;
foreach(tran,translations)
temp+=dictionaryReader.text().toString();
}
}
- resultString+=temp.replace("\n","");
+ resultString+=temp.replace("\n","")+"\n";
match=false;
}
}
#include "test.h"
#include <QSignalSpy>
-void Testowanie::search()
-{
+void Testowanie::search() {
+ /*test for English-Polish dictionary */
XdxfPlugin xdxfPlugin(this);
xdxfPlugin.search("wino");
-// QCOMPARE(xdxfPlugin.search("afera"), QString("scam"));
-// QCOMPARE(xdxfPlugin.search("grzech"), QString("sin"));
- QCOMPARE(xdxfPlugin.search("Advent"), QString("Adwent"));
+ QCOMPARE(xdxfPlugin.search("."), QString("kropka\n"));
+ QCOMPARE(xdxfPlugin.search("1"), QString("one\n"));
}
-void Testowanie::searchWordList()
-{
+void Testowanie::searchWordList() {
+ /*test for English-Polish dictionary */
XdxfPlugin xdxfPlugin(this);
- QList<Translation*> te=xdxfPlugin.searchWordList("Adventeee",10);
+ QList<Translation*> te=xdxfPlugin.searchWordList(".",10);
if(te.size()>0)
- QCOMPARE(te.at(0)->key(), QString("Advent"));
+ QCOMPARE(te.at(0)->key(), QString("."));
+ QList<Translation*> te2=xdxfPlugin.searchWordList("1",10);
+ QCOMPARE(te2.size(),5);
+
+ QList<Translation*> te3=xdxfPlugin.searchWordList("1",2);
+ QCOMPARE(te3.size(),2);
+
+ QList<Translation*> te4=xdxfPlugin.searchWordList("ho*SE",10);
+ QCOMPARE(te4.at(0)->key(), QString("house"));
+
+ QList<Translation*> te5=xdxfPlugin.searchWordList("*",0);
+ QCOMPARE(te5.size(),8);
+
+ QList<Translation*> te6=xdxfPlugin.searchWordList("*",8);
+ QCOMPARE(te6.size(),8);
+
}
-void Testowanie::langFrom()
-{
+
+void Testowanie::getNew() {
+/* XdxfPlugin xdxfPlugin(this);
+ Settings settings;
+ settings.setValue("path","dict2");
+ XdxfPlugin * = xdxfPlugin.getNew(settings);
+*/
+}
+
+void Testowanie::langFrom() {
+ /*test for English-Polish dictionary */
XdxfPlugin xdxfPlugin(this);
xdxfPlugin.searchWordList("rope",10);
- QCOMPARE(xdxfPlugin.langFrom(), QString("POL"));
+ QCOMPARE(xdxfPlugin.langFrom(), QString("ENG"));
}
QTEST_MAIN(Testowanie)
//#include "testqstring.moc"
-
-/*duze i małe litery*/
# Input
HEADERS += test.h \
- ../src/XdxfPlugin/xdxfplugin.h \
- ../src/XdxfPlugin/TranslationXdxf.h \
+ ../src/xdxfplugin.h \
+ ../src/TranslationXdxf.h \
../../../includes/translation.h \
../../../includes/settings.h \
- ../../../includes/CommonDictInterface.h
+ ../../../includes/DictDialog.h \
+ ../../../includes/CommonDictInterface.h \
+ ../src/XdxfDictDialog.h \
+ ../src/XdxfLoadDialog.h
+
SOURCES += test.cpp \
- ../src/XdxfPlugin/xdxfplugin.cpp \
- ../src/XdxfPlugin/TranslationXdxf.cpp
+ ../src/xdxfplugin.cpp \
+ ../src/TranslationXdxf.cpp \
+ ../src/XdxfLoadDialog.cpp \
+ ../src/XdxfDictDialog.cpp