Changed repo structure
[mdictionary] / tests / GooglePluginTests / test.cpp
diff --git a/tests/GooglePluginTests/test.cpp b/tests/GooglePluginTests/test.cpp
new file mode 100644 (file)
index 0000000..36492bd
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+#include "test.h"
+#include <QSignalSpy>
+
+void GoogleTest::jsonParse() {
+
+    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)