Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
[mdictionary] / trunk / src / plugins / google / tests / test.cpp
index 09924e0..36492bd 100644 (file)
 #include "test.h"
 #include <QSignalSpy>
 
-void GoogleTest::getNew() {
+void GoogleTest::jsonParse() {
 
-    GooglePlugin googlePlugin(this);
-    Settings *settings=new Settings;
-    settings->setValue("langFrom","pl");
-    settings->setValue("langTo","en");
+    GooglePlugin plugin;
+    QString test1("[[[\"kot\",\"cat\",\"\"]],[[\"rzeczownik\",[\"kot\",\"kotka\",\"kociątko\",\"złośliwa kobieta\"]],[\"czasownik\",[\"podnieść\"]]],\"en\"]");
+    QString test2("[[[\"Go! \",\"go!\",\"\"],[\"wyjechać\",\"go away\",\"\"]],[[\"czasownik\",[\"wyjechać\",\"odchodzić\",\"zgrzeszyć\"]],[\"wykrzyknik\",[\"Odejdź\"]]],\"en\"]");
+    QString test3("");
+    QString test4("");
+    QString test5("");
+
+    QCOMPARE(plugin.jsonParse(test1),QString("kot<br/><pos>rzeczownik</pos>:kot, kotka, kociątko, złośliwa kobieta<br/><pos>czasownik</pos>:podnieść"));
+    QCOMPARE(plugin.jsonParse(test2),QString("Go! wyjechać<br/><pos>czasownik</pos>:wyjechać, odchodzić, zgrzeszyć<br/><pos>wykrzyknik</pos>:Odejdź"));
+}
+
+
+void GoogleTest::getDictionaryInfo() {
+    GooglePlugin plugin;
+    plugin.setLangFrom("pl");
+    plugin.setLangTo("en");
+    plugin.getDictionaryInfo();
+
+    QCOMPARE(plugin.infoNote(),QString(" [Polish-English] (Google)" ));
 }
 
 QTEST_MAIN(GoogleTest)