Changed repo structure
[mdictionary] / tests / mDictionaryTests / CommonDictInterfaceMock.h
diff --git a/tests/mDictionaryTests/CommonDictInterfaceMock.h b/tests/mDictionaryTests/CommonDictInterfaceMock.h
new file mode 100644 (file)
index 0000000..69116ac
--- /dev/null
@@ -0,0 +1,81 @@
+/*******************************************************************************
+
+    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.
+
+*******************************************************************************/
+
+/*! /file CommonDictInterfaceMock.h
+\brief Mock for dictionary/plugin behaviour testing
+
+\author Bartosz Szatkowski <bulislaw@linux.com>
+*/
+
+
+
+
+#ifndef COMMONDICTINTERFACEMOCK_H
+#define COMMONDICTINTERFACEMOCK_H
+
+#include "../../src/includes/CommonDictInterface.h"
+#include "TranslationMock.h"
+
+/*! CommonDictInterfaceMock simulates dict/plugin behaviour without any
+  non-testMock dependencies, files, etc.*/
+class CommonDictInterfaceMock : public CommonDictInterface
+{
+public:
+    QString fromv, tov, namev, typev, infoNotev;
+    bool available,stopped;
+    uint _hash;
+    CommonDictInterfaceMock(QObject* parent = 0) :
+            CommonDictInterface(parent) {}
+
+    QString langFrom () const { return fromv; }
+    QString langTo() const {return tov;}
+    QString name() const { return namev;}
+    QString type() const {return typev;}
+    QString infoNote() const {return infoNotev;}
+    QDialog* loadDialog() {return 0;}
+    QDialog* settingsDialog() {return 0;}
+    CommonDictInterface* getNew(const Settings *) const { return 0;}
+    bool isAvailable() const {return available;}
+    uint hash() const { return _hash;}
+    void setHash(uint h) {_hash = h;}
+    void stop() {stopped = 1;}
+    QIcon* icon(){return 0;}
+    QString search(QString key) {return "";}
+    QList<Translation*> searchWordList(QString word, int limit) {
+        stopped = 0;
+        QList<Translation*> list;
+
+        TranslationMock *tm = new TranslationMock();
+        tm->_key = langFrom();
+        tm->_translation = langTo();
+        TranslationMock *tm1 = new TranslationMock();
+        tm1->_key = name();
+        tm1->_translation = type();
+        list << tm << tm1;
+
+        return list;
+    }
+    DictDialog* dictDialog() {return 0;}
+    Settings* settings() {return 0;}
+
+};
+
+#endif // COMMONDICTINTERFACEMOCK_H