add test: getNew() in xdxf plugin, and add some comments
authorJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Fri, 6 Aug 2010 13:17:57 +0000 (15:17 +0200)
committerJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Fri, 6 Aug 2010 13:17:57 +0000 (15:17 +0200)
trunk/src/includes/CommonDictInterface.h
trunk/src/includes/settings.h
trunk/src/plugins/xdxf/src/xdxfplugin.h
trunk/src/plugins/xdxf/tests/test.cpp
trunk/src/plugins/xdxf/tests/test.h

index 83571e4..f3c322a 100644 (file)
@@ -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<Translation*> searchWordList(QString word, int limit=0) = 0;
 
-    //! stop current operation
+    //! stops current operation
     virtual void stop() = 0;
 
   Q_SIGNALS:
index 4486492..d2f6089 100644 (file)
@@ -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 {
index 4feb602..b0a0b65 100644 (file)
@@ -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;
index eca3050..fb04339 100644 (file)
@@ -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<Translation*> te6=xdxfPlugin2->searchWordList("*",8);
+        QCOMPARE(te6.size(),8);
+}
+
 void XdxfTest::langFrom() {
      /*test for English-Polish dictionary */
     XdxfPlugin xdxfPlugin(this);
index 8111167..084c5d8 100644 (file)
@@ -36,6 +36,7 @@
 
 
  private slots:
+
      void search();
      void searchWordList();
      void langFrom();