X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=tests%2FGooglePluginTests%2Ftest.cpp;fp=tests%2FGooglePluginTests%2Ftest.cpp;h=36492bd01adde2f5caa2cef4ef7b9bd2191391c3;hb=6552e14c830b3de28e1688b8a6b94c09317beac1;hp=0000000000000000000000000000000000000000;hpb=2f693ba9e3e37066174eed087b8c293f85851431;p=mdictionary diff --git a/tests/GooglePluginTests/test.cpp b/tests/GooglePluginTests/test.cpp new file mode 100644 index 0000000..36492bd --- /dev/null +++ b/tests/GooglePluginTests/test.cpp @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +#include "test.h" +#include + +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
rzeczownik:kot, kotka, kociątko, złośliwa kobieta
czasownik:podnieść")); + QCOMPARE(plugin.jsonParse(test2),QString("Go! wyjechać
czasownik:wyjechać, odchodzić, zgrzeszyć
wykrzyknik:Odejdź")); +} + + +void GoogleTest::getDictionaryInfo() { + GooglePlugin plugin; + plugin.setLangFrom("pl"); + plugin.setLangTo("en"); + plugin.getDictionaryInfo(); + + QCOMPARE(plugin.infoNote(),QString(" [Polish-English] (Google)" )); +} + +QTEST_MAIN(GoogleTest)