From 3439d0a72bc47ca904b8bdee0cf15f67485bdca4 Mon Sep 17 00:00:00 2001 From: Jakub Jaszczynski Date: Fri, 6 Aug 2010 15:17:57 +0200 Subject: [PATCH] add test: getNew() in xdxf plugin, and add some comments --- trunk/src/includes/CommonDictInterface.h | 6 +++--- trunk/src/includes/settings.h | 2 +- trunk/src/plugins/xdxf/src/xdxfplugin.h | 13 +++++++++++++ trunk/src/plugins/xdxf/tests/test.cpp | 18 +++++++++--------- trunk/src/plugins/xdxf/tests/test.h | 1 + 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/trunk/src/includes/CommonDictInterface.h b/trunk/src/includes/CommonDictInterface.h index 83571e4..f3c322a 100644 --- a/trunk/src/includes/CommonDictInterface.h +++ b/trunk/src/includes/CommonDictInterface.h @@ -60,7 +60,7 @@ class CommonDictInterface : public QObject { virtual DictDialog* dictDialog() = 0; - //! return new, clean copy of plugin with setting set as in Settings* + //! returns new, clean copy of plugin with setting set as in Settings* virtual CommonDictInterface* getNew(const Settings*) const = 0; //! returns whether plugin can start searching @@ -72,7 +72,7 @@ class CommonDictInterface : public QObject { //! \returns unique value (unique for every dictionary not plugin virtual uint hash() const = 0; - //! set unique value (unique for every dictionary not plugin) + //! sets unique value (unique for every dictionary not plugin) virtual void setHash(uint) = 0; //! returns current plugin settings @@ -89,7 +89,7 @@ class CommonDictInterface : public QObject { */ virtual QList searchWordList(QString word, int limit=0) = 0; - //! stop current operation + //! stops current operation virtual void stop() = 0; Q_SIGNALS: diff --git a/trunk/src/includes/settings.h b/trunk/src/includes/settings.h index 4486492..d2f6089 100644 --- a/trunk/src/includes/settings.h +++ b/trunk/src/includes/settings.h @@ -35,7 +35,7 @@ class Settings { public: Settings(){} - /*! \retrun value fo given key + /*! \returns value fo given key \param key */ QString value(const QString key) const { diff --git a/trunk/src/plugins/xdxf/src/xdxfplugin.h b/trunk/src/plugins/xdxf/src/xdxfplugin.h index 4feb602..b0a0b65 100644 --- a/trunk/src/plugins/xdxf/src/xdxfplugin.h +++ b/trunk/src/plugins/xdxf/src/xdxfplugin.h @@ -91,17 +91,30 @@ public Q_SLOTS: void stop(); private: +/*! returns true or false depending on whether the dictionary is cached + or not, not implemented yet + */ bool isCached(); + +//! sets the path to dictionary file and adds it to settings void setPath(QString); + + //! language from which we translate QString _langFrom; + //! language to which we translate QString _langTo; + //! name of a dictionary QString _name; + //! type of a dictionary QString _type; + //! information about dictionary QString _infoNote; QDialog *_loadDialog; QDialog *_settingsDialog; + //! path to dictionary file QString path; uint _hash; + volatile bool stopped; Settings *_settings; XdxfDictDialog* _dictDialog; diff --git a/trunk/src/plugins/xdxf/tests/test.cpp b/trunk/src/plugins/xdxf/tests/test.cpp index eca3050..fb04339 100644 --- a/trunk/src/plugins/xdxf/tests/test.cpp +++ b/trunk/src/plugins/xdxf/tests/test.cpp @@ -53,15 +53,6 @@ void XdxfTest::searchWordList() { } - -void XdxfTest::getNew() { -/* XdxfPlugin xdxfPlugin(this); - Settings settings; - settings.setValue("path","dict2"); - XdxfPlugin * = xdxfPlugin.getNew(settings); -*/ -} - void XdxfTest::stop() { /*test for English-Polish dictionary */ CommonDictInterface *xdxfPlugin = new XdxfPlugin(this); @@ -73,6 +64,15 @@ void XdxfTest::stop() { QCOMPARE(te5.size(),8); } +void XdxfTest::getNew() { + XdxfPlugin xdxfPlugin(this); + Settings *settings=new Settings; + settings->setValue("path","dict.xdxf"); + CommonDictInterface *xdxfPlugin2 = xdxfPlugin.getNew(settings); + QList te6=xdxfPlugin2->searchWordList("*",8); + QCOMPARE(te6.size(),8); +} + void XdxfTest::langFrom() { /*test for English-Polish dictionary */ XdxfPlugin xdxfPlugin(this); diff --git a/trunk/src/plugins/xdxf/tests/test.h b/trunk/src/plugins/xdxf/tests/test.h index 8111167..084c5d8 100644 --- a/trunk/src/plugins/xdxf/tests/test.h +++ b/trunk/src/plugins/xdxf/tests/test.h @@ -36,6 +36,7 @@ private slots: + void search(); void searchWordList(); void langFrom(); -- 1.7.9.5