From: Jakub Jaszczynski Date: Fri, 6 Aug 2010 08:02:25 +0000 (+0200) Subject: in XdxfPlugin in function searchWordList add unlimited number of words X-Git-Tag: 0.4~98 X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=fec5ea15d5e56fc038a33c29946b6e37a65bf577;p=mdictionary in XdxfPlugin in function searchWordList add unlimited number of words --- diff --git a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp index bc0622e..91f24fe 100644 --- a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp +++ b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp @@ -104,7 +104,7 @@ QList XdxfPlugin::searchWordList(QString word, int limit) { dictionaryReader.readNextStartElement(); if(!dictionaryReader.atEnd()) a = dictionaryReader.readElementText(); - if(regWord.exactMatch(a) && i searchWordList(QString word, int limit); + QList searchWordList(QString word, int limit=0); //! stop current operation void stop(); diff --git a/trunk/src/plugins/xdxf/tests/test.cpp b/trunk/src/plugins/xdxf/tests/test.cpp index c5d5337..8ecf8bc 100644 --- a/trunk/src/plugins/xdxf/tests/test.cpp +++ b/trunk/src/plugins/xdxf/tests/test.cpp @@ -22,31 +22,52 @@ #include "test.h" #include -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 te=xdxfPlugin.searchWordList("Adventeee",10); + QList te=xdxfPlugin.searchWordList(".",10); if(te.size()>0) - QCOMPARE(te.at(0)->key(), QString("Advent")); + QCOMPARE(te.at(0)->key(), QString(".")); + QList te2=xdxfPlugin.searchWordList("1",10); + QCOMPARE(te2.size(),5); + + QList te3=xdxfPlugin.searchWordList("1",2); + QCOMPARE(te3.size(),2); + + QList te4=xdxfPlugin.searchWordList("ho*SE",10); + QCOMPARE(te4.at(0)->key(), QString("house")); + + QList te5=xdxfPlugin.searchWordList("*",0); + QCOMPARE(te5.size(),8); + + QList 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*/ diff --git a/trunk/src/plugins/xdxf/tests/test.h b/trunk/src/plugins/xdxf/tests/test.h index 45c5fd1..484d6ff 100644 --- a/trunk/src/plugins/xdxf/tests/test.h +++ b/trunk/src/plugins/xdxf/tests/test.h @@ -23,13 +23,12 @@ #define TEST_H #include -#include "../src/XdxfPlugin/xdxfplugin.h" -#include "../src/XdxfPlugin/TranslationXdxf.h" -#include "../../../includes/translation.h" - #include #include + +#include "../src/xdxfplugin.h" + class Testowanie: public QObject { Q_OBJECT @@ -39,6 +38,7 @@ void search(); void searchWordList(); void langFrom(); + void getNew(); }; diff --git a/trunk/src/plugins/xdxf/tests/unit_tests.pro b/trunk/src/plugins/xdxf/tests/unit_tests.pro index f771321..4bf930c 100644 --- a/trunk/src/plugins/xdxf/tests/unit_tests.pro +++ b/trunk/src/plugins/xdxf/tests/unit_tests.pro @@ -8,12 +8,18 @@ INCLUDEPATH += . # 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