1 /*******************************************************************************
3 This file is part of mDictionary.
5 mDictionary is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 mDictionary is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
25 void XdxfTest::search() {
26 /*test for English-Polish dictionary */
27 XdxfPlugin xdxfPlugin(this);
28 xdxfPlugin.search("wino");
29 QCOMPARE(xdxfPlugin.search("."), QString("kropka\n"));
30 QCOMPARE(xdxfPlugin.search("1"), QString("one\n"));
33 void XdxfTest::searchWordList() {
34 /*test for English-Polish dictionary */
35 XdxfPlugin xdxfPlugin(this);
36 QList<Translation*> te=xdxfPlugin.searchWordList(".",10);
38 QCOMPARE(te.at(0)->key(), QString("."));
39 QList<Translation*> te2=xdxfPlugin.searchWordList("1",10);
40 QCOMPARE(te2.size(),5);
42 QList<Translation*> te3=xdxfPlugin.searchWordList("1",2);
43 QCOMPARE(te3.size(),2);
45 QList<Translation*> te4=xdxfPlugin.searchWordList("ho*SE",10);
46 QCOMPARE(te4.at(0)->key(), QString("house"));
48 QList<Translation*> te5=xdxfPlugin.searchWordList("*");
49 QCOMPARE(te5.size(),8);
51 QList<Translation*> te6=xdxfPlugin.searchWordList("*",8);
52 QCOMPARE(te6.size(),8);
57 void XdxfTest::getNew() {
58 /* XdxfPlugin xdxfPlugin(this);
60 settings.setValue("path","dict2");
61 XdxfPlugin * = xdxfPlugin.getNew(settings);
65 void XdxfTest::stop() {
66 /*test for English-Polish dictionary */
67 CommonDictInterface *xdxfPlugin = new XdxfPlugin(this);
70 QFuture<QList<Translation*> > future = QtConcurrent::run(xdxfPlugin, &CommonDictInterface::searchWordList, string, 10);
71 QList<Translation*> te5 = future.result();
73 QCOMPARE(te5.size(),8);
76 void XdxfTest::langFrom() {
77 /*test for English-Polish dictionary */
78 XdxfPlugin xdxfPlugin(this);
79 xdxfPlugin.searchWordList("rope",10);
80 QCOMPARE(xdxfPlugin.langFrom(), QString("ENG"));
84 //#include "testqstring.moc"