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 GoogleTest::jsonParse() {
28 QString test1("[[[\"kot\",\"cat\",\"\"]],[[\"rzeczownik\",[\"kot\",\"kotka\",\"kociątko\",\"złośliwa kobieta\"]],[\"czasownik\",[\"podnieść\"]]],\"en\"]");
29 QString test2("[[[\"Go! \",\"go!\",\"\"],[\"wyjechać\",\"go away\",\"\"]],[[\"czasownik\",[\"wyjechać\",\"odchodzić\",\"zgrzeszyć\"]],[\"wykrzyknik\",[\"Odejdź\"]]],\"en\"]");
34 QCOMPARE(plugin.jsonParse(test1),QString("kot<br/><pos>rzeczownik</pos>: kot, kotka, kociątko, złośliwa kobieta<br/><pos>czasownik</pos>: podnieść"));
35 QCOMPARE(plugin.jsonParse(test2),QString("Go! wyjechać<br/><pos>czasownik</pos>: wyjechać, odchodzić, zgrzeszyć<br/><pos>wykrzyknik</pos>: Odejdź"));
39 void GoogleTest::getDictionaryInfo() {
41 plugin.setLangFrom("pl");
42 plugin.setLangTo("en");
43 plugin.getDictionaryInfo();
45 QCOMPARE(plugin.infoNote(),QString(" [Polish-English] " ));
48 void GoogleTest::langFrom() {
50 Settings *settings=new Settings;
51 settings->setValue("lang_to","pl");
52 settings->setValue("lang_from","en");
53 plugin.setSettings(settings);
56 QCOMPARE(plugin.langFrom(),QString("English"));
57 QCOMPARE(plugin.langTo(),QString("Polish"));
58 QCOMPARE(plugin.type(),QString("google"));
61 void GoogleTest::getNew() {
63 Settings *settings=new Settings;
64 settings->setValue("lang_to","pl");
65 settings->setValue("lang_from","en");
66 CommonDictInterface *test=plugin.getNew(settings);
69 QCOMPARE(test->langFrom(),QString("English"));
70 QCOMPARE(test->langTo(),QString("Polish"));
71 QCOMPARE(test->type(),QString("google"));
76 QTEST_MAIN(GoogleTest)