Changed repo structure
[mdictionary] / tests / GooglePluginTests / test.cpp
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
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.
9
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.
14
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/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21
22 #include "test.h"
23 #include <QSignalSpy>
24
25 void GoogleTest::jsonParse() {
26
27     GooglePlugin plugin;
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\"]");
30     QString test3("");
31     QString test4("");
32     QString test5("");
33
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ź"));
36 }
37
38
39 void GoogleTest::getDictionaryInfo() {
40     GooglePlugin plugin;
41     plugin.setLangFrom("pl");
42     plugin.setLangTo("en");
43     plugin.getDictionaryInfo();
44
45     QCOMPARE(plugin.infoNote(),QString(" [Polish-English] (Google)" ));
46 }
47
48 QTEST_MAIN(GoogleTest)