[meego-commits] 10882: Changes to Trunk:Testing/meegotouch-inputmethodengine

Kaitlin Rupert no_reply at build.meego.com
Mon Dec 13 17:08:43 UTC 2010


Hi,
I have made the following changes to meegotouch-inputmethodengine in project Trunk:Testing. Please review and accept ASAP.

Thank You,
Kaitlin Rupert

[This message was auto-generated]

---

Request #10882:

  submit:   devel:qt-mtf/meegotouch-inputmethodengine(r16) -> Trunk:Testing/meegotouch-inputmethodengine


Message:
    * Thu Dec 07 2010 Luis Araujo <luis.araujo at collabora.co.uk> - 0.4.0
- Update to release tag 0.4.0-1 (BMC#10994)
- Build libmeegoimenginewords0 package
- Build tests package
- Build dummydriver package
- Changed the way tests are installed
- Added workaround to install .pc files

State:   new          2010-12-13T09:08:42 krupert
Comment: None



changes files:
--------------
--- meegotouch-inputmethodengine.changes
+++ meegotouch-inputmethodengine.changes
@@ -0,0 +1,8 @@
+* Thu Dec 07 2010 Luis Araujo <luis.araujo at collabora.co.uk> - 0.4.0
+- Update to release tag 0.4.0-1 (BMC#10994)
+- Build libmeegoimenginewords0 package
+- Build tests package
+- Build dummydriver package
+- Changed the way tests are installed
+- Added workaround to install .pc files
+

old:
----
  meegotouch-inputmethodengine-0.3.0.tar.bz2

new:
----
  meegotouch-inputmethodengine-0.4.0.tar.bz2

spec files:
-----------
--- meegotouch-inputmethodengine.spec
+++ meegotouch-inputmethodengine.spec
@@ -6,8 +6,8 @@
 # << macros
 
 Name:       meegotouch-inputmethodengine
-Summary:    Direct UI Input Method Engine
-Version:    0.3.0
+Summary:    Meego UI Input Method Engine
+Version:    0.4.0
 Release:    1
 Group:      System/Libraries
 License:    LGPLv2.1
@@ -15,8 +15,6 @@
 Source0:    %{name}-%{version}.tar.bz2
 Source100:  meegotouch-inputmethodengine.yaml
 Requires:   %{name} >= %{version}
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
 BuildRequires:  pkgconfig(QtCore) >= 4.6.0
 BuildRequires:  pkgconfig(gstreamer-0.10)
 BuildRequires:  pkgconfig(gstreamer-base-0.10)
@@ -31,18 +29,45 @@
 
 
 %description
-Direct UI Input Method Engine
+Meego UI Input Method Engine
 
 
 
 %package devel
-Summary:    Development files for the Direct UI Input Method Engine
+Summary:    Development files for the Meego UI Input Method Engine
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 
 %description devel
-This package contains the files necessary to develop duiimengine applications.
+This package contains the files necessary to develop meegoimengine applications.
+
+%package -n libmeegoimenginewords0
+Summary:    Meego Touch Input Method Engine Framework library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description -n libmeegoimenginewords0
+Meego Touch Input Method Engine Framework library, word correction/prediction
+
+%package tests
+Summary:    Unit tests for the MeeGo UI Input Method Engine
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+Requires:   libmeegoimenginewords0
+
+%description tests
+This package contains the unit tests for the MeeGo UI Input Method Engine
 
+%package dummydriver
+Summary:    Dummy Driver for libmeegoimengine
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+Requires:   libmeegoimenginewords0
+
+%description dummydriver
+This package contains Dummy Driver for libmeegoimengine
 
 
 %prep
@@ -60,6 +85,10 @@
 make %{?jobs:-j%jobs}
 
 # >> build post
+cd unit_test && ./gen-tests-xml.sh > tests.xml
+# To workaround the installation of the .pc and .prf files,
+# qmake needs to run again to generate the pc file installation target in the Makefile
+cd ../src/ && %qmake
 # << build post
 %install
 rm -rf %{buildroot}
@@ -68,23 +97,19 @@
 %qmake_install
 
 # >> install post
-
-#Install tests alongside Qt examples
-mkdir -p %{buildroot}/%{_libdir}/qt4/tests
-mv %{buildroot}/%{_datadir}/libmeegoimengine-tests %{buildroot}/%{_libdir}/qt4/tests/libmeegoimengine-tests
-
 # Create a meegotouch-inputmethodengine ldconfig file - the tests cases need
 # this in order to resolve the stub test libraries (stubdriver1 and stubdriver2)
 mkdir -p %{buildroot}/etc/ld.so.conf.d
-echo "/usr/lib/dui-imengines/drivers" > %{buildroot}/etc/ld.so.conf.d/meegotouch-inputmethodengine.conf
+echo "/usr/lib/meego-imengines/drivers" > %{buildroot}/etc/ld.so.conf.d/meegotouch-inputmethodengine.conf
 # << install post
 
 
 
-%post -p /sbin/ldconfig
 
-%postun -p /sbin/ldconfig
 
+%post -n libmeegoimenginewords0 -p /sbin/ldconfig
+
+%postun -n libmeegoimenginewords0 -p /sbin/ldconfig
 
 
 
@@ -92,22 +117,44 @@
 %files
 %defattr(-,root,root,-)
 # >> files
-%{_libdir}/*.so.*
 # << files
 
 
 %files devel
 %defattr(-,root,root,-)
 # >> files devel
-%config %{_sysconfdir}/ld.so.conf.d/meegotouch-inputmethodengine.conf
-%{_includedir}/meego/meegoimengine
 %{_libdir}/*.so
 %{_libdir}/pkgconfig/*.pc
-%{_libdir}/meego-imengines/drivers/libdummyimdriver.so
-%{_libdir}/meego-imengines/drivers/libstubdriver1.so
-%{_libdir}/meego-imengines/drivers/libstubdriver2.so
-%{_libdir}/qt4/tests/libmeegoimengine-tests
+%{_datadir}/qt4/mkspecs/features/meegoimengineinterface.prf
 %{_datadir}/qt4/mkspecs/features/meegoimengine.prf
-%{_datadir}/qt4/mkspecs/features/meegoimenginewords.prf
+%{_includedir}/meego/meegoimengine/mimenginetypes.h
+%{_includedir}/meego/meegoimengine/mimenginefactory.h
+%{_includedir}/meego/meegoimengine/mimenginewordsinterface.h
+%{_includedir}/meego/meegoimengine/MImEngineWordsInterface
+%{_includedir}/meego/meegoimengine/mimenginehwrinterface.h
+%{_includedir}/meego/meegoimengine/MImEngineHwrInterface
+%config /etc/ld.so.conf.d/meegotouch-inputmethodengine.conf
 # << files devel
 
+%files -n libmeegoimenginewords0
+%defattr(-,root,root,-)
+# >> files libmeegoimenginewords0
+%{_libdir}/libmeego*.so.*
+# << files libmeegoimenginewords0
+
+%files tests
+%defattr(-,root,root,-)
+# >> files tests
+%{_datadir}/libmeegoimengine-tests/
+%{_libdir}/libmeegoimengine-tests/
+%{_libdir}/meego-imengines/drivers/words/libstub*
+%{_libdir}/meego-imengines/drivers/hwr/libstub*
+# << files tests
+
+%files dummydriver
+%defattr(-,root,root,-)
+# >> files dummydriver
+%{_libdir}/meego-imengines/drivers/words/libdummy*
+%{_libdir}/meego-imengines/drivers/hwr/libdummy*
+# << files dummydriver
+

other changes:
--------------

++++++ meegotouch-inputmethodengine-0.3.0.tar.bz2 -> meegotouch-inputmethodengine-0.4.0.tar.bz2
--- MeegoImEngine.pc
+++ MeegoImEngine.pc
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include/qt4/meegoimengine
-
-Name: MeegoImEngineWords
-Description: Meego Touch Input Method Engine Framework
-Version: 0.1.0
-Cflags: -I${includedir}
-Libs: -L${libdir} -lmeegoimenginewords
-
--- debian/changelog
+++ debian/changelog
@@ -1,8 +1,33 @@
-libmeegoimengine (0.3.1~1) unstable; urgency=low
+libmeegoimengine (0.4.1~1) unstable; urgency=low
 
-  * [UNRELEASED]
+  * [ Unreleased ]
 
- -- huaming wang <huaming.wang at nokia.com>  Wed, 03 Nov 2010 14:52:20 +0200
+ -- Rakesh Cherian <ext-rakesh.cherian at nokia.com>  Wed, 1 Dec 2010 12:26:45 +0200
+
+libmeegoimengine (0.4.0-1) unstable; urgency=low
+
+  * New: add Handwriting Recognition Interface and counterpart Unit test code
+  * Changes: revert back pc files and correct the pathes
+
+ -- Rakesh Cherian <ext-rakesh.cherian at nokia.com>  Wed, 1 Dec 2010 12:26:45 +0200
+
+libmeegoimengine (0.3.4-1) unstable; urgency=low
+
+  * new release
+
+ -- huaming wang <huaming.wang at nokia.com>  Fri, 26 Nov 2010 12:24:23 +0200
+
+libmeegoimengine (0.3.3-1) unstable; urgency=low
+
+  * new release
+
+ -- huaming wang <huaming.wang at nokia.com>  Wed, 17 Nov 2010 13:40:20 +0200
+
+libmeegoimengine (0.3.2-1) unstable; urgency=low
+
+  * remove depleted pc files.
+
+ -- huaming wang <huaming.wang at nokia.com>  Mon, 15 Nov 2010 11:11:54 +0200
 
 libmeegoimengine (0.3.0-1) unstable; urgency=low
 
--- debian/libmeegoimengine-dev.install
+++ debian/libmeegoimengine-dev.install
+usr/include/meego/meegoimengine/mimenginetypes.h
+/usr/share/qt4/mkspecs/features/meegoimengine.prf
+
--- debian/libmeegoimengine-dummydriver.install
+++ debian/libmeegoimengine-dummydriver.install
@@ -1 +1,2 @@
-/usr/lib/meego-imengines/drivers/libdummy*
+/usr/lib/meego-imengines/drivers/words/libdummy*
+/usr/lib/meego-imengines/drivers/hwr/libdummy*
--- debian/libmeegoimengine-tests.install
+++ debian/libmeegoimengine-tests.install
@@ -1,2 +1,4 @@
 /usr/share/libmeegoimengine-tests/
-/usr/lib/meego-imengines/drivers/libstub*
+/usr/lib/libmeegoimengine-tests/
+/usr/lib/meego-imengines/drivers/words/libstub*
+/usr/lib/meego-imengines/drivers/hwr/libstub*
--- debian/libmeegoimenginewords-dev.install
+++ debian/libmeegoimenginewords-dev.install
+usr/lib/pkgconfig/*
+usr/lib/*.so
+/usr/share/qt4/mkspecs/features/meegoimengineinterface.prf
+usr/include/meego/meegoimengine/mimenginefactory.h
+usr/include/meego/meegoimengine/mimenginewordsinterface.h
+usr/include/meego/meegoimengine/MImEngineWordsInterface
+usr/include/meego/meegoimengine/mimenginehwrinterface.h
+usr/include/meego/meegoimengine/MImEngineHwrInterface
+
--- debian/libmeegoimenginewords-dev.install.in
+++ debian/libmeegoimenginewords-dev.install.in
@@ -1,7 +1,9 @@
 usr/lib/pkgconfig/*
 usr/lib/*.so
-QT_INSTALL_DATA/mkspecs/features/meegoimenginewords.prf
-usr/include/meego/meegoimengine/mimenginewordsinterfacefactory.h
+QT_INSTALL_DATA/mkspecs/features/meegoimengineinterface.prf
+usr/include/meego/meegoimengine/mimenginefactory.h
 usr/include/meego/meegoimengine/mimenginewordsinterface.h
 usr/include/meego/meegoimengine/MImEngineWordsInterface
+usr/include/meego/meegoimengine/mimenginehwrinterface.h
+usr/include/meego/meegoimengine/MImEngineHwrInterface
 
--- debian/rules
+++ debian/rules
@@ -76,6 +76,12 @@
 	dh_installdirs
 
 	# Add here commands to install the package into debian/tmp
+	# generate tests.xml
+	cd unit_test && ./gen-tests-xml.sh > tests.xml
+
+	# To workaround the installation of the .pc and .prf files,
+	# qmake needs to run again to generate the pc file installation target in the Makefile
+	cd src && qmake $(QMAKE_OPTIONS)
 
 	INSTALL_ROOT=$(CURDIR)/debian/tmp make  $(PARALLEL_MAKEFLAGS) install
 
--- dummydriver/dummydriver.cpp
+++ dummydriver/dummydriver.cpp
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "dummydriver.h"
-#include "mimenginewordsinterfacefactory.h"
-#include <QtPlugin>
-#include <QLibrary>
-
-DummyDriver::DummyDriver()
-    : predictionEnabledFlag(false),
-      correctionEnabledFlag(false),
-      completionEnabledFlag(false),
-      maximumErrorsCount(0),
-      maximumCandidatesCount(0)
-{
-}
-
-DummyDriver::~DummyDriver()
-{
-}
-
-bool DummyDriver::init()
-{
-    return true;
-}
-
-bool DummyDriver::addDictionaryWord(const QString &w, MImEngine::DictionaryType type)
-{
-    Q_UNUSED(w);
-    Q_UNUSED(type);
-    return false;
-}
-
-bool DummyDriver::removeDictionaryWord(const QString &w, MImEngine::DictionaryType type)
-{
-    Q_UNUSED(w);
-    Q_UNUSED(type);
-    return false;
-}
-
-bool DummyDriver::disableDictionary(MImEngine::DictionaryType type)
-{
-    Q_UNUSED(type);
-    return false;
-}
-bool DummyDriver::enableDictionary(MImEngine::DictionaryType type)
-{
-    Q_UNUSED(type);
-    return false;
-}
-bool DummyDriver::removeDictionary(MImEngine::DictionaryType type)
-{
-    Q_UNUSED(type);
-    return false;
-}
-
-void DummyDriver::appendString(const QString &s)
-{
-    Q_UNUSED(s);
-}
-void DummyDriver::appendCharacter(const QChar &c)
-{
-    Q_UNUSED(c);
-}
-
-void DummyDriver::tapKeyboard(const QPoint &position, bool shift, QChar symbol)
-{
-    Q_UNUSED(position);
-    Q_UNUSED(shift);
-    Q_UNUSED(symbol);
-}
-
-void DummyDriver::reselectString(const QString &s)
-{
-    Q_UNUSED(s);
-}
-
-void DummyDriver::setContext(const QString &s, int cursor)
-{
-    Q_UNUSED(s);
-    Q_UNUSED(cursor);
-}
-
-void DummyDriver::disablePrediction()
-{
-    predictionEnabledFlag = false;
-}
-
-void DummyDriver::enablePrediction()
-{
-    predictionEnabledFlag = true;
-}
-
-bool DummyDriver::predictionEnabled()
-{
-    return predictionEnabledFlag;
-}
-
-void DummyDriver::disableCorrection()
-{
-    correctionEnabledFlag = false;
-}
-
-void DummyDriver::enableCorrection()
-{
-    correctionEnabledFlag = true;
-}
-
-bool DummyDriver::correctionEnabled()
-{
-    return correctionEnabledFlag;
-}
-
-void DummyDriver::disableCompletion()
-{
-    completionEnabledFlag = false;
-}
-
-void DummyDriver::enableCompletion()
-{
-    completionEnabledFlag = true;
-}
-
-bool DummyDriver::completionEnabled()
-{
-    return completionEnabledFlag;
-}
-
-QStringList DummyDriver::candidates(unsigned int uStartIndex, unsigned int uNum)
-{
-    Q_UNUSED(uStartIndex);
-    Q_UNUSED(uNum);
-    return QStringList();
-}
-
-int DummyDriver::totalCandidates()
-{
-    return 0;
-}
-
-int DummyDriver::matchedLength()
-{
-    return 0;
-}
-
-int DummyDriver::suggestedCandidateIndex()
-{
-    return 0;
-}
-
-bool  DummyDriver::setSuggestedCandidateIndex(int index)
-{
-    Q_UNUSED(index);
-    return true;
-}
-
-void DummyDriver::setExactWordPositionInList(MImEngine::ExactInListType setting)
-{
-    Q_UNUSED(setting);
-}
-
-MImEngine::DictionaryType DummyDriver::candidateSource(int index)
-{
-    Q_UNUSED(index);
-    return  MImEngine::DictionaryTypeInvalid;
-}
-
-void DummyDriver::clearEngineBuffer()
-{
-}
-
-void DummyDriver::saveAndClearEngineBuffer()
-{
-}
-
-QString  DummyDriver::language()
-{
-    return driverLanguage;
-}
-
-bool DummyDriver::setLanguage(const QString  &l, MImEngine::LanguagePriority p)
-{
-    Q_UNUSED(p);
-    driverLanguage = l;
-    return true;
-}
-
-bool DummyDriver::setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys)
-{
-    layoutKeys = keys;
-    return true;
-}
-
-QList<MImEngine::KeyboardLayoutKey> DummyDriver::keyboardLayoutKeys()
-{
-    return layoutKeys;
-}
-
-bool DummyDriver::exportAsNokiaDictionary(const QString &fileName)
-{
-    Q_UNUSED(fileName);
-    return false;
-}
-
-bool DummyDriver::importNokiaUserDictionary(const QString &fileName)
-{
-    Q_UNUSED(fileName);
-    return false;
-}
-
-void DummyDriver::setMaximumErrors(int maxErrors)
-{
-    maximumErrorsCount = maxErrors;
-}
-
-int DummyDriver::maximumErrors()
-{
-    return maximumErrorsCount;
-}
-
-QString DummyDriver::driver()
-{
-    return "dummyimdriver";
-}
-
-void DummyDriver::setMaximumCandidates(int maxCandidates)
-{
-    maximumCandidatesCount = maxCandidates;
-}
-
-int DummyDriver::maximumCandidates()
-{
-    return maximumCandidatesCount;
-}
-
-QString DummyDriver::error()
-{
-    return QString();
-}
-
-Q_EXPORT_PLUGIN2(dummyimdriver, DummyDriver);
--- dummydriver/dummydriver.h
+++ dummydriver/dummydriver.h
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#ifndef DUMMYDRIVER_H
-#define DUMMYDRIVER_H
-
-#include <mimenginetypes.h>
-#include <mimenginewordsinterface.h>
-#include <QString>
-#include <QStringList>
-#include <QObject>
-
-class MImEngineWords;
-
-/*!
-  \brief DummyDriver inherits from MImEngineWordsInterface(Abstract driver class) and QObject,
-  it implements a dummy input method engine.
-
- */
-class DummyDriver: public QObject, public MImEngineWordsInterface
-{
-    Q_OBJECT
-    Q_DISABLE_COPY(DummyDriver)
-    Q_INTERFACES(MImEngineWordsInterface)
-
-
-public:
-    /*!
-     * DummyDriver construtor
-     */
-    DummyDriver();
-
-    /*!
-     * DummyDriver destructor
-     */
-    ~DummyDriver();
-
-    /*!
-     *\reimp
-    */
-
-    virtual bool init();
-
-    virtual bool addDictionaryWord(const QString &word, MImEngine::DictionaryType);
-
-    virtual bool removeDictionaryWord(const QString &word, MImEngine::DictionaryType);
-
-    virtual bool disableDictionary(MImEngine::DictionaryType);
-
-    virtual bool enableDictionary(MImEngine::DictionaryType);
-
-    virtual bool removeDictionary(MImEngine::DictionaryType);
-
-    virtual void appendString(const QString &s);
-
-    virtual void appendCharacter(const QChar &c);
-
-    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol);
-
-    virtual void reselectString(const QString &s);
-
-    virtual void setContext(const QString &s, int cursor);
-
-    virtual void disablePrediction();
-
-    virtual void enablePrediction();
-
-    virtual bool predictionEnabled();
-
-    virtual void disableCorrection();
-
-    virtual void enableCorrection();
-
-    virtual bool correctionEnabled();
-
-    virtual void disableCompletion();
-
-    virtual void enableCompletion();
-
-    virtual bool completionEnabled();
-
-    virtual QStringList candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0);
-
-    virtual int totalCandidates();
-
-    virtual int matchedLength();
-
-    virtual int suggestedCandidateIndex();
-
-    virtual bool setSuggestedCandidateIndex(int index);
-
-    virtual void setExactWordPositionInList(MImEngine::ExactInListType);
-
-    virtual MImEngine::DictionaryType candidateSource(int);
-
-    virtual void clearEngineBuffer();
-
-    virtual void saveAndClearEngineBuffer();
-
-    virtual QString  language();
-
-    virtual bool setLanguage(const QString &language, MImEngine::LanguagePriority);
-
-    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys);
-
-    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys();
-
-    virtual bool exportAsNokiaDictionary(const QString &);
-
-    virtual bool importNokiaUserDictionary(const QString &);
-
-    virtual void setMaximumErrors(int);
-
-    virtual int maximumErrors();
-
-    virtual void setMaximumCandidates(int maxCandidates);
-
-    virtual int maximumCandidates();
-
-    virtual QString driver();
-
-    virtual QString error();
-
-    /*!
-     *\reimp_end
-    */
-
-private:
-    bool predictionEnabledFlag;
-    bool correctionEnabledFlag;
-    bool completionEnabledFlag;
-
-    QString driverLanguage;
-    QList<MImEngine::KeyboardLayoutKey> layoutKeys;
-
-    int maximumErrorsCount;
-    int maximumCandidatesCount;
-};
-#endif //DUMMYDRIVER_H
--- dummydriver/dummydriver.pro
+++ dummydriver/dummydriver.pro
@@ -1,18 +1,14 @@
+CONFIG += ordered
+TEMPLATE = subdirs
+SUBDIRS = dummydriver_hwr dummydriver_words
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.target = check-xml
+check-xml.CONFIG = recursive
+
+QMAKE_EXTRA_TARGETS += check
+check.target = check
+check.CONFIG = recursive
 
-TEMPLATE = lib
-LIBNAME = dummyimdriver
-TARGET = $${LIBNAME}
-LIBS += -L../words -lmeegoimenginewords
-
-INCLUDEPATH += ../words ../includes
-
-# Input
-HEADERS += dummydriver.h
-SOURCES += dummydriver.cpp
-
-CONFIG += debug plugin
-QT = core
-
-target.path += /usr/lib/meego-imengines/drivers/
-INSTALLS += target \
+QMAKE_CLEAN += build-stamp configure-stamp
 
--- dummydriver/dummydriver_hwr
+++ dummydriver/dummydriver_hwr
+(directory)
--- dummydriver/dummydriver_hwr/dummydriver_hwr.cpp
+++ dummydriver/dummydriver_hwr/dummydriver_hwr.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "dummydriver_hwr.h"
+#include "mimenginefactory.h"
+#include <QtPlugin>
+#include <QLibrary>
+
+DummyDriverHwr::DummyDriverHwr()    
+{
+}
+
+DummyDriverHwr::~DummyDriverHwr()
+{
+}
+
+bool DummyDriverHwr::init()
+{
+    return true;
+}
+
+void DummyDriverHwr::setAreaSize(QSize size) 
+{
+    Q_UNUSED(size);
+}
+
+QSize DummyDriverHwr::areaSize()
+{
+    return QSize(0, 0);
+}
+   
+void DummyDriverHwr::setScreenSize(QSize size) 
+{
+    Q_UNUSED(size);
+}
+ 
+QSize DummyDriverHwr::screenSize()
+{
+    return QSize(0, 0);
+}
+ 
+bool DummyDriverHwr::setScripts(const QStringList scripts)
+{
+    Q_UNUSED(scripts);
+    return true;
+}
+    
+QStringList DummyDriverHwr::scripts()
+{
+    return QStringList();
+}
+  
+QStringList DummyDriverHwr::recognize()
+{
+    return QStringList();
+}
+    
+void DummyDriverHwr::appendStroke(const QList<QPoint> stroke) 
+{
+    Q_UNUSED(stroke);
+}
+  
+void DummyDriverHwr::clear()
+{
+}
+
+void DummyDriverHwr::train(const QString& string)
+{
+    Q_UNUSED(string);
+} 
+
+
+QString DummyDriverHwr::driver()
+{
+    return "dummyimdriver_hwr";
+}
+
+
+QString DummyDriverHwr::error()
+{
+    return QString();
+}
+
+Q_EXPORT_PLUGIN2(dummyimdriverhwr, DummyDriverHwr);
--- dummydriver/dummydriver_hwr/dummydriver_hwr.h
+++ dummydriver/dummydriver_hwr/dummydriver_hwr.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef DUMMYDRIVER_H
+#define DUMMYDRIVER_H
+
+#include <mimenginetypes.h>
+#include <mimenginehwrinterface.h>
+#include <QString>
+#include <QStringList>
+#include <QObject>
+
+class MImEngineHwr;
+
+/*!
+  \brief DummyDriverHwr inherits from MImEngineWordsInterface(Abstract driver class) and QObject,
+  it implements a dummy input method engine.
+
+ */
+class DummyDriverHwr: public QObject, public MImEngineHwrInterface
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(DummyDriverHwr)
+    Q_INTERFACES(MImEngineHwrInterface)
+
+
+public:
+    /*!
+     * DummyDriverHwr construtor
+     */
+    DummyDriverHwr();
+
+    /*!
+     * DummyDriverHwr destructor
+     */
+    ~DummyDriverHwr();
+
+    /*!
+     *\reimp
+    */   
+    virtual bool init(void) ;
+   
+    virtual void setAreaSize(QSize size) ;
+  
+    virtual QSize areaSize() ;
+   
+    virtual void setScreenSize(QSize size) ;
+ 
+    virtual QSize screenSize() ;
+ 
+    virtual bool setScripts(const QStringList scripts);
+    
+    virtual QStringList scripts();
+  
+    virtual QStringList recognize();
+    
+    virtual void appendStroke(const QList<QPoint> stroke) ;
+  
+    virtual void clear();
+  
+    virtual QString error() ;
+
+    virtual void train(const QString& string) ;
+  
+    virtual QString driver() ;
+
+    /*!
+     *\reimp_end
+    */
+
+private:
+    
+};
+#endif //DUMMYDRIVER_H
--- dummydriver/dummydriver_hwr/dummydriver_hwr.pro
+++ dummydriver/dummydriver_hwr/dummydriver_hwr.pro
+
+TEMPLATE = lib
+LIBNAME = dummyimdriver-hwr
+TARGET = $${LIBNAME}
+LIBS += -L../../src -lmeegoimengine
+
+INCLUDEPATH += ../../src ../../includes
+
+# Input
+HEADERS += dummydriver_hwr.h
+SOURCES += dummydriver_hwr.cpp
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/hwr
+INSTALLS += target \
+
--- dummydriver/dummydriver_words
+++ dummydriver/dummydriver_words
+(directory)
--- dummydriver/dummydriver_words/dummydriver.cpp
+++ dummydriver/dummydriver_words/dummydriver.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "dummydriver.h"
+#include "mimenginefactory.h"
+#include <QtPlugin>
+#include <QLibrary>
+
+DummyDriver::DummyDriver()
+    : predictionEnabledFlag(false),
+      correctionEnabledFlag(false),
+      completionEnabledFlag(false),
+      maximumErrorsCount(0),
+      maximumCandidatesCount(0)
+{
+}
+
+DummyDriver::~DummyDriver()
+{
+}
+
+bool DummyDriver::init()
+{
+    return true;
+}
+
+bool DummyDriver::addDictionaryWord(const QString &w, MImEngine::DictionaryType type)
+{
+    Q_UNUSED(w);
+    Q_UNUSED(type);
+    return false;
+}
+
+bool DummyDriver::removeDictionaryWord(const QString &w, MImEngine::DictionaryType type)
+{
+    Q_UNUSED(w);
+    Q_UNUSED(type);
+    return false;
+}
+
+bool DummyDriver::disableDictionary(MImEngine::DictionaryType type)
+{
+    Q_UNUSED(type);
+    return false;
+}
+bool DummyDriver::enableDictionary(MImEngine::DictionaryType type)
+{
+    Q_UNUSED(type);
+    return false;
+}
+bool DummyDriver::removeDictionary(MImEngine::DictionaryType type)
+{
+    Q_UNUSED(type);
+    return false;
+}
+
+void DummyDriver::appendString(const QString &s)
+{
+    Q_UNUSED(s);
+}
+void DummyDriver::appendCharacter(const QChar &c)
+{
+    Q_UNUSED(c);
+}
+
+void DummyDriver::tapKeyboard(const QPoint &position, bool shift, QChar symbol)
+{
+    Q_UNUSED(position);
+    Q_UNUSED(shift);
+    Q_UNUSED(symbol);
+}
+
+void DummyDriver::reselectString(const QString &s)
+{
+    Q_UNUSED(s);
+}
+
+void DummyDriver::setContext(const QString &s, int cursor)
+{
+    Q_UNUSED(s);
+    Q_UNUSED(cursor);
+}
+
+void DummyDriver::disablePrediction()
+{
+    predictionEnabledFlag = false;
+}
+
+void DummyDriver::enablePrediction()
+{
+    predictionEnabledFlag = true;
+}
+
+bool DummyDriver::predictionEnabled()
+{
+    return predictionEnabledFlag;
+}
+
+void DummyDriver::disableCorrection()
+{
+    correctionEnabledFlag = false;
+}
+
+void DummyDriver::enableCorrection()
+{
+    correctionEnabledFlag = true;
+}
+
+bool DummyDriver::correctionEnabled()
+{
+    return correctionEnabledFlag;
+}
+
+void DummyDriver::disableCompletion()
+{
+    completionEnabledFlag = false;
+}
+
+void DummyDriver::enableCompletion()
+{
+    completionEnabledFlag = true;
+}
+
+bool DummyDriver::completionEnabled()
+{
+    return completionEnabledFlag;
+}
+
+QStringList DummyDriver::candidates(unsigned int uStartIndex, unsigned int uNum)
+{
+    Q_UNUSED(uStartIndex);
+    Q_UNUSED(uNum);
+    return QStringList();
+}
+
+int DummyDriver::totalCandidates()
+{
+    return 0;
+}
+
+int DummyDriver::matchedLength()
+{
+    return 0;
+}
+
+QStringList DummyDriver::matchedSyllables()
+{
+    return QStringList();
+}
+
+int DummyDriver::suggestedCandidateIndex()
+{
+    return 0;
+}
+
+bool  DummyDriver::setSuggestedCandidateIndex(int index)
+{
+    Q_UNUSED(index);
+    return true;
+}
+
+void DummyDriver::setExactWordPositionInList(MImEngine::ExactInListType setting)
+{
+    Q_UNUSED(setting);
+}
+
+MImEngine::DictionaryType DummyDriver::candidateSource(int index)
+{
+    Q_UNUSED(index);
+    return  MImEngine::DictionaryTypeInvalid;
+}
+
+void DummyDriver::clearEngineBuffer()
+{
+}
+
+void DummyDriver::saveAndClearEngineBuffer()
+{
+}
+
+QString  DummyDriver::language()
+{
+    return driverLanguage;
+}
+
+bool DummyDriver::setLanguage(const QString  &l, MImEngine::LanguagePriority p)
+{
+    Q_UNUSED(p);
+    driverLanguage = l;
+    return true;
+}
+
+bool DummyDriver::setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys)
+{
+    layoutKeys = keys;
+    return true;
+}
+
+QList<MImEngine::KeyboardLayoutKey> DummyDriver::keyboardLayoutKeys()
+{
+    return layoutKeys;
+}
+
+bool DummyDriver::exportAsNokiaDictionary(const QString &fileName)
+{
+    Q_UNUSED(fileName);
+    return false;
+}
+
+bool DummyDriver::importNokiaUserDictionary(const QString &fileName)
+{
+    Q_UNUSED(fileName);
+    return false;
+}
+
+void DummyDriver::setMaximumErrors(int maxErrors)
+{
+    maximumErrorsCount = maxErrors;
+}
+
+int DummyDriver::maximumErrors()
+{
+    return maximumErrorsCount;
+}
+
+QString DummyDriver::driver()
+{
+    return "dummyimdriver";
+}
+
+void DummyDriver::setMaximumCandidates(int maxCandidates)
+{
+    maximumCandidatesCount = maxCandidates;
+}
+
+int DummyDriver::maximumCandidates()
+{
+    return maximumCandidatesCount;
+}
+
+QString DummyDriver::error()
+{
+    return QString();
+}
+
+bool DummyDriver::setScript(const QString &s)
+{
+    Q_UNUSED(s);
+    return false;
+}
+
+QString DummyDriver::script()
+{
+    return QString();
+}
+
+Q_EXPORT_PLUGIN2(dummyimdriver, DummyDriver);
--- dummydriver/dummydriver_words/dummydriver.h
+++ dummydriver/dummydriver_words/dummydriver.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef DUMMYDRIVER_H
+#define DUMMYDRIVER_H
+
+#include <mimenginetypes.h>
+#include <mimenginewordsinterface.h>
+#include <QString>
+#include <QStringList>
+#include <QObject>
+
+class MImEngineWords;
+
+/*!
+  \brief DummyDriver inherits from MImEngineWordsInterface(Abstract driver class) and QObject,
+  it implements a dummy input method engine.
+
+ */
+class DummyDriver: public QObject, public MImEngineWordsInterface
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(DummyDriver)
+    Q_INTERFACES(MImEngineWordsInterface)
+
+
+public:
+    /*!
+     * DummyDriver construtor
+     */
+    DummyDriver();
+
+    /*!
+     * DummyDriver destructor
+     */
+    ~DummyDriver();
+
+    /*!
+     *\reimp
+    */
+
+    virtual bool init();
+
+    virtual bool addDictionaryWord(const QString &word, MImEngine::DictionaryType);
+
+    virtual bool removeDictionaryWord(const QString &word, MImEngine::DictionaryType);
+
+    virtual bool disableDictionary(MImEngine::DictionaryType);
+
+    virtual bool enableDictionary(MImEngine::DictionaryType);
+
+    virtual bool removeDictionary(MImEngine::DictionaryType);
+
+    virtual void appendString(const QString &s);
+
+    virtual void appendCharacter(const QChar &c);
+
+    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol);
+
+    virtual void reselectString(const QString &s);
+
+    virtual void setContext(const QString &s, int cursor);
+
+    virtual void disablePrediction();
+
+    virtual void enablePrediction();
+
+    virtual bool predictionEnabled();
+
+    virtual void disableCorrection();
+
+    virtual void enableCorrection();
+
+    virtual bool correctionEnabled();
+
+    virtual void disableCompletion();
+
+    virtual void enableCompletion();
+
+    virtual bool completionEnabled();
+
+    virtual QStringList candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0);
+
+    virtual int totalCandidates();
+
+    virtual int matchedLength();
+
+    virtual QStringList matchedSyllables();
+
+    virtual int suggestedCandidateIndex();
+
+    virtual bool setSuggestedCandidateIndex(int index);
+
+    virtual void setExactWordPositionInList(MImEngine::ExactInListType);
+
+    virtual MImEngine::DictionaryType candidateSource(int);
+
+    virtual void clearEngineBuffer();
+
+    virtual void saveAndClearEngineBuffer();
+
+    virtual QString  language();
+
+    virtual bool setLanguage(const QString &language, MImEngine::LanguagePriority);
+
+    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys);
+
+    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys();
+
+    virtual bool exportAsNokiaDictionary(const QString &);
+
+    virtual bool importNokiaUserDictionary(const QString &);
+
+    virtual void setMaximumErrors(int);
+
+    virtual int maximumErrors();
+
+    virtual void setMaximumCandidates(int maxCandidates);
+
+    virtual int maximumCandidates();
+
+    virtual QString driver();
+
+    virtual QString error();
+
+    virtual bool setScript(const QString &s);
+
+    virtual QString script();
+
+    /*!
+     *\reimp_end
+    */
+
+private:
+    bool predictionEnabledFlag;
+    bool correctionEnabledFlag;
+    bool completionEnabledFlag;
+
+    QString driverLanguage;
+    QList<MImEngine::KeyboardLayoutKey> layoutKeys;
+
+    int maximumErrorsCount;
+    int maximumCandidatesCount;
+};
+#endif //DUMMYDRIVER_H
--- dummydriver/dummydriver_words/dummydriver.pro
+++ dummydriver/dummydriver_words/dummydriver.pro
+
+TEMPLATE = lib
+LIBNAME = dummyimdriver
+TARGET = $${LIBNAME}
+LIBS += -L../words -lmeegoimenginewords
+
+INCLUDEPATH += ../words ../includes
+
+# Input
+HEADERS += dummydriver.h
+SOURCES += dummydriver.cpp
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/words
+INSTALLS += target \
+
--- dummydriver/dummydriver_words/dummydriver_words.pro
+++ dummydriver/dummydriver_words/dummydriver_words.pro
+
+TEMPLATE = lib
+LIBNAME = dummyimdriver
+TARGET = $${LIBNAME}
+LIBS += -L../../src -lmeegoimengine
+
+INCLUDEPATH += ../../src ../../includes
+
+# Input
+HEADERS += dummydriver.h
+SOURCES += dummydriver.cpp
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/words
+INSTALLS += target \
+
--- meegoimengine.pro
+++ meegoimengine.pro
@@ -1,7 +1,7 @@
 CONFIG += ordered
 TARGET = meegoimengine
 TEMPLATE = subdirs
-SUBDIRS = words unit_test dummydriver
+SUBDIRS = src unit_test dummydriver
 
 include(doc/doc.pri)
 include(meegoimengine.prf)
@@ -13,16 +13,12 @@
 install_headers.path = $$MEEGOIMENGINE_INSTALL_HEADERS
 install_headers.files = include/*
 
-install_pkgconfig.path = $$[QT_INSTALL_LIBS]/pkgconfig
-install_pkgconfig.files = MeegoImEngine.pc
-
 install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
 install_prf.files = meegoimengine.prf
 
 INSTALLS += \
     headers \
     install_headers \
-    install_pkgconfig \
     install_prf \
 
 QMAKE_EXTRA_TARGETS += check-xml
--- src
+++ src
+(directory)
--- src/MImEngineHwrInterface
+++ src/MImEngineHwrInterface
+#include "mimenginehwrinterface.h"
--- src/MImEngineWordsInterface
+++ src/MImEngineWordsInterface
(renamed from words/MImEngineWordsInterface)
--- src/MeegoImEngine.pc.in
+++ src/MeegoImEngine.pc.in
+prefix=PREFIX_PATH
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include/meego/meegoimengine
+
+Name: MeegoImEngine
+Description: Meego Touch Input Method Engine Framework
+Version: 0.4.0
+Cflags: -I${includedir}
+Libs: -L${libdir} -lmeegoimengine
+
--- src/meegoimengineinterface.prf
+++ src/meegoimengineinterface.prf
+MEEGOIMENGINE_WORDS_PREFIX=/usr
+LIBS+=-L$${MEEGOIMENGINE_WORDS_PREFIX}/lib
+qtAddLibrary(meegoimengine)
--- src/mimenginefactory.cpp
+++ src/mimenginefactory.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "mimenginefactory.h"
+
+#include <QDir>
+#include <QPluginLoader>
+#include <QTimer>
+#include <QtDebug>
+
+namespace
+{
+    const QString defaultDriverDirWords = "/usr/lib/meego-imengines/drivers/words";
+    const QString defaultDriverDirHwr = "/usr/lib/meego-imengines/drivers/hwr";
+
+    //for searching convinience
+    enum DriverType{
+        Words,
+        Hwr
+    };
+}
+
+class MImEngineFactoryPrivate
+{
+    Q_DISABLE_COPY(MImEngineFactoryPrivate)
+    Q_DECLARE_PUBLIC(MImEngineFactory)
+    friend class Ut_MImEngineFactory;
+
+protected:
+    MImEngineFactoryPrivate();
+    ~MImEngineFactoryPrivate();
+
+    bool  verifyDriver(QObject *p, DriverType curType);
+    void updateDrivers(DriverType curType);
+    QStringList drivers();
+
+    QObject *createEngine(const QString &driver, DriverType curType);
+    void deleteEngine(QObject *engine);
+
+    //1:driver name; 2:file absolute name
+    QMap<QString, QString> driversMap;    
+
+    //1: driver interface pointer 2 plugin pointer
+    QMap<QObject*, QPluginLoader*>  pluginMap;
+
+    QString driversPathWords;
+    QString driversPathHwr;
+    MImEngineFactory *q_ptr;
+};
+
+MImEngineFactoryPrivate::MImEngineFactoryPrivate()
+    :driversPathWords(defaultDriverDirWords),
+    driversPathHwr(defaultDriverDirHwr)
+{
+}
+
+MImEngineFactoryPrivate::~MImEngineFactoryPrivate()
+{
+    QMap<QObject*, QPluginLoader*>::const_iterator i = pluginMap.constBegin();
+    while (i != pluginMap.constEnd()) {
+          QPluginLoader *plugin = i.value();
+           if (plugin) {
+              if (plugin->isLoaded()) {
+                  plugin->unload();
+              }
+              delete plugin;
+          }
+          ++i;
+      }
+}
+
+QStringList MImEngineFactoryPrivate::drivers( )
+{    
+    driversMap.clear();
+    updateDrivers(Words);
+    updateDrivers(Hwr);
+    return driversMap.keys();
+}
+
+void MImEngineFactoryPrivate::updateDrivers(DriverType curType)
+{
+    QDir pluginsDir;
+    QPluginLoader *plugin = 0;
+    QStringList filterList("*.so");
+    QObject *p = 0;
+    QString absoluteFileName;
+
+    //read the default directory for engine
+    if ( curType == Words)
+        pluginsDir.setPath(driversPathWords);
+    else if (curType == Hwr)
+        pluginsDir.setPath(driversPathHwr);
+
+    foreach (const QString &fileName, pluginsDir.entryList(filterList, QDir::Files)) {
+        MImEngineWordsInterface *driverWords = 0;
+        MImEngineHwrInterface* driverHwr = 0;
+
+        plugin = 0;
+        p = 0;
+        absoluteFileName = pluginsDir.absoluteFilePath(fileName);
+
+        qDebug() << __PRETTY_FUNCTION__ << "try to load plugin: " << fileName;
+        if (!absoluteFileName.isEmpty())
+            plugin = new QPluginLoader(absoluteFileName);
+        if (plugin) {
+            p = plugin->instance();
+            if (p) {
+                if (curType == Words ) {
+                    driverWords = qobject_cast<MImEngineWordsInterface *>(p);
+                    if (driverWords)
+                        driversMap.insert(driverWords->driver(), absoluteFileName);
+                } else if( curType == Hwr ) {
+                    driverHwr = qobject_cast<MImEngineHwrInterface *>(p);
+                    if (driverHwr)
+                        driversMap.insert(driverHwr->driver(), absoluteFileName);
+                }
+            } else {
+                qDebug() << plugin->errorString();
+            }
+
+            if ( plugin && plugin->isLoaded()) {
+                plugin->unload();
+            }
+            delete plugin;
+        }
+        else
+            qDebug()<< __PRETTY_FUNCTION__ << "plugin load fails!";
+    }
+    qDebug() << __PRETTY_FUNCTION__ << "valid drivers:" << driversMap;
+}
+
+bool  MImEngineFactoryPrivate::verifyDriver(QObject *p, DriverType curType)
+{
+    bool validDriver = false;
+    MImEngineWordsInterface *driverWords = 0;
+    MImEngineHwrInterface *driverHwr = 0;
+
+    switch(curType)
+    {
+    case Words:
+        driverWords = qobject_cast<MImEngineWordsInterface *>(p);
+            if (driverWords ) {
+              if (!driverWords->init()) {
+                    qDebug() << __PRETTY_FUNCTION__ << "load driver" << driverWords << "success, but init failed";
+                }
+                validDriver = true;
+             }
+        break;
+    case Hwr:
+        driverHwr = qobject_cast<MImEngineHwrInterface *>(p);
+        if (driverHwr ) {
+                if (!driverHwr->init()) {
+                    qDebug() << __PRETTY_FUNCTION__ << "load driver" << driverHwr << "success, but init failed";
+                }
+                validDriver = true;
+            }
+        break;
+    }
+
+    return validDriver;
+}
+
+QObject *MImEngineFactoryPrivate::createEngine(const QString &driver,  DriverType curType)
+{
+    driversMap.clear();
+    updateDrivers(Words);
+    updateDrivers(Hwr);
+
+    QPluginLoader *plugin = 0;
+    QObject *p = 0;
+
+    qDebug() << __PRETTY_FUNCTION__ << "try to create driver:" << driver;
+
+    if(driversMap.contains(driver)) {
+        QString absoluteFileName = driversMap.value(driver);
+        qDebug() << __PRETTY_FUNCTION__ << "find driver file:" << absoluteFileName;
+        plugin = new QPluginLoader(absoluteFileName);
+        if (plugin)
+            p = plugin->instance();
+        if (p) {
+            if (verifyDriver(p, curType) ) {
+                qDebug() << __PRETTY_FUNCTION__ << "successfully create driver:" << driver;
+                pluginMap.insert(p, plugin);
+            } else {
+                if (plugin) {
+                    if (plugin->isLoaded())
+                        plugin->unload();
+                    delete plugin;
+                }
+            }
+        } else
+            qDebug() << __PRETTY_FUNCTION__ << "failed create driver:" << plugin->errorString();
+    } else
+        qDebug() << __PRETTY_FUNCTION__ << "can't find driver file for:" << driver;
+
+    return p;
+}
+
+void MImEngineFactoryPrivate::deleteEngine(QObject *engine)
+{
+    if(engine && pluginMap.contains(engine)) {
+        QPluginLoader *plugin = pluginMap.value(engine);
+        if (plugin) {
+            if (plugin->isLoaded()) {
+                plugin->unload();
+            }
+            delete plugin;
+        }
+        pluginMap.remove(engine);
+    }
+}
+
+MImEngineFactory::MImEngineFactory()
+    :d_ptr(new MImEngineFactoryPrivate)
+{
+    Q_D(MImEngineFactory);
+    d->q_ptr = this;
+}
+
+MImEngineFactory::~MImEngineFactory()
+{
+    delete d_ptr;
+}
+
+MImEngineFactory *MImEngineFactory::instance()
+{
+    static MImEngineFactory ap_instance;
+    return &ap_instance;
+}
+
+QStringList MImEngineFactory::drivers()
+{
+    return d_ptr->drivers();
+}
+
+MImEngineWordsInterface *MImEngineFactory::createEngineWords(const QString &driver)
+{
+    return qobject_cast<MImEngineWordsInterface *>(d_ptr->createEngine(driver, Words));
+}
+
+MImEngineHwrInterface *MImEngineFactory::createEngineHwr(const QString &driver)
+{
+    return qobject_cast<MImEngineHwrInterface *>(d_ptr->createEngine(driver, Hwr));
+}
+
+void MImEngineFactory::deleteEngine(MImEngineWordsInterface *engine)
+{
+    d_ptr->deleteEngine(dynamic_cast<QObject*>(engine) );
+}
+
+void MImEngineFactory::deleteEngine(MImEngineHwrInterface *engine)
+{
+    d_ptr->deleteEngine(dynamic_cast<QObject*>(engine));
+}
+
--- src/mimenginefactory.h
+++ src/mimenginefactory.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef MIMENGINEFACTORY_H
+#define MIMENGINEFACTORY_H
+
+#include <QObject>
+#include <QStringList>
+#include <QMap>
+#include "mimenginetypes.h"
+#include "mimenginewordsinterface.h"
+#include "mimenginehwrinterface.h"
+
+class MImEngineFactoryPrivate;
+
+/*!
+  \class MImEngineFactory
+
+  \brief The MImEngineFactory class provides a singleton mode interface
+  to create MImEngineInterface object.
+*/
+class MImEngineFactory
+{
+    Q_DISABLE_COPY(MImEngineFactory)
+    friend class Ut_MImEngineFactory;
+
+public:
+    /*!
+     * gets the singleton instance for MImEngineFactory
+     * note:
+            the keyboards related  driver must be installed to  "/usr/lib/meego-imengines/drivers/words";
+            the handwriting related driver must be installed to  "/usr/lib/meego-imengines/drivers/hwr";
+     * \return the singleton instance for MImEngineFactory
+     */
+    static MImEngineFactory *instance();
+
+    /*!
+     * create MImEngineWordsInterface object.
+     * \param driver the Engine name
+     * \return MImEngineWordsInterface object pointer or null if instantiation failed
+     */
+    MImEngineWordsInterface *createEngineWords(const QString &driver);
+
+    /*!
+     * create MImEngineHwrInterface object.
+     * \param driver the Engine name
+     * \return MImEngineHwrInterface object pointer or null if instantiation failed
+     */
+    MImEngineHwrInterface *createEngineHwr(const QString &driver);
+
+
+    /*!
+     * delete MImEngineWordsInterface object.
+     * \param engine MImEngineWordsInterface engine object pointer
+     */
+    void deleteEngine(MImEngineWordsInterface *engine);
+
+
+    /*!
+     * delete MImEngineHwrInterface object.
+     * \param engine the MImEngineHwrInterface Engine object pointer
+     */
+    void deleteEngine(MImEngineHwrInterface *engine);
+
+    /*!
+     * get driver names
+     * \return  driver names
+     */
+    QStringList drivers();
+
+    /*!
+     * MImEngineFactory destructor
+     */
+    ~MImEngineFactory();
+
+private:
+    MImEngineFactory();
+    MImEngineFactoryPrivate *const d_ptr;
+    Q_DECLARE_PRIVATE(MImEngineFactory);
+};
+
+#endif //MIMENGINEFACTORY_H
--- src/mimenginehwrinterface.h
+++ src/mimenginehwrinterface.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef MIMENGINEHWRINTERFACE_H
+#define MIMENGINEHWRINTERFACE_H
+
+#include "mimenginetypes.h"
+#include <QString>
+#include <QtPlugin>
+#include <QSize>
+ #include <QPoint>
+
+class QStringList;
+
+/*!
+  \class MImEngineHwrInterface
+
+  \brief Interface of handwritting recognition features.
+ */
+class MImEngineHwrInterface
+{
+public:
+    /*!
+     * Initialization
+     *\return bool
+     */
+    virtual bool init(void) = 0;
+
+    /*!
+     * Sets the area size of the recognition should take place
+     * \param QSize the size of the area
+     */
+    virtual void setAreaSize(QSize size) = 0;
+
+    /*!
+     * Gets the recognition area size
+     * \return QSize
+     */
+    virtual QSize areaSize() = 0;
+
+    /*!
+     * Sets the screen size, this may be needed by the engine whenever
+     * the device orientation changes
+     * \param QSize the size of the screen
+     */
+    virtual void setScreenSize(QSize size) = 0;
+
+    /*!
+     * Gets the screen size
+     * \return QSize
+     */
+    virtual QSize screenSize() = 0;
+
+    /*!
+     * Sets the scripts desired to be recognized
+     * \param QStringList scripts in ISO15924 format
+     * \return bool whether the operation was successful
+     */
+    virtual bool setScripts(const QStringList scripts) = 0;
+
+    /*!
+     * Gets the scripts requested to be recognized
+     * \param QStringList
+     */
+    virtual QStringList scripts() = 0;
+
+    /*!
+     * Recognizes the strokes in the buffer
+     * \return QString string recognized
+     */
+    virtual QStringList recognize() = 0;
+
+    /*!
+     * Appends a stroke into the buffer
+     * \param QList<QPoint> the stroke
+     */
+    virtual void appendStroke(const QList<QPoint> stroke) = 0;
+
+    /*!
+     * Clears the strokes in the buffer
+     */
+    virtual void clear() = 0;
+
+    /*!
+     * Gets error
+     *\param  N/A
+     *\return QString, error
+     */
+    virtual QString error() = 0;
+
+    /*!
+     * Trains the stroke in the buffer as string specified in the argument
+     * \param QString string
+     * \return bool whether the training was successful
+     */
+    virtual void train(const QString& string) = 0;
+
+    /*!
+     * Gets name for current driver
+     *\param  N/A
+     *\return QString, current driver name
+     */
+    virtual QString driver() = 0;
+};
+
+Q_DECLARE_INTERFACE(MImEngineHwrInterface,
+                    "com.meego.MImEngineHwrInterface/0.1")
+
+
+#endif // MIMENGINEHWRINTERFACE_H
+
+/*! \page
+\section intro_sec Input Method Engine Handwriting Recognition Interface
+
+ */
--- src/mimenginewordsinterface.h
+++ src/mimenginewordsinterface.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef MIMENGINEWORDSINTERFACE_H
+#define MIMENGINEWORDSINTERFACE_H
+
+#include "mimenginetypes.h"
+#include <QString>
+#include <QtPlugin>
+
+class QPoint;
+class QStringList;
+
+/*!
+  \class MImEngineWordsInterface
+
+  \brief Abstract driver class for adding new error correction/prediction
+  engines plugins.
+
+  Implementing a new engine driver means to subclass and implement the virtual methods.
+ */
+class MImEngineWordsInterface
+{
+public:
+    /*!
+     * Initialization
+     *\param parent point of QObject*
+     *\return bool
+     */
+    virtual bool init() = 0;
+
+    /*!
+     * Adds a new word to dictionary
+     *\param word, reference of const QString
+     *\param MImEngine::DictionaryType to which type of dictionary the word should be added
+     *\return bool true if the word is successfully added
+     */
+    virtual bool addDictionaryWord(const QString &word,
+                                   MImEngine::DictionaryType) = 0;
+
+    /*!
+     * Removes a word from dictionary
+     *\param word, reference of const QString
+     *\param MImEngine::DictionaryType from which type of dictionary the word should be removed
+     *\return bool true if the word is successfully removed
+     */
+    virtual bool removeDictionaryWord(const QString &word,
+                                      MImEngine::DictionaryType) = 0;
+
+    /*!
+     * Disables dictionary
+     *\param MImEngine::DictionaryType dictionary type which shall be disabled
+     *\return bool true if the dictionary is successfully disabled
+     */
+    virtual bool disableDictionary(MImEngine::DictionaryType) = 0;
+
+    /*!
+     * Enables dictionary
+     *\param MImEngine::DictionaryType dictionary type which shall be enabled
+     *\return bool true if the dictionary is successfully enabled
+     */
+    virtual bool enableDictionary(MImEngine::DictionaryType) = 0;
+
+    /*!
+     * Removes dictionary from disk
+     *\param MImEngine::DictionaryType dictionary type which shall be removed
+     *\return bool true if dictionary is successfully removed
+     */
+    virtual bool removeDictionary(MImEngine::DictionaryType) = 0;
+
+    /*!
+     * Appends one character to engine buffer
+     * \param s, reference of const QString
+     */
+    virtual void appendString(const QString &s) = 0;
+
+    /*!
+     * Appends string to engine buffer
+     * \param c, reference of const QChar
+     */
+    virtual void appendCharacter(const QChar &c) = 0;
+
+    /*!
+     * Tap to keyboard
+     * \param position, position of the tap in the keyboard layout
+     * \param shift, indicates whether the shift is on or not
+     * \param symbol, the preferred symbol
+     */
+    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol) = 0;
+
+    /*!
+     * Reselects a previously accepted word. Called when user highlights a previously accepted
+     * word to recreate the candidate list with the original input sequence and key values.
+     * \param s, word to reselect
+     */
+    virtual void reselectString(const QString &s) = 0;
+
+    /*!
+     * Sets context information to the engine. \n
+     * Context information is needed for better completion or for next word completion. 
+     * The context information is usually a part of committed texts which should be passed 
+     * to the engine before getting the completed/predicted word/character sequence from 
+     * the engine.
+     * \param s, the text block used as context information.
+     * \param cursor, the cursor position in the text block.
+     */
+    virtual void setContext(const QString &s, int cursor) = 0;
+
+    /*!
+     * Disables word prediction feature
+     */
+    virtual void disablePrediction() = 0;
+
+    /*!
+     * Enables word prediction feature
+     *\param  N/A
+     *\return N/A
+     */
+    virtual void enablePrediction() = 0;
+
+    /*!
+     * Gets the current status of word prediction
+     *\param  N/A
+     *\return bool, true if word prediction is enabled
+     */
+    virtual bool predictionEnabled() = 0;
+
+    /*!
+     * Disables word completion feature
+     */
+    virtual void disableCompletion() = 0;
+
+    /*!
+     * Enables word completion feature.
+     */
+    virtual void enableCompletion() = 0;
+
+    /*!
+     * Gets the current status of word completion
+     *\return bool, true if word completion is enabled
+     */
+    virtual bool completionEnabled() = 0;
+
+    /*!
+     * Disables auto correction feature
+     * Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".
+     */
+    virtual void disableCorrection() = 0;
+
+    /*!
+     * Enables auto correction feature
+     * Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".
+     */
+    virtual void enableCorrection() = 0;
+
+    /*!
+     * Gets the current status of auto correction
+     * Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".
+     *\return bool, true if auto correction is enabled
+     */
+    virtual bool correctionEnabled() = 0;
+
+    /*!
+     * Clears engine input buffer. Note: clearEngineBuffer will not save the input word and its frequency.
+     * \sa saveAndClearEngineBuffer(), appendString(), appendCharacter()
+     */
+    virtual void clearEngineBuffer() = 0;
+
+    /*!
+     * Saves the input word in engine buffer, and then clears the engine input buffer.
+     * Engine will store the input word to user dictionary (if new word), and store its used frequency.
+     * \sa appendString(), appendCharacter()
+     */
+    virtual void saveAndClearEngineBuffer() = 0;
+
+    /*!
+     * Gets the candidates given by the engine. \n
+     * Notes:
+     * -# By default, this method returns a candidate list which contains all candidates as much as 
+     * the number which is specified by "setMaximumCandidates()".
+     * -# If you want to specify the start index and the number of the candidates that you want, please
+     * pass your arguments to this method.
+     * -# The index of whole candidates starts from "0". And if your specified index or number exceeds 
+     * the actual range of candidates, an empty candidate list will be returned.
+     *
+     *\param uStartIndex, the start index of the whole candidate set. And the index starts from "0".
+     *\param uNum, the number of required candidates. If its value is "0", the default "Maximum" of 
+     * candidates will be returned.
+     *\return QStringList, the list of words given by the engine
+     */
+    virtual QStringList candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0) = 0;
+
+    /*!
+     * Gets the number of all available candidates currently.
+     * \return int, the number of all available candidates or -1 if failure occurs.
+     */
+    virtual int totalCandidates() = 0;
+
+    /*!
+     * Gets matched length of the chosen candidate for current input sequence. \n
+     * Notes:
+     * According to the input character sequence, "candidates()" can return a list and the user can choose
+     * one candidate from it and notify the result to the engine by invoking "setSuggestedCandidateIndex()" 
+     * or "setContext()" method. The chosen candidate might not match the whole input sequence and might 
+     * match only part of the input sequence. So this method will tell the matched length of the chosen 
+     * candidate for current input sequence.
+     *\return int, the matched length of the chosen candidate for current input sequence.
+     */
+    virtual int matchedLength() = 0;
+
+    /*!
+     * Gets recognized syllables from current input string.
+     * Notes:
+     * In some input methods, the input string can be divided into several syllables according to
+     * the most possible candidates. So in this case the input method engine shall list the recognized
+     * syllables in order to give the user some prompts.
+     * \return QStringList, the list of recognized syllables.
+     */
+    virtual QStringList matchedSyllables() = 0;
+
+    /*!
+     * Returns the index in the candidate list suggested by the engine as the most appropriate candidate.
+     * Call this after calling candidates(). Useful when doing error correction.
+     *\return the index of suggested candidate
+     *\sa candidates()
+     */
+    virtual int suggestedCandidateIndex() = 0;
+
+    /*!
+     * Sets the index of the suggested candidate in the candidates' list, when user select one word from the
+     * candidates' list, this API should be called, to info engine which one is the user preferred,
+     * then the engine can store the relative information( new word, used frequency, etc.).
+     *\param index, the index which is use selected
+     *\return indicate whether set seccessfully.
+     */
+    virtual bool setSuggestedCandidateIndex(int index) = 0;
+
+    /*!
+     * Sets exact word position in candidate list. Call this to tell engine to position the exact word candidate in the list.
+     * The exact word  can appear in first or last position
+     * of the candidate list and can also can be deleted from the candidate list.
+     * \param setting, indicates whether the exact word in the cadidate list.
+     *
+     * \sa MImEngine::ExactInListType.
+     */
+    virtual void setExactWordPositionInList(MImEngine::ExactInListType setting) = 0;
+
+    /*!
+     * Returns the source dictionary where the candidate comes from.
+     *
+     * \param index indicates the index of candidate in the candidates() list.
+     * \sa candidates().
+     */
+    virtual MImEngine::DictionaryType candidateSource(int index) = 0;
+
+    /*!
+     * Gets current language
+     *\param  N/A
+     *\return QString, current language
+     */
+    virtual QString language() = 0;
+
+
+    /*!
+     * Sets language with the indicated priority
+     *\param  lang, reference of const QString. the language to be set
+     *\param  MImEngine::LanguagePriority. the priority for the language
+     *\return N/A
+     */
+    virtual bool setLanguage(const QString &lang,
+                             MImEngine::LanguagePriority) = 0;
+
+    /*!
+     * DEPRECATED !!! Use setKeyboardLayoutKeys instead!
+     */
+    bool setKeyboardLayout(const QString &) { return false; }
+
+    /*!
+     * DEPRECATED !!! Use keyboardLayoutKeys instead!
+     */
+    QString keyboardLayout()  { return QString(); }
+
+    /*!
+     * Loads new keyboard layout keys for the engine.
+     * \param keys, list of keys in the keyboard layout
+     * \return bool, status
+     */
+    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys) = 0;
+
+    /*!
+     * Gets current keyboard layout keys
+     *\param  N/A
+     *\return QList<MImEngine::KeyboardLayoutKey>, current keyboard layout keys
+     */
+    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys() = 0;
+
+    /*!
+     * Exports the user dictionary into an xml file
+     * \return bool status
+     */
+    virtual bool exportAsNokiaDictionary(const QString &fileName) = 0;
+
+    /*!
+      * Imports user dictionary from an xml file
+      * \return bool status
+      */
+    virtual bool importNokiaUserDictionary(const QString &fileName) = 0;
+
+    /*!
+     * Gets name for current driver
+     *\param  N/A
+     *\return QString, current driver name
+     */
+    virtual QString driver() = 0;
+
+    /*!
+     * Sets the maximum number of errors could happen in a word.
+     *\param int, the maximum number to be set
+     *\return N/A
+     * \sa setMaximumCandidates()
+     */
+    virtual void setMaximumErrors(int maxErrors) = 0;
+
+    /*!
+     * Gets the maximum number of errors that could happen in a word.
+     *\param  N/A
+     *\return int, the maximum allowed errors in a word. If the errors in a word is larger than this,
+     * then engine maybe can not do proper correction.
+     */
+    virtual int maximumErrors() = 0;
+
+    /*!
+     * Sets the maximum number of candidates, including prediction and error correction
+     * The maximum number can not be bigger than 10.
+     *\param int, the maximum number to be set
+     *\return N/A
+     */
+    virtual void setMaximumCandidates(int maxCandidates) = 0;
+
+    /*!
+     * Sets the maximum number for candidates, including prediction and error correction
+     *\param  N/A
+     *\return int, the allowed maximum candidates' count
+     */
+    virtual int maximumCandidates() = 0;
+
+    /*!
+     * Sets current input method engine's script by four-letter script code. \n
+     * Notes: The ISO definition of four-letter script code is at 
+     *        "http://www.unicode.org/iso15924/iso15924-codes.html". 
+     *        The above definition should be followed here.
+     *\param s, the text string of four-letter script code.
+     *\return bool, true for success, otherwise false.
+     */
+    virtual bool setScript(const QString &s) = 0;
+
+    /*! 
+     * Gets four-letter script code of current input method engine.
+     *\return QString, the four-letter script code of current input method engine.
+     */
+    virtual QString script() = 0;
+
+    /*!
+     * Gets error
+     *\param  N/A
+     *\return QString, error
+     */
+    virtual QString error() = 0;
+};
+
+Q_DECLARE_INTERFACE(MImEngineWordsInterface,
+                    "com.nokia.Meego.MImEngineWordsInterface/0.1")
+
+
+#endif // MIMENGINEWORDSINTERFACE_H
+
+/*! \page
+\section intro_sec Input Method Engine Words Interface
+
+This interface provides typical word related functionalities, e.g. word prediction, word completion and error correction.
+
+ */
--- src/src.pro
+++ src/src.pro
+VERSION = 0.1.0
+TEMPLATE = lib
+TARGET=meegoimengine
+QMAKE_CXXFLAGS += -Werror
+CONFIG +=  debug
+INCLUDEPATH = ./ ../includes
+LIBS += -L./
+
+include(../meegoimengine.prf)
+
+LIBS += -L$$[QT_INSTALL_LIBS]
+QT = core
+
+# coverage flags are off per default, but can be enabled via qmake COV_OPTION=on
+for(OPTION,$$list($$lower($$COV_OPTION))){
+    isEqual(OPTION, on){
+        QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs -fno-elide-constructors
+        LIBS += -lgcov
+    }
+}
+
+QMAKE_CLEAN += *.gcno *.gcda
+
+SOURCES +=  mimenginefactory.cpp
+HEADERS +=  mimenginewordsinterface.h \
+            MImEngineWordsInterface \
+            mimenginehwrinterface.h \
+            MImEngineHwrInterface \
+            mimenginefactory.h \
+            ../includes/mimenginetypes.h \
+
+CONFIG +=  debug
+
+target.path += $$MEEGOIMENGINE_PREFIX/lib
+
+headers.path += $$MEEGOIMENGINE_INSTALL_HEADERS
+headers.files += $$HEADERS
+
+install_headers.path = $$MEEGOIMENGINE_INSTALL_HEADERS
+install_headers.files = include/*
+
+install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
+install_prf.files = meegoimengineinterface.prf
+
+INSTALLS += target \
+    headers \
+    install_headers \
+    install_pkgconfig \
+    install_prf \
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.depends = lib$${TARGET}.so.$$VERSION
+check-xml.commands = $$system(true)
+
+QMAKE_EXTRA_TARGETS += check
+check.depends = lib$${TARGET}.so.$$VERSION
+check.commands = $$system(true)
+
+QMAKE_EXTRA_TARGETS += memcheck
+memcheck.depends = lib$${TARGET}.so.$$VERSION
+memcheck.commands = $$system(true)
+
+MIMENGINE_PCFILE = MeegoImEngine.pc.in
+
+PREFIX_PATH=/usr
+
+pcfile.output = MeegoImEngine.pc
+pcfile.input = MIMENGINE_PCFILE
+pcfile.commands += sed -e \"s:PREFIX_PATH:$$PREFIX_PATH:g\" ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
+pcfile.CONFIG = target_predeps no_link
+QMAKE_EXTRA_COMPILERS += pcfile
+
+install_pkgconfig.path = /usr/lib/pkgconfig
+install_pkgconfig.files = MeegoImEngine.pc
+
--- unit_test/common_check.pri
+++ unit_test/common_check.pri
@@ -1,6 +1,6 @@
 QMAKE_EXTRA_TARGETS += check
 check.target = check
-check.commands = @MYSTUBDRIVER_PATH=../lib/ LD_LIBRARY_PATH=../../words/:../lib/ ./$$TARGET
+check.commands = @MYSTUBDRIVER_PATH=../lib/ LD_LIBRARY_PATH=../../src/:../lib/ ./$$TARGET
 check.depends += $$TARGET
 
 QMAKE_EXTRA_TARGETS += check-xml
@@ -10,12 +10,12 @@
 
 QMAKE_EXTRA_TARGETS += memcheck
 memcheck.target = memcheck
-memcheck.commands = LD_LIBRARY_PATH=../../words/:../lib/ valgrind --leak-check=full --trace-children=yes --num-callers=50 --xml=yes --log-file=$${TARGET}.memcheck.xml ./$$TARGET && \
+memcheck.commands = LD_LIBRARY_PATH=../../src/:../lib/ valgrind --leak-check=full --trace-children=yes --num-callers=50 --xml=yes --log-file=$${TARGET}.memcheck.xml ./$$TARGET && \
 	xsltproc --stringparam global.target $$TARGET ../memcheck.xsl $${TARGET}.memcheck.xml > $${TARGET}.memcheck.html
 memcheck.depends += $$TARGET
 
 QMAKE_CLEAN += *.log *.xml *~ *.html
 
-target.path = /usr/share/libmeegoimengine-tests/$$TARGET
+
 INSTALLS += target \
 
--- unit_test/gen-tests-xml.sh
+++ unit_test/gen-tests-xml.sh
+#!/bin/bash
+
+
+STARTUP_TEMPLATE="<case name=\"init_testcase\" description=\"Remove possible stale configuration file\" insignificant=\"true\" requirement=\"\" timeout=\"120\">
+        <step expected_result=\"0\">rm -f ~/.config/Nokia/MImEngineWordsInterface.conf</step>
+      </case>
+      "
+UT_STARTUP="${STARTUP_TEMPLATE}"
+
+UT_TESTCASES_WORDS=""
+UT_TESTCASES_HWR=""
+
+for TEST in `ls -d ut_*words`; do
+      if [ -x $TEST/$TEST ]; then
+
+TESTCASE_TEMPLATE="<case name=\"$TEST\" description=\"$TEST\" requirement=\"\" timeout=\"120\">
+        <step expected_result=\"0\">LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/meego-imengines/drivers/words /usr/lib/libmeegoimengine-tests/words/$TEST/$TEST</step>
+      </case>
+      "
+
+            UT_TESTCASES_WORDS="${UT_TESTCASES_WORDS}${TESTCASE_TEMPLATE}"
+        fi
+done
+
+
+for TEST in `ls -d ut_*hwr`; do
+      if [ -x $TEST/$TEST ]; then
+
+TESTCASE_TEMPLATE="<case name=\"$TEST\" description=\"$TEST\" requirement=\"\" timeout=\"120\">
+        <step expected_result=\"0\">LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/meego-imengines/drivers/hwr /usr/lib/libmeegoimengine-tests/hwr/$TEST/$TEST</step>
+      </case>
+      "
+
+            UT_TESTCASES_HWR="${UT_TESTCASES_HWR}${TESTCASE_TEMPLATE}"
+        fi
+done
+
+
+TESTSUITE_TEMPLATE="<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
+<testdefinition version=\"0.1\">
+  <suite name=\"libmeegoimengine-tests\">
+    <set name=\"unit_tests\" description=\"Unit Tests\">
+
+      $UT_STARTUP
+      $UT_TESTCASES_WORDS
+      $UT_TESTCASES_HWR
+
+      <environments>
+        <scratchbox>false</scratchbox>
+        <hardware>true</hardware>    
+      </environments> 
+
+    </set>
+  </suite>
+</testdefinition>"
+
+echo "$TESTSUITE_TEMPLATE"
+
--- unit_test/mydriverstub
+++ unit_test/mydriverstub
-(directory)
--- unit_test/mydriverstub/README
+++ unit_test/mydriverstub/README
(renamed to unit_test/mydriverstub_words/README)
--- unit_test/mydriverstub/mydriverstub.pro
+++ unit_test/mydriverstub/mydriverstub.pro
-
-TEMPLATE = lib
-LIBNAME = stubdriver1
-TARGET = ../lib/$${LIBNAME}
-DEFINES += ET9_ALPHABETIC_MODULE
-LIBS += -L../../words -lmeegoimenginewords 
-
-INCLUDEPATH += ../../words ../../includes ../stubbase
-
-# stub
-HEADERS += ../stubbase/stubbase.h
-SOURCES += ../stubbase/stubbase.cpp
-
-# Input
-HEADERS += stubdriver.h 
-SOURCES += stubdriver.cpp   
-
-CONFIG += debug plugin
-QT = core
-
-target.path += /usr/lib/meego-imengines/drivers/
-INSTALLS += target \
-
-QMAKE_CLEAN += ../lib/*
-
-QMAKE_EXTRA_TARGETS += check
-check.target = check
-check.command = $$system(true)
-check.depends = ../lib/lib$${LIBNAME}.so
-
-QMAKE_EXTRA_TARGETS += check-xml
-check-xml.target = check-xml
-check-xml.command = $$system(true)
-check-xml.depends = ../lib/lib$${LIBNAME}.so
-
-QMAKE_EXTRA_TARGETS += memcheck 
-memcheck.target = memcheck
-memcheck.command = $$system(true)
-memcheck.depends = ../lib/lib$${LIBNAME}.so
--- unit_test/mydriverstub/stubdriver.cpp
+++ unit_test/mydriverstub/stubdriver.cpp
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "stubdriver.h"
-#include <iostream>
-#include <string>
-#include <QObject>
-#include <mimenginewordsinterfacefactory.h>
-#include <QStringList>
-#include <QtPlugin>
-#include <QtDebug>
-#include <QLibrary>
-#include <QSettings>
-#include <QFile>
-#include <QDataStream>
-
-
-StubDriver::StubDriver()
-{
-    m_noCandidates = 0;
-}
-
-StubDriver::~StubDriver()
-{
-}
-
-bool StubDriver::init()
-{
-    return true;
-}
-
-bool StubDriver::addDictionaryWord(const QString &w, MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(w));
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("addDictionaryWord", params);
-    Q_UNUSED(w);
-    return stubReturnValue<bool>("addDictionaryWord");
-}
-
-bool StubDriver::removeDictionaryWord(const QString &w, MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(w));
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("removeDictionaryWord", params);
-    Q_UNUSED(w);
-    return stubReturnValue<bool>("removeDictionaryWord");
-}
-
-bool StubDriver::disableDictionary(MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("disableDictionary", params);
-    return stubReturnValue<bool>("disableDictionary");
-}
-bool StubDriver::enableDictionary(MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("enableDictionary", params);
-    return stubReturnValue<bool>("enableDictionary");
-}
-bool StubDriver::removeDictionary(MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("removeDictionary", params);
-    return stubReturnValue<bool>("removeDictionary");
-}
-
-void StubDriver::appendString(const QString &s)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(s));
-    stubMethodEntered("appendString", params);
-    Q_UNUSED(s);
-}
-void StubDriver::appendCharacter(const QChar &c)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QChar &>(c));
-    stubMethodEntered("appendCharacter", params);
-    Q_UNUSED(c);
-}
-
-void StubDriver::tapKeyboard(const QPoint &position, bool shift, QChar symbol)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QPoint &>(position));
-    params.append(new Parameter<bool>(shift));
-    params.append(new Parameter<QChar>(symbol));
-    stubMethodEntered("tapKeyboard", params);
-    Q_UNUSED(position);
-    Q_UNUSED(shift);
-}
-
-void StubDriver::reselectString(const QString &s)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(s));
-    stubMethodEntered("reselectString", params);
-    Q_UNUSED(s);
-}
-
-void StubDriver::setContext(const QString &s, int cursor)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(s));
-    params.append(new Parameter<int>(cursor));
-    stubMethodEntered("setContext", params);
-    Q_UNUSED(s);
-}
-
-void StubDriver::disablePrediction()
-{
-    stubMethodEntered("disablePrediction");
-}
-void StubDriver::enablePrediction()
-{
-    stubMethodEntered("enablePrediction");
-}
-bool StubDriver::predictionEnabled()
-{
-    stubMethodEntered("predictionEnabled");
-    return stubReturnValue<bool>("predictionEnabled");
-}
-
-void StubDriver::disableCorrection()
-{
-    stubMethodEntered("disableCorrection");
-}
-void StubDriver::enableCorrection()
-{
-    stubMethodEntered("enableCorrection");
-}
-bool StubDriver::correctionEnabled()
-{
-    stubMethodEntered("correctionEnabled");
-    return stubReturnValue<bool>("correctionEnabled");
-}
-
-
-void StubDriver::disableCompletion()
-{
-    stubMethodEntered("disableCompletion");
-}
-void StubDriver::enableCompletion()
-{
-    stubMethodEntered("enableCompletion");
-}
-bool StubDriver::completionEnabled()
-{
-    stubMethodEntered("completionEnabled");
-    return stubReturnValue<bool>("completionEnabled");
-}
-
-QStringList StubDriver::candidates(unsigned int uStartIndex, unsigned int uNum)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<unsigned int &>(uStartIndex));
-    params.append(new Parameter<unsigned int &>(uNum));
-    stubMethodEntered("candidates", params);
-    return stubReturnValue<QStringList>("candidates");
-}
-
-int StubDriver::totalCandidates()
-{
-    stubMethodEntered("totalCandidates");
-    return stubReturnValue<int>("totalCandidates");
-}
-
-int StubDriver::matchedLength()
-{
-    stubMethodEntered("matchedLength");
-    return stubReturnValue<int>("matchedLength");
-}
-
-int StubDriver::suggestedCandidateIndex()
-{
-    stubMethodEntered("suggestedCandidateIndex");
-    return stubReturnValue<int>("suggestedCandidateIndex");
-}
-
-bool StubDriver::setSuggestedCandidateIndex(int index)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int &>(index));
-    stubMethodEntered("setSuggestedCandidateIndex", params);
-    return stubReturnValue<bool>("setSuggestedCandidateIndex");
-}
-
-void StubDriver::setExactWordPositionInList(MImEngine::ExactInListType setting)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::ExactInListType &>(setting));
-    stubMethodEntered("setExactWordPositionInList", params);
-
-}
-
-MImEngine::DictionaryType StubDriver::candidateSource(int index)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int &>(index));
-    stubMethodEntered("candidateSource", params);
-    return stubReturnValue<MImEngine::DictionaryType>("candidateSource");
-}
-
-void StubDriver::clearEngineBuffer()
-{
-    stubMethodEntered("clearEngineBuffer");
-}
-
-void StubDriver::saveAndClearEngineBuffer()
-{
-    stubMethodEntered("saveAndClearEngineBuffer");
-}
-
-QString StubDriver::language()
-{
-    stubMethodEntered("language");
-    return stubReturnValue<QString>("language");
-}
-
-bool StubDriver::setLanguage(const QString  &lan , MImEngine::LanguagePriority p)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(lan));
-    params.append(new Parameter<MImEngine::LanguagePriority>(p));
-    stubMethodEntered("setLanguage", params);
-    return stubReturnValue<bool>("setLanguage");
-}
-
-bool StubDriver::setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<QList<MImEngine::KeyboardLayoutKey> >(keys));
-    stubMethodEntered("setKeyboardLayoutKeys", params);
-    return stubReturnValue<bool>("setKeyboardLayoutKeys");
-}
-
-QList<MImEngine::KeyboardLayoutKey> StubDriver::keyboardLayoutKeys()
-{
-    stubMethodEntered("keyboardLayoutKeys");
-    return stubReturnValue<QList<MImEngine::KeyboardLayoutKey> >("keyboardLayoutKeys");
-}
-
-bool StubDriver::exportAsNokiaDictionary(const QString &fileName)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(fileName));
-    stubMethodEntered("exportAsNokiaDictionary", params);
-    return stubReturnValue<bool>("exportAsNokiaDictionary");
-}
-
-bool StubDriver::importNokiaUserDictionary(const QString &fileName)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(fileName));
-    stubMethodEntered("importNokiaUserDictionary", params);
-    return stubReturnValue<bool>("importNokiaUserDictionary");
-}
-
-void StubDriver::setMaximumErrors(int maxErrors)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int>(maxErrors));
-    stubMethodEntered("setMaximumErrors", params);
-}
-
-int StubDriver::maximumErrors()
-{
-    stubMethodEntered("maximumErrors");
-    return stubReturnValue<int>("maximumErrors");
-}
-
-QString StubDriver::driver()
-{
-    stubMethodEntered("driver");
-    qDebug() << "stub driver 1!";
-    return "stubdriver1";
-}
-
-void StubDriver::setMaximumCandidates(int maxCandidates)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int>(maxCandidates));
-    stubMethodEntered("setMaximumCandidates", params);
-}
-
-int StubDriver::maximumCandidates()
-{
-    stubMethodEntered("maximumCandidates");
-    return stubReturnValue<int>("maximumCandidates");
-}
-
-QString StubDriver::error()
-{
-    stubMethodEntered("error");
-    return QString();
-}
-
-Q_EXPORT_PLUGIN2(stubdriver1, StubDriver);
--- unit_test/mydriverstub/stubdriver.h
+++ unit_test/mydriverstub/stubdriver.h
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#ifndef STUBDRIVER_H
-#define STUBDRIVER_H
-
-#include <stubbase.h>
-#include <mimenginetypes.h>
-#include <QVector>
-#include <QMap>
-#include <QObject>
-#include <mimenginewordsinterface.h>
-
-class MImEngineWords;
-class QStringList;
-class QtPlugin;
-class QtDebug;
-class QLibrary;
-class QSettings;
-class QFile;
-
-/*!
-  \class StubDriver
-
-  \brief StubDriver inherit from MImEngineWordsInterface(Abstract driver class) and QObject,
-  it implement the input method engine, provide the functions: e.g. new error correction/prediction.
-
- */
-class StubDriver: public QObject, public MImEngineWordsInterface, public StubBase
-{
-    Q_OBJECT
-    Q_DISABLE_COPY(StubDriver)
-    Q_INTERFACES(MImEngineWordsInterface)
-
-
-public:
-    /*!
-     * StubDriver construtor
-     *\param N/A
-     *\return StubDriver
-     */
-    StubDriver();
-
-    /*!
-     * StubDriver destructor
-     *\param  N/A
-     *\return N/A
-     */
-    ~StubDriver();
-
-    /*!
-     *\reimp
-    */
-
-    virtual bool init();
-
-    virtual bool addDictionaryWord(const QString &word, MImEngine::DictionaryType);
-
-    virtual bool removeDictionaryWord(const QString &word, MImEngine::DictionaryType);
-
-    virtual bool disableDictionary(MImEngine::DictionaryType);
-
-    virtual bool enableDictionary(MImEngine::DictionaryType);
-
-    virtual bool removeDictionary(MImEngine::DictionaryType);
-
-    virtual void appendString(const QString &candidate);
-
-    virtual void appendCharacter(const QChar &candidate);
-
-    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol);
-
-    virtual void reselectString(const QString &s);
-
-    virtual void setContext(const QString &s, int cursor);
-
-    virtual void disablePrediction();
-
-    virtual void enablePrediction();
-
-    virtual bool predictionEnabled();
-
-    virtual void disableCorrection();
-
-    virtual void enableCorrection();
-
-    virtual bool correctionEnabled();
-
-    virtual void disableCompletion();
-
-    virtual void enableCompletion();
-
-    virtual bool completionEnabled();
-
-    virtual QStringList candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0);
-
-    virtual int totalCandidates();
-
-    virtual int matchedLength();
-
-    virtual int suggestedCandidateIndex();
-
-    virtual bool setSuggestedCandidateIndex(int index);
-
-    virtual void setExactWordPositionInList(MImEngine::ExactInListType setting);
-
-    virtual MImEngine::DictionaryType candidateSource(int index);
-
-    virtual void clearEngineBuffer();
-
-    virtual void saveAndClearEngineBuffer();
-
-    virtual QString  language();
-
-    virtual bool setLanguage(const QString &language, MImEngine::LanguagePriority);
-
-    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys);
-
-    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys();
-
-    virtual bool exportAsNokiaDictionary(const QString &);
-
-    virtual bool importNokiaUserDictionary(const QString &);
-
-    virtual void setMaximumErrors(int);
-
-    virtual int maximumErrors();
-
-    virtual void setMaximumCandidates(int maxCandidates);
-
-    virtual int maximumCandidates();
-
-    virtual QString driver();
-
-    virtual QString error();
-
-    /*!
-     *\reimp_end
-    */
-
-private:
-    int m_noCandidates;
-};
-#endif //STUBDRIVER_H
--- unit_test/mydriverstub2
+++ unit_test/mydriverstub2
-(directory)
--- unit_test/mydriverstub2/README
+++ unit_test/mydriverstub2/README
-stub driver for unit test
-step:
-$qmake
-$make
-$make install
--- unit_test/mydriverstub2/mydriverstub2.pro
+++ unit_test/mydriverstub2/mydriverstub2.pro
-
-TEMPLATE = lib
-LIBNAME = stubdriver2
-TARGET = ../lib/$${LIBNAME}
-DEFINES += ET9_ALPHABETIC_MODULE
-LIBS += -L../../words -lmeegoimenginewords 
-
-INCLUDEPATH += ../../words ../../includes ../stubbase
-
-# stub
-HEADERS += ../stubbase/stubbase.h 
-SOURCES += ../stubbase/stubbase.cpp
-
-# Input
-HEADERS += stubdriver2.h 
-SOURCES += stubdriver2.cpp   
-
-CONFIG += debug plugin
-QT = core
-
-target.path += /usr/lib/meego-imengines/drivers/
-INSTALLS += target \
-
-QMAKE_CLEAN += ../lib/*
-
-QMAKE_EXTRA_TARGETS += check
-check.target = check
-check.command = $$system(true)
-check.depends = ../lib/lib$${LIBNAME}.so
-
-QMAKE_EXTRA_TARGETS += check-xml
-check-xml.target = check-xml
-check-xml.command = $$system(true)
-check-xml.depends = ../lib/lib$${LIBNAME}.so
-
-QMAKE_EXTRA_TARGETS += memcheck 
-memcheck.target = memcheck
-memcheck.command = $$system(true)
-memcheck.depends = ../lib/lib$${LIBNAME}.so
--- unit_test/mydriverstub2/stubdriver2.cpp
+++ unit_test/mydriverstub2/stubdriver2.cpp
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "stubdriver2.h"
-#include <iostream>
-#include <string>
-#include <QObject>
-#include <mimenginewordsinterfacefactory.h>
-#include <QStringList>
-#include <QtPlugin>
-#include <QtDebug>
-#include <QLibrary>
-#include <QSettings>
-#include <QFile>
-#include <QDataStream>
-
-
-StubDriver2::StubDriver2()
-{
-    m_noCandidates = 0;
-}
-
-StubDriver2::~StubDriver2()
-{
-}
-
-bool StubDriver2::init()
-{
-    return true;
-}
-
-bool StubDriver2::addDictionaryWord(const QString &w, MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(w));
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("addDictionaryWord", params);
-    Q_UNUSED(w);
-    return stubReturnValue<bool>("addDictionaryWord");
-}
-
-bool StubDriver2::removeDictionaryWord(const QString &w, MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(w));
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("removeDictionaryWord", params);
-    Q_UNUSED(w);
-    return stubReturnValue<bool>("removeDictionaryWord");
-}
-
-bool StubDriver2::disableDictionary(MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("disableDictionary", params);
-    return stubReturnValue<bool>("disableDictionary");
-}
-bool StubDriver2::enableDictionary(MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("enableDictionary", params);
-    return stubReturnValue<bool>("enableDictionary");
-}
-bool StubDriver2::removeDictionary(MImEngine::DictionaryType type)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::DictionaryType>(type));
-    stubMethodEntered("removeDictionary", params);
-    return stubReturnValue<bool>("removeDictionary");
-}
-
-void StubDriver2::appendString(const QString &s)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(s));
-    stubMethodEntered("appendString", params);
-    Q_UNUSED(s);
-}
-void StubDriver2::appendCharacter(const QChar &c)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QChar &>(c));
-    stubMethodEntered("appendCharacter", params);
-    Q_UNUSED(c);
-}
-
-void StubDriver2::tapKeyboard(const QPoint &position, bool shift, QChar symbol)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QPoint &>(position));
-    params.append(new Parameter<bool>(shift));
-    params.append(new Parameter<QChar>(symbol));
-    stubMethodEntered("tapKeyboard", params);
-    Q_UNUSED(position);
-    Q_UNUSED(shift);
-}
-
-void StubDriver2::reselectString(const QString &s)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(s));
-    stubMethodEntered("reselectString", params);
-    Q_UNUSED(s);
-}
-
-void StubDriver2::setContext(const QString &s, int cursor)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(s));
-    params.append(new Parameter<int>(cursor));
-    stubMethodEntered("setContext", params);
-    Q_UNUSED(s);
-}
-
-void StubDriver2::disablePrediction()
-{
-    stubMethodEntered("disablePrediction");
-}
-void StubDriver2::enablePrediction()
-{
-    stubMethodEntered("enablePrediction");
-}
-bool StubDriver2::predictionEnabled()
-{
-    stubMethodEntered("predictionEnabled");
-    return stubReturnValue<bool>("predictionEnabled");
-}
-
-void StubDriver2::disableCorrection()
-{
-    stubMethodEntered("disableCorrection");
-}
-void StubDriver2::enableCorrection()
-{
-    stubMethodEntered("enableCorrection");
-}
-bool StubDriver2::correctionEnabled()
-{
-    stubMethodEntered("correctionEnabled");
-    return stubReturnValue<bool>("correctionEnabled");
-}
-
-
-void StubDriver2::disableCompletion()
-{
-    stubMethodEntered("disableCompletion");
-}
-void StubDriver2::enableCompletion()
-{
-    stubMethodEntered("enableCompletion");
-}
-bool StubDriver2::completionEnabled()
-{
-    stubMethodEntered("completionEnabled");
-    return stubReturnValue<bool>("completionEnabled");
-}
-
-QStringList StubDriver2::candidates(unsigned int uStartIndex, unsigned int uNum)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<unsigned int &>(uStartIndex));
-    params.append(new Parameter<unsigned int &>(uNum));
-    stubMethodEntered("candidates", params);
-    return stubReturnValue<QStringList>("candidates");
-}
-
-int StubDriver2::totalCandidates()
-{
-    stubMethodEntered("totalCandidates");
-    return stubReturnValue<int>("totalCandidates");
-}
-
-int StubDriver2::matchedLength()
-{
-    stubMethodEntered("matchedLength");
-    return stubReturnValue<int>("matchedLength");
-}
-
-int StubDriver2::suggestedCandidateIndex()
-{
-    stubMethodEntered("suggestedCandidateIndex");
-    return stubReturnValue<int>("suggestedCandidateIndex");
-}
-
-bool  StubDriver2::setSuggestedCandidateIndex(int index)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int &>(index));
-    stubMethodEntered("setSuggestedCandidateIndex", params);
-    return stubReturnValue<bool>("setSuggestedCandidateIndex");
-}
-
-void StubDriver2::setExactWordPositionInList(MImEngine::ExactInListType setting)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<MImEngine::ExactInListType &>(setting));
-    stubMethodEntered("setExactWordPositionInList", params);
-
-}
-
-MImEngine::DictionaryType StubDriver2::candidateSource(int index)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int &>(index));
-    stubMethodEntered("candidateSource", params);
-    return stubReturnValue<MImEngine::DictionaryType>("candidateSource");
-}
-
-void StubDriver2::clearEngineBuffer()
-{
-    stubMethodEntered("clearEngineBuffer");
-}
-
-void StubDriver2::saveAndClearEngineBuffer()
-{
-    stubMethodEntered("saveAndClearEngineBuffer");
-}
-
-QString  StubDriver2::language()
-{
-    stubMethodEntered("language");
-    return stubReturnValue<QString>("language");
-}
-bool StubDriver2::setLanguage(const QString  &lan , MImEngine::LanguagePriority p)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(lan));
-    params.append(new Parameter<MImEngine::LanguagePriority>(p));
-    stubMethodEntered("setLanguage", params);
-    return stubReturnValue<bool>("setLanguage");
-}
-
-bool StubDriver2::setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<QList<MImEngine::KeyboardLayoutKey> >(keys));
-    stubMethodEntered("setKeyboardLayoutKeys", params);
-    return stubReturnValue<bool>("setKeyboardLayoutKeys");
-}
-
-QList<MImEngine::KeyboardLayoutKey> StubDriver2::keyboardLayoutKeys()
-{
-    stubMethodEntered("keyboardLayoutKeys");
-    return stubReturnValue<QList<MImEngine::KeyboardLayoutKey> >("keyboardLayoutKeys");
-}
-
-bool StubDriver2::exportAsNokiaDictionary(const QString &fileName)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(fileName));
-    stubMethodEntered("exportAsNokiaDictionary", params);
-    return stubReturnValue<bool>("exportAsNokiaDictionary");
-}
-
-bool StubDriver2::importNokiaUserDictionary(const QString &fileName)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<const QString &>(fileName));
-    stubMethodEntered("importNokiaUserDictionary", params);
-    return stubReturnValue<bool>("importNokiaUserDictionary");
-}
-
-void StubDriver2::setMaximumErrors(int maxErrors)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int>(maxErrors));
-    stubMethodEntered("setMaximumErrors", params);
-}
-
-int StubDriver2::maximumErrors()
-{
-    stubMethodEntered("maximumErrors");
-    return stubReturnValue<int>("maximumErrors");
-}
-
-QString StubDriver2::driver()
-{
-    stubMethodEntered("driver");
-    qDebug() << "stub driver 2!";
-    return "stubdriver2";
-}
-void StubDriver2::setMaximumCandidates(int maxCandidates)
-{
-    QList<ParameterBase *> params;
-    params.append(new Parameter<int>(maxCandidates));
-    stubMethodEntered("setMaximumCandidates", params);
-}
-
-int StubDriver2::maximumCandidates()
-{
-    stubMethodEntered("maximumCandidates");
-    return stubReturnValue<int>("maximumCandidates");
-}
-
-QString StubDriver2::error()
-{
-    stubMethodEntered("error");
-    return QString();
-}
-
-Q_EXPORT_PLUGIN2(stubdriver2, StubDriver2);
--- unit_test/mydriverstub2/stubdriver2.h
+++ unit_test/mydriverstub2/stubdriver2.h
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#ifndef STUBDRIVER2_H
-#define STUBDRIVER2_H
-
-#include <stubbase.h>
-#include <mimenginetypes.h>
-#include <QVector>
-#include <QMap>
-#include <QObject>
-#include <mimenginewordsinterface.h>
-
-class MImEngineWords;
-class QStringList;
-class QtPlugin;
-class QtDebug;
-class QLibrary;
-class QSettings;
-class QFile;
-
-/*!
-  \class StubDriver
-
-  \brief StubDriver inherit from MImEngineWordsInterface(Abstract driver class) and QObject,
-  it implement the input method engine, provide the functions: e.g. new error correction/prediction.
-
- */
-class StubDriver2: public QObject, public MImEngineWordsInterface, public StubBase
-{
-    Q_OBJECT
-    Q_DISABLE_COPY(StubDriver2)
-    Q_INTERFACES(MImEngineWordsInterface)
-
-
-public:
-    /*!
-     * StubDriver construtor
-     *\param N/A
-     *\return StubDriver
-     */
-    StubDriver2();
-
-    /*!
-     * StubDriver destructor
-     *\param  N/A
-     *\return N/A
-     */
-    ~StubDriver2();
-
-    /*!
-     *\reimp
-    */
-
-    virtual bool init();
-
-    virtual bool addDictionaryWord(const QString &word, MImEngine::DictionaryType);
-
-    virtual bool removeDictionaryWord(const QString &word, MImEngine::DictionaryType);
-
-    virtual bool disableDictionary(MImEngine::DictionaryType);
-
-    virtual bool enableDictionary(MImEngine::DictionaryType);
-
-    virtual bool removeDictionary(MImEngine::DictionaryType);
-
-    virtual void appendString(const QString &candidate);
-
-    virtual void appendCharacter(const QChar &candidate);
-
-    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol);
-
-    virtual void reselectString(const QString &s);
-
-    virtual void setContext(const QString &s, int cursor);
-
-    virtual void disablePrediction();
-
-    virtual void enablePrediction();
-
-    virtual bool predictionEnabled();
-
-    virtual void disableCorrection();
-
-    virtual void enableCorrection();
-
-    virtual bool correctionEnabled();
-
-    virtual void disableCompletion();
-
-    virtual void enableCompletion();
-
-    virtual bool completionEnabled();
-
-    virtual QStringList  candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0);
-
-    virtual int totalCandidates();
-
-    virtual int matchedLength();
-
-    virtual int suggestedCandidateIndex();
-
-    virtual bool setSuggestedCandidateIndex(int index);
-
-    virtual void setExactWordPositionInList(MImEngine::ExactInListType setting);
-
-    virtual MImEngine::DictionaryType candidateSource(int index);
-
-    virtual void clearEngineBuffer();
-
-    virtual void saveAndClearEngineBuffer();
-
-    virtual QString  language();
-
-    virtual bool setLanguage(const QString &language, MImEngine::LanguagePriority);
-
-    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys);
-
-    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys();
-
-    virtual bool exportAsNokiaDictionary(const QString &);
-
-    virtual bool importNokiaUserDictionary(const QString &);
-
-    virtual void setMaximumErrors(int);
-
-    virtual int maximumErrors();
-
-    virtual void setMaximumCandidates(int maxCandidates);
-
-    virtual int maximumCandidates();
-
-    virtual QString driver();
-
-    virtual QString error();
-
-    /*!
-     *\reimp_end
-    */
-
-private:
-    int m_noCandidates;
-};
-#endif //STUBDRIVER2_H
--- unit_test/mydriverstub2_hwr
+++ unit_test/mydriverstub2_hwr
+(directory)
--- unit_test/mydriverstub2_hwr/README
+++ unit_test/mydriverstub2_hwr/README
+stub driver for unit test
+step:
+$qmake
+$make
+$make install
--- unit_test/mydriverstub2_hwr/mydriverstub2_hwr.pro
+++ unit_test/mydriverstub2_hwr/mydriverstub2_hwr.pro
+
+TEMPLATE = lib
+LIBNAME = stubdriver2_hwr
+TARGET = ../lib/$${LIBNAME}
+DEFINES += 
+LIBS += -L../../src -lmeegoimengine
+
+INCLUDEPATH += ../../src ../../includes ../stubbase
+
+# stub
+HEADERS += ../stubbase/stubbase.h
+SOURCES += ../stubbase/stubbase.cpp
+
+# Input
+HEADERS += stubdriver2.h 
+SOURCES += stubdriver2.cpp   
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/hwr
+INSTALLS += target \
+
+QMAKE_CLEAN += ./lib/*
+
+QMAKE_EXTRA_TARGETS += check
+check.target = check
+check.command = $$system(true)
+check.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.target = check-xml
+check-xml.command = $$system(true)
+check-xml.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += memcheck 
+memcheck.target = memcheck
+memcheck.command = $$system(true)
+memcheck.depends = ../lib/lib$${LIBNAME}.so
--- unit_test/mydriverstub2_hwr/stubdriver2.cpp
+++ unit_test/mydriverstub2_hwr/stubdriver2.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "stubdriver2.h"
+#include <iostream>
+#include <string>
+#include <QObject>
+#include <mimenginefactory.h>
+#include <QStringList>
+#include <QtPlugin>
+#include <QtDebug>
+#include <QLibrary>
+#include <QSettings>
+#include <QFile>
+#include <QDataStream>
+
+
+StubDriver2Hwr::StubDriver2Hwr()
+{   
+}
+
+StubDriver2Hwr::~StubDriver2Hwr()
+{
+}
+
+bool StubDriver2Hwr::init()
+{
+    return true;
+}
+
+void StubDriver2Hwr::setAreaSize(QSize size)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<QSize>(size));
+    stubMethodEntered("setAreaSize", params);
+}
+
+
+QSize StubDriver2Hwr::areaSize()
+{
+    stubMethodEntered("areaSize");
+    return stubReturnValue<QSize>("areaSize");
+}
+
+void StubDriver2Hwr::setScreenSize(QSize size)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<QSize>(size));
+    stubMethodEntered("setScreenSize", params);
+}
+
+QSize StubDriver2Hwr::screenSize()
+{
+    stubMethodEntered("screenSize");
+    return stubReturnValue<QSize>("screenSize");
+}
+
+bool StubDriver2Hwr::setScripts(const QStringList scripts)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QStringList>(scripts));
+    stubMethodEntered("setScripts", params);
+    return stubReturnValue<bool>("setScripts");
+}
+
+QStringList StubDriver2Hwr::scripts()
+{
+    stubMethodEntered("scripts");
+    return stubReturnValue<QStringList>("scripts");
+}
+
+QStringList StubDriver2Hwr::recognize()
+{
+    stubMethodEntered("recognize");
+    return stubReturnValue<QStringList>("recognize");
+}
+
+void StubDriver2Hwr::appendStroke(const QList<QPoint> stroke)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QList<QPoint> >(stroke));
+    stubMethodEntered("appendStroke", params);
+}
+
+void StubDriver2Hwr::clear()
+{
+    stubMethodEntered("clear");
+}
+
+void StubDriver2Hwr::train(const QString& string)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString>(string));
+    stubMethodEntered("train", params);
+}
+
+QString StubDriver2Hwr::driver()
+{
+    stubMethodEntered("driver");
+    qDebug() << "stub driver 2!";
+    return "stubdriver2_hwr";
+}
+
+
+QString StubDriver2Hwr::error()
+{
+    stubMethodEntered("error");
+    return QString();
+}
+
+Q_EXPORT_PLUGIN2(stubdriver2_hwr, StubDriver2Hwr);
--- unit_test/mydriverstub2_hwr/stubdriver2.h
+++ unit_test/mydriverstub2_hwr/stubdriver2.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef STUBDRIVER2HWR_H
+#define STUBDRIVER2HWR_H
+
+#include <stubbase.h>
+#include <mimenginetypes.h>
+#include <QVector>
+#include <QMap>
+#include <QObject>
+#include <mimenginehwrinterface.h>
+
+class MImEngineHwr;
+class QStringList;
+class QtPlugin;
+class QtDebug;
+class QLibrary;
+class QSettings;
+class QFile;
+
+/*!
+  \class StubDriver2Hwr
+
+  \brief StubDriver2Hwr inherit from MImEngineHwrInterface(Abstract driver class) and QObject,
+  it implement the input method engine, provide the functions: e.g. hanwriting recognition.
+
+ */
+class StubDriver2Hwr: public QObject, public MImEngineHwrInterface, public StubBase
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(StubDriver2Hwr)
+    Q_INTERFACES(MImEngineHwrInterface)
+
+
+public:
+    /*!
+     * StubDriver2Hwr construtor
+     *\param N/A
+     *\return StubDriver2Hwr
+     */
+    StubDriver2Hwr();
+
+    /*!
+     * StubDriver2Hwr destructor
+     *\param  N/A
+     *\return N/A
+     */
+    ~StubDriver2Hwr();
+
+    /*!
+     *\reimp
+    */     
+    virtual bool init();
+
+    virtual void setAreaSize(QSize size);
+
+    virtual QSize areaSize();
+
+    virtual void setScreenSize(QSize size);
+
+    virtual QSize screenSize();
+
+    virtual bool setScripts(const QStringList scripts);
+
+    virtual QStringList scripts();
+
+    virtual QStringList recognize();
+
+    virtual void appendStroke(const QList<QPoint> stroke);
+
+    virtual void clear();
+
+    virtual void train(const QString& string);
+
+    virtual QString driver();
+
+    virtual QString error();
+    /*!
+     *\reimp_end
+    */
+};
+#endif //StubDriver2Hwr_H
--- unit_test/mydriverstub2_words
+++ unit_test/mydriverstub2_words
+(directory)
--- unit_test/mydriverstub2_words/README
+++ unit_test/mydriverstub2_words/README
+stub driver for unit test
+step:
+$qmake
+$make
+$make install
--- unit_test/mydriverstub2_words/mydriverstub2_words.pro
+++ unit_test/mydriverstub2_words/mydriverstub2_words.pro
+
+TEMPLATE = lib
+LIBNAME = stubdriver2_words
+TARGET = ../lib/$${LIBNAME}
+DEFINES += ET9_ALPHABETIC_MODULE
+LIBS += -L../../src -lmeegoimengine
+
+INCLUDEPATH += ../../src ../../includes ../stubbase
+
+# stub
+HEADERS += ../stubbase/stubbase.h
+SOURCES += ../stubbase/stubbase.cpp
+
+# Input
+HEADERS += stubdriver2.h 
+SOURCES += stubdriver2.cpp   
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/words
+INSTALLS += target \
+
+QMAKE_CLEAN += ./lib/*
+
+QMAKE_EXTRA_TARGETS += check
+check.target = check
+check.command = $$system(true)
+check.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.target = check-xml
+check-xml.command = $$system(true)
+check-xml.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += memcheck 
+memcheck.target = memcheck
+memcheck.command = $$system(true)
+memcheck.depends = ../lib/lib$${LIBNAME}.so
--- unit_test/mydriverstub2_words/stubdriver2.cpp
+++ unit_test/mydriverstub2_words/stubdriver2.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "stubdriver2.h"
+#include <iostream>
+#include <string>
+#include <QObject>
+#include <mimenginefactory.h>
+#include <QStringList>
+#include <QtPlugin>
+#include <QtDebug>
+#include <QLibrary>
+#include <QSettings>
+#include <QFile>
+#include <QDataStream>
+
+
+StubDriver2::StubDriver2()
+{
+    m_noCandidates = 0;
+}
+
+StubDriver2::~StubDriver2()
+{
+}
+
+bool StubDriver2::init()
+{
+    return true;
+}
+
+bool StubDriver2::addDictionaryWord(const QString &w, MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(w));
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("addDictionaryWord", params);
+    Q_UNUSED(w);
+    return stubReturnValue<bool>("addDictionaryWord");
+}
+
+bool StubDriver2::removeDictionaryWord(const QString &w, MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(w));
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("removeDictionaryWord", params);
+    Q_UNUSED(w);
+    return stubReturnValue<bool>("removeDictionaryWord");
+}
+
+bool StubDriver2::disableDictionary(MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("disableDictionary", params);
+    return stubReturnValue<bool>("disableDictionary");
+}
+bool StubDriver2::enableDictionary(MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("enableDictionary", params);
+    return stubReturnValue<bool>("enableDictionary");
+}
+bool StubDriver2::removeDictionary(MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("removeDictionary", params);
+    return stubReturnValue<bool>("removeDictionary");
+}
+
+void StubDriver2::appendString(const QString &s)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    stubMethodEntered("appendString", params);
+    Q_UNUSED(s);
+}
+void StubDriver2::appendCharacter(const QChar &c)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QChar &>(c));
+    stubMethodEntered("appendCharacter", params);
+    Q_UNUSED(c);
+}
+
+void StubDriver2::tapKeyboard(const QPoint &position, bool shift, QChar symbol)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QPoint &>(position));
+    params.append(new Parameter<bool>(shift));
+    params.append(new Parameter<QChar>(symbol));
+    stubMethodEntered("tapKeyboard", params);
+    Q_UNUSED(position);
+    Q_UNUSED(shift);
+}
+
+void StubDriver2::reselectString(const QString &s)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    stubMethodEntered("reselectString", params);
+    Q_UNUSED(s);
+}
+
+void StubDriver2::setContext(const QString &s, int cursor)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    params.append(new Parameter<int>(cursor));
+    stubMethodEntered("setContext", params);
+    Q_UNUSED(s);
+}
+
+void StubDriver2::disablePrediction()
+{
+    stubMethodEntered("disablePrediction");
+}
+void StubDriver2::enablePrediction()
+{
+    stubMethodEntered("enablePrediction");
+}
+bool StubDriver2::predictionEnabled()
+{
+    stubMethodEntered("predictionEnabled");
+    return stubReturnValue<bool>("predictionEnabled");
+}
+
+void StubDriver2::disableCorrection()
+{
+    stubMethodEntered("disableCorrection");
+}
+void StubDriver2::enableCorrection()
+{
+    stubMethodEntered("enableCorrection");
+}
+bool StubDriver2::correctionEnabled()
+{
+    stubMethodEntered("correctionEnabled");
+    return stubReturnValue<bool>("correctionEnabled");
+}
+
+
+void StubDriver2::disableCompletion()
+{
+    stubMethodEntered("disableCompletion");
+}
+void StubDriver2::enableCompletion()
+{
+    stubMethodEntered("enableCompletion");
+}
+bool StubDriver2::completionEnabled()
+{
+    stubMethodEntered("completionEnabled");
+    return stubReturnValue<bool>("completionEnabled");
+}
+
+QStringList StubDriver2::candidates(unsigned int uStartIndex, unsigned int uNum)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<unsigned int &>(uStartIndex));
+    params.append(new Parameter<unsigned int &>(uNum));
+    stubMethodEntered("candidates", params);
+    return stubReturnValue<QStringList>("candidates");
+}
+
+int StubDriver2::totalCandidates()
+{
+    stubMethodEntered("totalCandidates");
+    return stubReturnValue<int>("totalCandidates");
+}
+
+int StubDriver2::matchedLength()
+{
+    stubMethodEntered("matchedLength");
+    return stubReturnValue<int>("matchedLength");
+}
+
+QStringList StubDriver2::matchedSyllables()
+{
+    stubMethodEntered("matchedSyllables");
+    return stubReturnValue<QStringList>("matchedSyllables");
+}
+
+int StubDriver2::suggestedCandidateIndex()
+{
+    stubMethodEntered("suggestedCandidateIndex");
+    return stubReturnValue<int>("suggestedCandidateIndex");
+}
+
+bool  StubDriver2::setSuggestedCandidateIndex(int index)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int &>(index));
+    stubMethodEntered("setSuggestedCandidateIndex", params);
+    return stubReturnValue<bool>("setSuggestedCandidateIndex");
+}
+
+void StubDriver2::setExactWordPositionInList(MImEngine::ExactInListType setting)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::ExactInListType &>(setting));
+    stubMethodEntered("setExactWordPositionInList", params);
+
+}
+
+MImEngine::DictionaryType StubDriver2::candidateSource(int index)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int &>(index));
+    stubMethodEntered("candidateSource", params);
+    return stubReturnValue<MImEngine::DictionaryType>("candidateSource");
+}
+
+void StubDriver2::clearEngineBuffer()
+{
+    stubMethodEntered("clearEngineBuffer");
+}
+
+void StubDriver2::saveAndClearEngineBuffer()
+{
+    stubMethodEntered("saveAndClearEngineBuffer");
+}
+
+QString  StubDriver2::language()
+{
+    stubMethodEntered("language");
+    return stubReturnValue<QString>("language");
+}
+bool StubDriver2::setLanguage(const QString  &lan , MImEngine::LanguagePriority p)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(lan));
+    params.append(new Parameter<MImEngine::LanguagePriority>(p));
+    stubMethodEntered("setLanguage", params);
+    return stubReturnValue<bool>("setLanguage");
+}
+
+bool StubDriver2::setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<QList<MImEngine::KeyboardLayoutKey> >(keys));
+    stubMethodEntered("setKeyboardLayoutKeys", params);
+    return stubReturnValue<bool>("setKeyboardLayoutKeys");
+}
+
+QList<MImEngine::KeyboardLayoutKey> StubDriver2::keyboardLayoutKeys()
+{
+    stubMethodEntered("keyboardLayoutKeys");
+    return stubReturnValue<QList<MImEngine::KeyboardLayoutKey> >("keyboardLayoutKeys");
+}
+
+bool StubDriver2::exportAsNokiaDictionary(const QString &fileName)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(fileName));
+    stubMethodEntered("exportAsNokiaDictionary", params);
+    return stubReturnValue<bool>("exportAsNokiaDictionary");
+}
+
+bool StubDriver2::importNokiaUserDictionary(const QString &fileName)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(fileName));
+    stubMethodEntered("importNokiaUserDictionary", params);
+    return stubReturnValue<bool>("importNokiaUserDictionary");
+}
+
+void StubDriver2::setMaximumErrors(int maxErrors)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int>(maxErrors));
+    stubMethodEntered("setMaximumErrors", params);
+}
+
+int StubDriver2::maximumErrors()
+{
+    stubMethodEntered("maximumErrors");
+    return stubReturnValue<int>("maximumErrors");
+}
+
+QString StubDriver2::driver()
+{
+    stubMethodEntered("driver");
+    qDebug() << "stub driver 2!";
+    return "stubdriver2_words";
+}
+void StubDriver2::setMaximumCandidates(int maxCandidates)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int>(maxCandidates));
+    stubMethodEntered("setMaximumCandidates", params);
+}
+
+int StubDriver2::maximumCandidates()
+{
+    stubMethodEntered("maximumCandidates");
+    return stubReturnValue<int>("maximumCandidates");
+}
+
+QString StubDriver2::error()
+{
+    stubMethodEntered("error");
+    return QString();
+}
+
+bool StubDriver2::setScript(const QString &s)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    stubMethodEntered("setScript");
+    return stubReturnValue<bool>("setScript");
+}
+
+QString StubDriver2::script()
+{
+    stubMethodEntered("script");
+    return stubReturnValue<QString>("script");
+}
+
+Q_EXPORT_PLUGIN2(stubdriver2_words, StubDriver2);--- unit_test/mydriverstub2_words/stubdriver2.h
+++ unit_test/mydriverstub2_words/stubdriver2.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef STUBDRIVER2_H
+#define STUBDRIVER2_H
+
+#include <stubbase.h>
+#include <mimenginetypes.h>
+#include <QVector>
+#include <QObject>
+#include <mimenginewordsinterface.h>
+
+class MImEngineWords;
+class QStringList;
+class QtPlugin;
+class QtDebug;
+class QLibrary;
+class QSettings;
+class QFile;
+
+/*!
+  \class StubDriver
+
+  \brief StubDriver inherit from MImEngineWordsInterface(Abstract driver class) and QObject,
+  it implement the input method engine, provide the functions: e.g. new error correction/prediction.
+
+ */
+class StubDriver2: public QObject, public MImEngineWordsInterface, public StubBase
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(StubDriver2)
+    Q_INTERFACES(MImEngineWordsInterface)
+
+
+public:
+    /*!
+     * StubDriver construtor
+     *\param N/A
+     *\return StubDriver
+     */
+    StubDriver2();
+
+    /*!
+     * StubDriver destructor
+     *\param  N/A
+     *\return N/A
+     */
+    ~StubDriver2();
+
+    /*!
+     *\reimp
+    */
+
+    virtual bool init();
+
+    virtual bool addDictionaryWord(const QString &word, MImEngine::DictionaryType);
+
+    virtual bool removeDictionaryWord(const QString &word, MImEngine::DictionaryType);
+
+    virtual bool disableDictionary(MImEngine::DictionaryType);
+
+    virtual bool enableDictionary(MImEngine::DictionaryType);
+
+    virtual bool removeDictionary(MImEngine::DictionaryType);
+
+    virtual void appendString(const QString &candidate);
+
+    virtual void appendCharacter(const QChar &candidate);
+
+    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol);
+
+    virtual void reselectString(const QString &s);
+
+    virtual void setContext(const QString &s, int cursor);
+
+    virtual void disablePrediction();
+
+    virtual void enablePrediction();
+
+    virtual bool predictionEnabled();
+
+    virtual void disableCorrection();
+
+    virtual void enableCorrection();
+
+    virtual bool correctionEnabled();
+
+    virtual void disableCompletion();
+
+    virtual void enableCompletion();
+
+    virtual bool completionEnabled();
+
+    virtual QStringList  candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0);
+
+    virtual int totalCandidates();
+
+    virtual int matchedLength();
+
+    virtual QStringList matchedSyllables();
+
+    virtual int suggestedCandidateIndex();
+
+    virtual bool setSuggestedCandidateIndex(int index);
+
+    virtual void setExactWordPositionInList(MImEngine::ExactInListType setting);
+
+    virtual MImEngine::DictionaryType candidateSource(int index);
+
+    virtual void clearEngineBuffer();
+
+    virtual void saveAndClearEngineBuffer();
+
+    virtual QString  language();
+
+    virtual bool setLanguage(const QString &language, MImEngine::LanguagePriority);
+
+    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys);
+
+    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys();
+
+    virtual bool exportAsNokiaDictionary(const QString &);
+
+    virtual bool importNokiaUserDictionary(const QString &);
+
+    virtual void setMaximumErrors(int);
+
+    virtual int maximumErrors();
+
+    virtual void setMaximumCandidates(int maxCandidates);
+
+    virtual int maximumCandidates();
+
+    virtual QString driver();
+
+    virtual QString error();
+
+    virtual bool setScript(const QString &s);
+
+    virtual QString script();
+
+    /*!
+     *\reimp_end
+    */
+
+private:
+    int m_noCandidates;
+};
+#endif //STUBDRIVER2_H
--- unit_test/mydriverstub_hwr
+++ unit_test/mydriverstub_hwr
+(directory)
--- unit_test/mydriverstub_hwr/README
+++ unit_test/mydriverstub_hwr/README
+stub driver for unit test
+step:
+$qmake
+$make
+$make install
--- unit_test/mydriverstub_hwr/mydriverstub_hwr.pro
+++ unit_test/mydriverstub_hwr/mydriverstub_hwr.pro
+
+TEMPLATE = lib
+LIBNAME = stubdriver1_hwr
+TARGET = ../lib/$${LIBNAME}
+DEFINES += 
+LIBS += -L../../src -lmeegoimengine
+
+INCLUDEPATH += ../../src ../../includes ../stubbase
+
+# stub
+HEADERS += ../stubbase/stubbase.h
+SOURCES += ../stubbase/stubbase.cpp
+
+# Input
+HEADERS += stubdriver.h 
+SOURCES += stubdriver.cpp   
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/hwr
+INSTALLS += target \
+
+QMAKE_CLEAN += ./lib/*
+
+QMAKE_EXTRA_TARGETS += check
+check.target = check
+check.command = $$system(true)
+check.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.target = check-xml
+check-xml.command = $$system(true)
+check-xml.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += memcheck 
+memcheck.target = memcheck
+memcheck.command = $$system(true)
+memcheck.depends = ../lib/lib$${LIBNAME}.so
--- unit_test/mydriverstub_hwr/stubdriver.cpp
+++ unit_test/mydriverstub_hwr/stubdriver.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "stubdriver.h"
+#include <iostream>
+#include <string>
+#include <QObject>
+#include <mimenginefactory.h>
+#include <QStringList>
+#include <QtPlugin>
+#include <QtDebug>
+#include <QLibrary>
+#include <QSettings>
+#include <QFile>
+#include <QDataStream>
+
+
+StubDriverHwr::StubDriverHwr()
+{   
+}
+
+StubDriverHwr::~StubDriverHwr()
+{
+}
+
+bool StubDriverHwr::init()
+{
+    return true;
+}
+
+void StubDriverHwr::setAreaSize(QSize size)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<QSize>(size));
+    stubMethodEntered("setAreaSize", params);
+}
+
+
+QSize StubDriverHwr::areaSize()
+{
+    stubMethodEntered("areaSize");
+    return stubReturnValue<QSize>("areaSize");
+}
+
+void StubDriverHwr::setScreenSize(QSize size)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<QSize>(size));
+    stubMethodEntered("setScreenSize", params);
+}
+
+QSize StubDriverHwr::screenSize()
+{
+    stubMethodEntered("screenSize");
+    return stubReturnValue<QSize>("screenSize");
+}
+
+bool StubDriverHwr::setScripts(const QStringList scripts)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QStringList>(scripts));
+    stubMethodEntered("setScripts", params);
+    return stubReturnValue<bool>("setScripts");
+}
+
+QStringList StubDriverHwr::scripts()
+{
+    stubMethodEntered("scripts");
+    return stubReturnValue<QStringList>("scripts");
+}
+
+QStringList StubDriverHwr::recognize()
+{
+    stubMethodEntered("recognize");
+    return stubReturnValue<QStringList>("recognize");
+}
+
+void StubDriverHwr::appendStroke(const QList<QPoint> stroke)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QList<QPoint> >(stroke));
+    stubMethodEntered("appendStroke", params);
+}
+
+void StubDriverHwr::clear()
+{
+    stubMethodEntered("clear");
+}
+
+void StubDriverHwr::train(const QString& string)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString&>(string));
+    stubMethodEntered("train", params);
+}
+
+QString StubDriverHwr::driver()
+{
+    stubMethodEntered("driver");
+    qDebug() << "stub driver 1!";
+    return "stubdriver1_hwr";
+}
+
+
+QString StubDriverHwr::error()
+{
+    stubMethodEntered("error");
+    return QString();
+}
+
+Q_EXPORT_PLUGIN2(stubdriver1_hwr, StubDriverHwr);
--- unit_test/mydriverstub_hwr/stubdriver.h
+++ unit_test/mydriverstub_hwr/stubdriver.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef STUBDRIVER_H
+#define STUBDRIVER_H
+
+#include <stubbase.h>
+#include <mimenginetypes.h>
+#include <QVector>
+#include <QMap>
+#include <QObject>
+#include <mimenginehwrinterface.h>
+
+class MImEngineHwr;
+class QStringList;
+class QtPlugin;
+class QtDebug;
+class QLibrary;
+class QSettings;
+class QFile;
+
+/*!
+  \class StubDriverHwr
+
+  \brief StubDriverHwr inherit from MImEngineHwrInterface(Abstract driver class) and QObject,
+  it implement the input method engine, provide the functions: e.g. hanwriting recognition.
+
+ */
+class StubDriverHwr: public QObject, public MImEngineHwrInterface, public StubBase
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(StubDriverHwr)
+    Q_INTERFACES(MImEngineHwrInterface)
+
+
+public:
+    /*!
+     * StubDriverHwr construtor
+     *\param N/A
+     *\return StubDriverHwr
+     */
+    StubDriverHwr();
+
+    /*!
+     * StubDriverHwr destructor
+     *\param  N/A
+     *\return N/A
+     */
+    ~StubDriverHwr();
+
+    /*!
+     *\reimp
+    */     
+    virtual bool init();
+
+    virtual void setAreaSize(QSize size);
+
+    virtual QSize areaSize();
+
+    virtual void setScreenSize(QSize size);
+
+    virtual QSize screenSize();
+
+    virtual bool setScripts(const QStringList scripts);
+
+    virtual QStringList scripts();
+
+    virtual QStringList recognize();
+
+    virtual void appendStroke(const QList<QPoint> stroke);
+
+    virtual void clear();
+
+    virtual void train(const QString& string);
+
+    virtual QString driver();
+
+    virtual QString error();
+    /*!
+     *\reimp_end
+    */
+};
+#endif //STUBDRIVER_H
--- unit_test/mydriverstub_words
+++ unit_test/mydriverstub_words
+(directory)
--- unit_test/mydriverstub_words/README
+++ unit_test/mydriverstub_words/README
(renamed from unit_test/mydriverstub/README)
--- unit_test/mydriverstub_words/mydriverstub_words.pro
+++ unit_test/mydriverstub_words/mydriverstub_words.pro
+
+TEMPLATE = lib
+LIBNAME = stubdriver1_words
+TARGET = ../lib/$${LIBNAME}
+DEFINES += ET9_ALPHABETIC_MODULE
+LIBS += -L../../src -lmeegoimengine
+
+INCLUDEPATH += ../../src ../../includes ../stubbase
+
+# stub
+HEADERS += ../stubbase/stubbase.h
+SOURCES += ../stubbase/stubbase.cpp
+
+# Input
+HEADERS += stubdriver.h 
+SOURCES += stubdriver.cpp   
+
+CONFIG += debug plugin
+QT = core
+
+target.path += /usr/lib/meego-imengines/drivers/words
+INSTALLS += target \
+
+QMAKE_CLEAN += ./lib/*
+
+QMAKE_EXTRA_TARGETS += check
+check.target = check
+check.command = $$system(true)
+check.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.target = check-xml
+check-xml.command = $$system(true)
+check-xml.depends = ../lib/lib$${LIBNAME}.so
+
+QMAKE_EXTRA_TARGETS += memcheck 
+memcheck.target = memcheck
+memcheck.command = $$system(true)
+memcheck.depends = ../lib/lib$${LIBNAME}.so
--- unit_test/mydriverstub_words/stubdriver.cpp
+++ unit_test/mydriverstub_words/stubdriver.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "stubdriver.h"
+#include <iostream>
+#include <string>
+#include <QObject>
+#include <mimenginefactory.h>
+#include <QStringList>
+#include <QtPlugin>
+#include <QtDebug>
+#include <QLibrary>
+#include <QSettings>
+#include <QFile>
+#include <QDataStream>
+
+
+StubDriver::StubDriver()
+{
+    m_noCandidates = 0;
+}
+
+StubDriver::~StubDriver()
+{
+}
+
+bool StubDriver::init()
+{
+    return true;
+}
+
+bool StubDriver::addDictionaryWord(const QString &w, MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(w));
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("addDictionaryWord", params);
+    Q_UNUSED(w);
+    return stubReturnValue<bool>("addDictionaryWord");
+}
+
+bool StubDriver::removeDictionaryWord(const QString &w, MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(w));
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("removeDictionaryWord", params);
+    Q_UNUSED(w);
+    return stubReturnValue<bool>("removeDictionaryWord");
+}
+
+bool StubDriver::disableDictionary(MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("disableDictionary", params);
+    return stubReturnValue<bool>("disableDictionary");
+}
+bool StubDriver::enableDictionary(MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("enableDictionary", params);
+    return stubReturnValue<bool>("enableDictionary");
+}
+bool StubDriver::removeDictionary(MImEngine::DictionaryType type)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::DictionaryType>(type));
+    stubMethodEntered("removeDictionary", params);
+    return stubReturnValue<bool>("removeDictionary");
+}
+
+void StubDriver::appendString(const QString &s)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    stubMethodEntered("appendString", params);
+    Q_UNUSED(s);
+}
+void StubDriver::appendCharacter(const QChar &c)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QChar &>(c));
+    stubMethodEntered("appendCharacter", params);
+    Q_UNUSED(c);
+}
+
+void StubDriver::tapKeyboard(const QPoint &position, bool shift, QChar symbol)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QPoint &>(position));
+    params.append(new Parameter<bool>(shift));
+    params.append(new Parameter<QChar>(symbol));
+    stubMethodEntered("tapKeyboard", params);
+    Q_UNUSED(position);
+    Q_UNUSED(shift);
+}
+
+void StubDriver::reselectString(const QString &s)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    stubMethodEntered("reselectString", params);
+    Q_UNUSED(s);
+}
+
+void StubDriver::setContext(const QString &s, int cursor)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    params.append(new Parameter<int>(cursor));
+    stubMethodEntered("setContext", params);
+    Q_UNUSED(s);
+}
+
+void StubDriver::disablePrediction()
+{
+    stubMethodEntered("disablePrediction");
+}
+void StubDriver::enablePrediction()
+{
+    stubMethodEntered("enablePrediction");
+}
+bool StubDriver::predictionEnabled()
+{
+    stubMethodEntered("predictionEnabled");
+    return stubReturnValue<bool>("predictionEnabled");
+}
+
+void StubDriver::disableCorrection()
+{
+    stubMethodEntered("disableCorrection");
+}
+void StubDriver::enableCorrection()
+{
+    stubMethodEntered("enableCorrection");
+}
+bool StubDriver::correctionEnabled()
+{
+    stubMethodEntered("correctionEnabled");
+    return stubReturnValue<bool>("correctionEnabled");
+}
+
+
+void StubDriver::disableCompletion()
+{
+    stubMethodEntered("disableCompletion");
+}
+void StubDriver::enableCompletion()
+{
+    stubMethodEntered("enableCompletion");
+}
+bool StubDriver::completionEnabled()
+{
+    stubMethodEntered("completionEnabled");
+    return stubReturnValue<bool>("completionEnabled");
+}
+
+QStringList StubDriver::candidates(unsigned int uStartIndex, unsigned int uNum)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<unsigned int &>(uStartIndex));
+    params.append(new Parameter<unsigned int &>(uNum));
+    stubMethodEntered("candidates", params);
+    return stubReturnValue<QStringList>("candidates");
+}
+
+int StubDriver::totalCandidates()
+{
+    stubMethodEntered("totalCandidates");
+    return stubReturnValue<int>("totalCandidates");
+}
+
+int StubDriver::matchedLength()
+{
+    stubMethodEntered("matchedLength");
+    return stubReturnValue<int>("matchedLength");
+}
+
+QStringList StubDriver::matchedSyllables()
+{
+    stubMethodEntered("matchedSyllables");
+    return stubReturnValue<QStringList>("matchedSyllables");
+}
+
+int StubDriver::suggestedCandidateIndex()
+{
+    stubMethodEntered("suggestedCandidateIndex");
+    return stubReturnValue<int>("suggestedCandidateIndex");
+}
+
+bool StubDriver::setSuggestedCandidateIndex(int index)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int &>(index));
+    stubMethodEntered("setSuggestedCandidateIndex", params);
+    return stubReturnValue<bool>("setSuggestedCandidateIndex");
+}
+
+void StubDriver::setExactWordPositionInList(MImEngine::ExactInListType setting)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<MImEngine::ExactInListType &>(setting));
+    stubMethodEntered("setExactWordPositionInList", params);
+
+}
+
+MImEngine::DictionaryType StubDriver::candidateSource(int index)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int &>(index));
+    stubMethodEntered("candidateSource", params);
+    return stubReturnValue<MImEngine::DictionaryType>("candidateSource");
+}
+
+void StubDriver::clearEngineBuffer()
+{
+    stubMethodEntered("clearEngineBuffer");
+}
+
+void StubDriver::saveAndClearEngineBuffer()
+{
+    stubMethodEntered("saveAndClearEngineBuffer");
+}
+
+QString StubDriver::language()
+{
+    stubMethodEntered("language");
+    return stubReturnValue<QString>("language");
+}
+
+bool StubDriver::setLanguage(const QString  &lan , MImEngine::LanguagePriority p)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(lan));
+    params.append(new Parameter<MImEngine::LanguagePriority>(p));
+    stubMethodEntered("setLanguage", params);
+    return stubReturnValue<bool>("setLanguage");
+}
+
+bool StubDriver::setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<QList<MImEngine::KeyboardLayoutKey> >(keys));
+    stubMethodEntered("setKeyboardLayoutKeys", params);
+    return stubReturnValue<bool>("setKeyboardLayoutKeys");
+}
+
+QList<MImEngine::KeyboardLayoutKey> StubDriver::keyboardLayoutKeys()
+{
+    stubMethodEntered("keyboardLayoutKeys");
+    return stubReturnValue<QList<MImEngine::KeyboardLayoutKey> >("keyboardLayoutKeys");
+}
+
+bool StubDriver::exportAsNokiaDictionary(const QString &fileName)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(fileName));
+    stubMethodEntered("exportAsNokiaDictionary", params);
+    return stubReturnValue<bool>("exportAsNokiaDictionary");
+}
+
+bool StubDriver::importNokiaUserDictionary(const QString &fileName)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(fileName));
+    stubMethodEntered("importNokiaUserDictionary", params);
+    return stubReturnValue<bool>("importNokiaUserDictionary");
+}
+
+void StubDriver::setMaximumErrors(int maxErrors)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int>(maxErrors));
+    stubMethodEntered("setMaximumErrors", params);
+}
+
+int StubDriver::maximumErrors()
+{
+    stubMethodEntered("maximumErrors");
+    return stubReturnValue<int>("maximumErrors");
+}
+
+QString StubDriver::driver()
+{
+    stubMethodEntered("driver");
+    qDebug() << "stub driver 1!";
+    return "stubdriver1_words";
+}
+
+void StubDriver::setMaximumCandidates(int maxCandidates)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int>(maxCandidates));
+    stubMethodEntered("setMaximumCandidates", params);
+}
+
+int StubDriver::maximumCandidates()
+{
+    stubMethodEntered("maximumCandidates");
+    return stubReturnValue<int>("maximumCandidates");
+}
+
+QString StubDriver::error()
+{
+    stubMethodEntered("error");
+    return QString();
+}
+
+bool StubDriver::setScript(const QString &s)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(s));
+    stubMethodEntered("setScript");
+    return stubReturnValue<bool>("setScript");
+}
+
+QString StubDriver::script()
+{
+    stubMethodEntered("script");
+    return stubReturnValue<QString>("script");
+}
+
+Q_EXPORT_PLUGIN2(stubdriver1_words, StubDriver);
--- unit_test/mydriverstub_words/stubdriver.h
+++ unit_test/mydriverstub_words/stubdriver.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef STUBDRIVER_H
+#define STUBDRIVER_H
+
+#include <stubbase.h>
+#include <mimenginetypes.h>
+#include <QVector>
+#include <QObject>
+#include <mimenginewordsinterface.h>
+
+class MImEngineWords;
+class QStringList;
+class QtPlugin;
+class QtDebug;
+class QLibrary;
+class QSettings;
+class QFile;
+
+/*!
+  \class StubDriver
+
+  \brief StubDriver inherit from MImEngineWordsInterface(Abstract driver class) and QObject,
+  it implement the input method engine, provide the functions: e.g. new error correction/prediction.
+
+ */
+class StubDriver: public QObject, public MImEngineWordsInterface, public StubBase
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(StubDriver)
+    Q_INTERFACES(MImEngineWordsInterface)
+
+
+public:
+    /*!
+     * StubDriver construtor
+     *\param N/A
+     *\return StubDriver
+     */
+    StubDriver();
+
+    /*!
+     * StubDriver destructor
+     *\param  N/A
+     *\return N/A
+     */
+    ~StubDriver();
+
+    /*!
+     *\reimp
+    */
+
+    virtual bool init();
+
+    virtual bool addDictionaryWord(const QString &word, MImEngine::DictionaryType);
+
+    virtual bool removeDictionaryWord(const QString &word, MImEngine::DictionaryType);
+
+    virtual bool disableDictionary(MImEngine::DictionaryType);
+
+    virtual bool enableDictionary(MImEngine::DictionaryType);
+
+    virtual bool removeDictionary(MImEngine::DictionaryType);
+
+    virtual void appendString(const QString &candidate);
+
+    virtual void appendCharacter(const QChar &candidate);
+
+    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol);
+
+    virtual void reselectString(const QString &s);
+
+    virtual void setContext(const QString &s, int cursor);
+
+    virtual void disablePrediction();
+
+    virtual void enablePrediction();
+
+    virtual bool predictionEnabled();
+
+    virtual void disableCorrection();
+
+    virtual void enableCorrection();
+
+    virtual bool correctionEnabled();
+
+    virtual void disableCompletion();
+
+    virtual void enableCompletion();
+
+    virtual bool completionEnabled();
+
+    virtual QStringList candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0);
+
+    virtual int totalCandidates();
+
+    virtual int matchedLength();
+
+    virtual QStringList matchedSyllables();
+
+    virtual int suggestedCandidateIndex();
+
+    virtual bool setSuggestedCandidateIndex(int index);
+
+    virtual void setExactWordPositionInList(MImEngine::ExactInListType setting);
+
+    virtual MImEngine::DictionaryType candidateSource(int index);
+
+    virtual void clearEngineBuffer();
+
+    virtual void saveAndClearEngineBuffer();
+
+    virtual QString  language();
+
+    virtual bool setLanguage(const QString &language, MImEngine::LanguagePriority);
+
+    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys);
+
+    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys();
+
+    virtual bool exportAsNokiaDictionary(const QString &);
+
+    virtual bool importNokiaUserDictionary(const QString &);
+
+    virtual void setMaximumErrors(int);
+
+    virtual int maximumErrors();
+
+    virtual void setMaximumCandidates(int maxCandidates);
+
+    virtual int maximumCandidates();
+
+    virtual QString driver();
+
+    virtual QString error();
+
+    virtual bool setScript(const QString &s);
+
+    virtual QString script();
+
+    /*!
+     *\reimp_end
+    */
+
+private:
+    int m_noCandidates;
+};
+#endif //STUBDRIVER_H
--- unit_test/rt.sh
+++ unit_test/rt.sh
@@ -43,7 +43,7 @@
 if [ ! -f ./$BASENAME ]; then
     EXIT_CODE=255
 else
-    MYSTUBDRIVER_PATH=../lib/ LD_LIBRARY_PATH="../../words:../lib" ./$BASENAME -xml -o ./$BASENAME.log
+    MYSTUBDRIVER_PATH=../lib/ LD_LIBRARY_PATH="../../src:../lib" ./$BASENAME -xml -o ./$BASENAME.log
     xsltproc --nonet ../qtestlib2junitxml.xsl $QTESTLOG > $JUNITLOG
     EXIT_CODE=$?
 fi
--- unit_test/runtests.sh
+++ unit_test/runtests.sh
@@ -63,8 +63,9 @@
 	*)
 		# tests are run automated on TATAM infrastructure
 		TMPDIR=/tmp/libmeegoimengine-tests
-		TESTBASE=/usr/share/libmeegoimengine-tests/
-		export LD_LIBRARY_PATH=/usr/lib/meego-imengines/drivers/
+		TESTBASE=/usr/lib/libmeegoimengine-tests/
+		export LD_LIBRARY_PATH=/usr/lib/meego-imengines/drivers/words:/usr/lib/meego-imengines/drivers/hwr
+ 
 		rm -fr $TMPDIR && mkdir -p $TMPDIR
 		OUTSTYLE="xml"
 	;;
--- unit_test/stubbase/stubbase.h
+++ unit_test/stubbase/stubbase.h
@@ -22,6 +22,8 @@
 #include <QMap>
 #include <QtDebug>
 
+#include <QDebug>
+
 class ParameterBase
 {
 public:
@@ -145,9 +147,14 @@
 
 template <typename T>
 void StubBase::stubSetReturnValue(QString methodName, T value) const
-{
+{    
     Parameter<T>* param = new Parameter<T>(value);
     _stubReturnValues[methodName] = param;
+
+    if (methodName == "screenSize") {
+        qDebug() << "value =" << (*(QSize*)(&value))
+                << " _stubReturnValues[methodName]  = " <<  _stubReturnValues[methodName];
+    }
 }
 
 template <typename T>
@@ -160,7 +167,7 @@
     ParameterBase *base = _stubReturnValues[methodName];
     Parameter<T>* param = dynamic_cast<Parameter<T>*>(base);
     if (!param) {
-        qDebug() << "StubBase::" << __func__ << ": failed dynamic_cast, check that return value type matches the method; check also that you have used stubSetReturnValue(" << methodName << ")";
+        qDebug() << "StubBase"<< base << __func__ << ": failed dynamic_cast, check that return value type matches the method; check also that you have used stubSetReturnValue(" << methodName << ")";
     }
     return param->data;
 
--- unit_test/unit_test.pro
+++ unit_test/unit_test.pro
@@ -1,9 +1,11 @@
 CONFIG += ordered
 TEMPLATE = subdirs
-SUBDIRS = mydriverstub mydriverstub2 ut_meegoimengine
+SUBDIRS = mydriverstub_words mydriverstub2_words mydriverstub_hwr mydriverstub2_hwr \
+	ut_meegoimengine_hwr ut_meegoimengine_words
 
+target.commands += $$system(touch tests.xml)
 target.path = /usr/share/libmeegoimengine-tests/
-target.files = runtests.sh qtestlib2junitxml.xsl
+target.files = runtests.sh qtestlib2junitxml.xsl gen-tests-xml.sh tests.xml
 INSTALLS += target
 
 QMAKE_EXTRA_TARGETS += check-xml
@@ -19,4 +21,4 @@
 memcheck.CONFIG = recursive
 
 QMAKE_CLEAN += *.xml *~
-
+QMAKE_DISTCLEAN += $$QMAKE_CLEAN
--- unit_test/ut_meegoimengine
+++ unit_test/ut_meegoimengine
-(directory)
--- unit_test/ut_meegoimengine/README
+++ unit_test/ut_meegoimengine/README
(renamed to unit_test/ut_meegoimengine_words/README)
--- unit_test/ut_meegoimengine/env.sh
+++ unit_test/ut_meegoimengine/env.sh
(renamed to unit_test/ut_meegoimengine_words/env.sh)
--- unit_test/ut_meegoimengine/ut_meegoimengine.pro
+++ unit_test/ut_meegoimengine/ut_meegoimengine.pro
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Nov 19 09:19:04 2008
-######################################################################
-TARGET = ut_meegoimengine 
-DEFINES += ET9_ALPHABETIC_MODULE
-LIBS += -lmeegoimenginewords 
-LIBS += -L../lib -L../../words
-LIBS += -L/usr/lib/meego-imengines/drivers/ -Wl,-rpath-link=/usr/lib/meego-imengines/drivers/ -lstubdriver1
-
-INCLUDEPATH += ../mydriverstub ../../words ../../includes ../stubbase
-
-# Input
-HEADERS += ut_mimengine.h \
-
-SOURCES += ut_mimengine.cpp \
-
-CONFIG += debug
-QT = core testlib
-
-include(../common_check.pri)
-
--- unit_test/ut_meegoimengine/ut_mimengine.cpp
+++ unit_test/ut_meegoimengine/ut_mimengine.cpp
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "ut_mimengine.h"
-
-#include "stubdriver.h"
-
-#include <QStringList>
-#include <QtDebug>
-#include <QFile>
-#include <QProcess>
-#include <QRegExp>
-
-
-namespace
-{
-    const QString defaultDriverDir = "/usr/lib/meego-imengines/drivers";
-}
-
-StubDriver *gInterface = NULL;
-namespace
-{
-    const QString MyStubDriverPathKey = "MYSTUBDRIVER_PATH";
-}
-
-void Ut_MImEngineWordsInterfaceFactory::initTestCase()
-{
-    QStringList envs = QProcess::systemEnvironment();
-    QString exp = QString("^%1=.*").arg(MyStubDriverPathKey);
-    int index = envs.indexOf(QRegExp(exp, Qt::CaseInsensitive));
-    QString stubDriverPath = 0;
-    if (index != -1) {
-        stubDriverPath = envs.at(index);
-        exp = QString("^%1=").arg(MyStubDriverPathKey);
-        stubDriverPath = stubDriverPath.remove(QRegExp(exp,Qt::CaseInsensitive));
-        if (!stubDriverPath.isEmpty()) {
-            qDebug() << "manual set driver path:" << stubDriverPath;
-        }
-    }
-
-    m_subject = MImEngineWordsInterfaceFactory::instance();
-    if (m_subject) {
-        QStringList driverList = m_subject->drivers();
-        QVERIFY(driverList.count() > 0);
-        QVERIFY(driverList.indexOf("stubdriver1") != -1);
-        gInterface = (StubDriver *)m_subject->createEngine("stubdriver1");
-        QVERIFY(gInterface != NULL);
-        gInterface->setKeyboardLayout("EN");
-        gInterface->enableDictionary(MImEngine::DictionaryTypeLanguage);
-    }
-}
-
-
-void Ut_MImEngineWordsInterfaceFactory::cleanupTestCase()
-{
-
-}
-
-void Ut_MImEngineWordsInterfaceFactory::init()
-{
-    QStringList driverList = m_subject->drivers();
-    QVERIFY(driverList.indexOf("stubdriver1") != -1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::cleanup()
-{
-}
-
-void Ut_MImEngineWordsInterfaceFactory::setLanguage()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("setLanguage", false);
-    QCOMPARE(gInterface->setLanguage("TEST", MImEngine::LanguagePriorityPrimary), false);
-    QVERIFY(gInterface->stubCallCount("setLanguage") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("setLanguage", true);
-    QCOMPARE(gInterface->setLanguage("EN", MImEngine::LanguagePriorityPrimary), true);
-    QVERIFY(gInterface->stubCallCount("setLanguage") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::setKeyboardLayoutKeys()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("setKeyboardLayoutKeys", true);
-    QCOMPARE(gInterface->setKeyboardLayoutKeys(QList<MImEngine::KeyboardLayoutKey>()), true);
-    QVERIFY(gInterface->stubCallCount("setKeyboardLayoutKeys") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("setKeyboardLayoutKeys", false);
-    QCOMPARE(gInterface->setKeyboardLayoutKeys(QList<MImEngine::KeyboardLayoutKey>()), false);
-    QVERIFY(gInterface->stubCallCount("setKeyboardLayoutKeys") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::disableDictionary()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("disableDictionary", true);
-    QCOMPARE(gInterface->disableDictionary(MImEngine::DictionaryTypeLanguage), true);
-    QVERIFY(gInterface->stubCallCount("disableDictionary") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("disableDictionary", false);
-    QCOMPARE(gInterface->disableDictionary(MImEngine::DictionaryTypeLanguage), false);
-    QVERIFY(gInterface->stubCallCount("disableDictionary") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::enableDictionary()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("enableDictionary", true);
-    QCOMPARE(gInterface->enableDictionary(MImEngine::DictionaryTypeLanguage), true);
-    QVERIFY(gInterface->stubCallCount("enableDictionary") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("enableDictionary", false);
-    QCOMPARE(gInterface->enableDictionary(MImEngine::DictionaryTypeLanguage), false);
-    QVERIFY(gInterface->stubCallCount("enableDictionary") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::disablePrediction()
-{
-    gInterface->stubReset();
-    gInterface->disablePrediction();
-    QVERIFY(gInterface->stubCallCount("disablePrediction") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::enablePrediction()
-{
-    gInterface->stubReset();
-    gInterface->enablePrediction();
-    QVERIFY(gInterface->stubCallCount("enablePrediction") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::disableCompletion()
-{
-    gInterface->stubReset();
-    gInterface->disableCompletion();
-    QVERIFY(gInterface->stubCallCount("disableCompletion") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::enableCompletion()
-{
-    gInterface->stubReset();
-    gInterface->enableCompletion();
-    QVERIFY(gInterface->stubCallCount("enableCompletion") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::disableCorrection()
-{
-    gInterface->stubReset();
-    gInterface->disableCorrection();
-    QVERIFY(gInterface->stubCallCount("disableCorrection") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::enableCorrection()
-{
-    gInterface->stubReset();
-    gInterface->enableCorrection();
-    QVERIFY(gInterface->stubCallCount("enableCorrection") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::appendString()
-{
-    gInterface->stubReset();
-    gInterface->appendString("aak");
-    QVERIFY(gInterface->stubCallCount("appendString") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::appendCharacter()
-{
-    gInterface->stubReset();
-    QString teststr = "aak";
-    for (int i = 0; i < teststr.count(); i++)
-        gInterface->appendCharacter(teststr.at(i));
-    QVERIFY(gInterface->stubCallCount("appendCharacter") == teststr.count());
-}
-
-void Ut_MImEngineWordsInterfaceFactory::tapKeyboard()
-{
-    gInterface->stubReset();
-    gInterface->tapKeyboard(QPoint(), false, QChar());
-    QVERIFY(gInterface->stubCallCount("tapKeyboard") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::reselectString()
-{
-    gInterface->stubReset();
-    gInterface->reselectString("aak");
-    QVERIFY(gInterface->stubCallCount("reselectString") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::setContext()
-{
-    gInterface->stubReset();
-    gInterface->setContext("aak", 0);
-    QVERIFY(gInterface->stubCallCount("setContext") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::addDictionaryWord()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("addDictionaryWord", true);
-    QCOMPARE(gInterface->addDictionaryWord("test", MImEngine::DictionaryTypeLanguage), true);
-    QVERIFY(gInterface->stubCallCount("addDictionaryWord") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("addDictionaryWord", false);
-    QCOMPARE(gInterface->addDictionaryWord("test", MImEngine::DictionaryTypeLanguage), false);
-    QVERIFY(gInterface->stubCallCount("addDictionaryWord") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::removeDictionaryWord()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("removeDictionaryWord", false);
-    QCOMPARE(gInterface->removeDictionaryWord("test", MImEngine::DictionaryTypeLanguage), false);
-    QVERIFY(gInterface->stubCallCount("removeDictionaryWord") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("removeDictionaryWord", true);
-    QCOMPARE(gInterface->removeDictionaryWord("test", MImEngine::DictionaryTypeLanguage), true);
-    QVERIFY(gInterface->stubCallCount("removeDictionaryWord") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::removeDictionary()
-{
-    gInterface->stubReset();
-    gInterface->removeDictionary(MImEngine::DictionaryTypeLanguage);
-    QVERIFY(gInterface->stubCallCount("removeDictionary") == 1);
-}
-
-
-void Ut_MImEngineWordsInterfaceFactory::predictionEnabled()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("predictionEnabled", true);
-    QCOMPARE(gInterface->predictionEnabled(), true);
-    QVERIFY(gInterface->stubCallCount("predictionEnabled") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("predictionEnabled", false);
-    QCOMPARE(gInterface->predictionEnabled(), false);
-    QVERIFY(gInterface->stubCallCount("predictionEnabled") == 1);
-}
-void Ut_MImEngineWordsInterfaceFactory::correctionEnabled()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("correctionEnabled", true);
-    QCOMPARE(gInterface->correctionEnabled(), true);
-    QVERIFY(gInterface->stubCallCount("correctionEnabled") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("correctionEnabled", false);
-    QCOMPARE(gInterface->correctionEnabled(), false);
-    QVERIFY(gInterface->stubCallCount("correctionEnabled") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::completionEnabled()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("completionEnabled", true);
-    QCOMPARE(gInterface->completionEnabled(), true);
-    QVERIFY(gInterface->stubCallCount("completionEnabled") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("completionEnabled", false);
-    QCOMPARE(gInterface->completionEnabled(), false);
-    QVERIFY(gInterface->stubCallCount("completionEnabled") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::language()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<QString>("language", QString("EN"));
-    QVERIFY(gInterface->language() == "EN");
-    QVERIFY(gInterface->stubCallCount("language") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::keyboardLayoutKeys()
-{
-    const QRect rect(1, 1, 2, 2);
-    const QChar symbol('a');
-    const MImEngine::KeyboardLayoutKeyType type = MImEngine::KeyboardLayoutKeyRegional;
-
-    MImEngine::KeyboardLayoutKey key;
-    key.rect = rect;
-    key.type = type;
-    key.symbols.append(symbol);
-    QList<MImEngine::KeyboardLayoutKey> keys;
-    keys.append(key);
-
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<QList<MImEngine::KeyboardLayoutKey> >("keyboardLayoutKeys", keys);
-    QList<MImEngine::KeyboardLayoutKey> keys2 = gInterface->keyboardLayoutKeys();
-    QVERIFY(keys2.size() == 1);
-    QVERIFY(keys2[0].rect == rect);
-    QVERIFY(keys2[0].type == type);
-    QVERIFY(keys2[0].symbols.size() == 1);
-    QVERIFY(keys2[0].symbols[0] == symbol);
-    QVERIFY(gInterface->stubCallCount("keyboardLayoutKeys") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::exportAsNokiaDictionary()
-{
-    QString fileName = "test.xml";
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("exportAsNokiaDictionary", true);
-    QCOMPARE(gInterface->exportAsNokiaDictionary(fileName), true);
-    QVERIFY(gInterface->stubCallCount("exportAsNokiaDictionary") == 1);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("exportAsNokiaDictionary", false);
-    QCOMPARE(gInterface->exportAsNokiaDictionary(fileName), false);
-    QVERIFY(gInterface->stubCallCount("exportAsNokiaDictionary") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::importNokiaUserDictionary()
-{
-    QString fileName = "test.xml";
-    if (QFile::exists(fileName))
-        QFile::remove(fileName);
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("importNokiaUserDictionary", true);
-    QCOMPARE(gInterface->importNokiaUserDictionary(fileName), true);
-    QCOMPARE(gInterface->error().isEmpty(), true);
-    gInterface->stubReset();
-    QFile testFile(fileName);
-    testFile.open(QIODevice::WriteOnly);
-    testFile.close();
-    QCOMPARE(gInterface->importNokiaUserDictionary(fileName), false);
-    QVERIFY(gInterface->stubCallCount("importNokiaUserDictionary") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::setMaximumErrors()
-{
-    gInterface->stubReset();
-    gInterface->setMaximumErrors(5);
-    QVERIFY(gInterface->stubCallCount("setMaximumErrors") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::maximumErrors()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<int>("maximumErrors", 5);
-    QVERIFY(gInterface->maximumErrors() == 5);
-    QVERIFY(gInterface->stubCallCount("maximumErrors") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::setMaximumCandidates()
-{
-    gInterface->stubReset();
-    gInterface->setMaximumCandidates(8);
-    QVERIFY(gInterface->stubCallCount("setMaximumCandidates") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::maximumCandidates()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<int>("maximumCandidates", 8);
-    QVERIFY(gInterface->maximumCandidates() == 8);
-    QVERIFY(gInterface->stubCallCount("maximumCandidates") == 1);
-}
-void Ut_MImEngineWordsInterfaceFactory::setSuggestedCandidateIndex()
-{
-    int index = 2;
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<bool>("setSuggestedCandidateIndex", true);
-    QCOMPARE(gInterface->setSuggestedCandidateIndex(index), true);
-    QVERIFY(gInterface->stubCallCount("setSuggestedCandidateIndex") == 1);
-}
-void Ut_MImEngineWordsInterfaceFactory::suggestedCandidateIndex()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<int>("suggestedCandidateIndex", 2);
-    QVERIFY(gInterface->suggestedCandidateIndex() == 2);
-    QVERIFY(gInterface->stubCallCount("suggestedCandidateIndex") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::clearEngineBuffer()
-{
-    gInterface->stubReset();
-    gInterface->clearEngineBuffer();
-    QVERIFY(gInterface->stubCallCount("clearEngineBuffer") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::saveAndClearEngineBuffer()
-{
-    gInterface->stubReset();
-    gInterface->saveAndClearEngineBuffer();
-    QVERIFY(gInterface->stubCallCount("saveAndClearEngineBuffer") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::drivers()
-{
-    qDebug() << m_subject->drivers().count();
-    QVERIFY(m_subject->drivers().count() >= 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::checkExactWordposition()
-{
-    gInterface->setExactWordPositionInList(MImEngine::ExactInListOff);
-    QVERIFY(gInterface->stubCallCount("setExactWordPositionInList") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::checkErrorCorrectionCandidates()
-{
-    //this can only be checked with a 'real' engine
-    QStringList list;
-    list << "candidates";
-    gInterface->stubSetReturnValue<QStringList>("candidates", list);
-    QVERIFY(gInterface->candidates() == list);
-    QVERIFY(gInterface->stubCallCount("candidates") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::checkMultipleDriverLoad()
-{
-    QString driver1, driver2;
-
-    driver1 = "stubdriver1";
-    driver2 = "stubdriver2";
-
-    QStringList driverList = m_subject->drivers();
-    //check that driver exists
-    QVERIFY(driverList.indexOf(driver1) != -1);
-    QVERIFY(driverList.indexOf(driver2) != -1);
-    QVERIFY(gInterface->driver() == driver1);
-    QVERIFY(driverList.count() >= 2);
-
-    // set second driver
-    gInterface = (StubDriver *)m_subject->createEngine(driver2);
-    QVERIFY(gInterface->driver() == driver2);
-
-    //check that all driver exists
-    QVERIFY(driverList.indexOf(driver1) != -1);
-    QVERIFY(driverList.indexOf(driver2) != -1);
-
-    gInterface = (StubDriver *)m_subject->createEngine(driver1);
-    QVERIFY(gInterface->driver() == driver1);
-    QVERIFY(driverList.indexOf(driver1) != -1);
-    QVERIFY(driverList.indexOf(driver2) != -1);
-
-    driverList = m_subject->drivers();
-    QVERIFY(driverList.count() >= 2);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::matchedLength()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<int>("matchedLength", 2);
-    QVERIFY(gInterface->matchedLength() == 2);
-    QVERIFY(gInterface->stubCallCount("matchedLength") == 1);
-}
-
-void Ut_MImEngineWordsInterfaceFactory::totalCandidates()
-{
-    gInterface->stubReset();
-    gInterface->stubSetReturnValue<int>("totalCandidates", 5);
-    QVERIFY(gInterface->totalCandidates() == 5);
-    QVERIFY(gInterface->stubCallCount("totalCandidates") == 1);
-}
-
-QTEST_MAIN(Ut_MImEngineWordsInterfaceFactory)
--- unit_test/ut_meegoimengine/ut_mimengine.h
+++ unit_test/ut_meegoimengine/ut_mimengine.h
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#ifndef UT_MIMENGINE
-#define UT_MIMENGINE
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-#include "mimenginewordsinterfacefactory.h"
-Q_DECLARE_METATYPE(MImEngineWordsInterfaceFactory *);
-class Ut_MImEngineWordsInterfaceFactory : public QObject
-{
-    Q_OBJECT
-
-private slots:
-    void initTestCase();
-    void cleanupTestCase();
-
-    void init();
-    void cleanup();
-
-    void setLanguage();
-
-    void setKeyboardLayoutKeys();
-
-    void enableDictionary();
-    void disableDictionary();
-
-    void enablePrediction();
-    void disablePrediction();
-
-    void enableCorrection();
-    void disableCorrection();
-
-    void enableCompletion();
-    void disableCompletion();
-
-    void appendString();
-    void appendCharacter();
-    void tapKeyboard();
-    void reselectString();
-    void setContext();
-
-    void addDictionaryWord();
-    void removeDictionaryWord();
-
-    void removeDictionary();
-
-    void predictionEnabled();
-    void correctionEnabled();
-    void completionEnabled();
-
-    void language();
-
-    void keyboardLayoutKeys();
-
-    void exportAsNokiaDictionary();
-    void importNokiaUserDictionary();
-
-    void setMaximumErrors();
-    void maximumErrors();
-
-    void setMaximumCandidates();
-    void maximumCandidates();
-
-    void suggestedCandidateIndex();
-    void setSuggestedCandidateIndex();
-
-    void clearEngineBuffer();
-    void saveAndClearEngineBuffer();
-
-    void totalCandidates();
-
-    void matchedLength();
-
-    void drivers();
-
-    //! can only be tested with a real engine
-    void checkExactWordposition();
-
-    //! test candidates can't be checked with stub (needs to be checked in engine)
-    void checkErrorCorrectionCandidates();
-
-    //! Test checks if multiple drivers can be loaded and changed on runtime
-    void checkMultipleDriverLoad();
-private:
-    MImEngineWordsInterfaceFactory *m_subject;
-};
-
-#endif //MYTEST_H
--- unit_test/ut_meegoimengine_hwr
+++ unit_test/ut_meegoimengine_hwr
+(directory)
--- unit_test/ut_meegoimengine_hwr/README
+++ unit_test/ut_meegoimengine_hwr/README
+unit test for meegoimengine
+
+usage: please run env configuration before test
+step:
+$cd ../../words/
+$qmake
+$cd ..
+$make install
+
+$cd ../unit_test/mydriverstub
+$qmake
+$make install
+
+$cd ../ut_meegoimengine
+$qmake
+$make
+$source env.sh
--- unit_test/ut_meegoimengine_hwr/env.sh
+++ unit_test/ut_meegoimengine_hwr/env.sh
+# !/bin/bash
+cd .. 
+stubdirverpath=$PWD/mydriverstub/lib
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$stubdirverpath
+cd ..
+meegoimenginepath=$PWD/hwr
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$meegoimenginepath
+echo $LD_LIBRARY_PATH
+cd unit_test_hwr 
+cd ut_meegoimengine
--- unit_test/ut_meegoimengine_hwr/ut_meegoimengine_hwr.pro
+++ unit_test/ut_meegoimengine_hwr/ut_meegoimengine_hwr.pro
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 19 09:19:04 2008
+######################################################################
+TARGET = ut_meegoimengine_hwr
+DEFINES +=
+LIBS += -lmeegoimengine
+LIBS += -L../lib -L../../src
+LIBS += -L/usr/lib/meego-imengines/drivers/hwr/ -Wl,-rpath-link=/usr/lib/meego-imengines/drivers/hwr/ -lstubdriver1_hwr
+
+INCLUDEPATH += ../mydriverstub_hwr ../../src ../../includes ../stubbase
+
+# Input
+HEADERS += ut_mimengine.h \
+
+SOURCES += ut_mimengine.cpp \
+
+CONFIG += debug
+QT = core testlib
+
+include(../common_check.pri)
+
+target.path = /usr/lib/libmeegoimengine-tests/hwr/$$TARGET
+
--- unit_test/ut_meegoimengine_hwr/ut_mimengine.cpp
+++ unit_test/ut_meegoimengine_hwr/ut_mimengine.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "ut_mimengine.h"
+
+#include "stubdriver.h"
+
+#include <QStringList>
+#include <QtDebug>
+#include <QFile>
+#include <QProcess>
+#include <QRegExp>
+
+
+namespace
+{
+    const QString defaultDriverDir = "/usr/lib/meego-imengines/drivers/hwr";
+}
+
+StubDriverHwr *gInterface = NULL;
+namespace
+{
+    const QString MyStubDriverPathKey = "MYSTUBDRIVER_PATH";
+}
+
+void Ut_MImEngineHwrInterfaceFactory::initTestCase()
+{
+    QStringList envs = QProcess::systemEnvironment();
+    QString exp = QString("^%1=.*").arg(MyStubDriverPathKey);
+    int index = envs.indexOf(QRegExp(exp, Qt::CaseInsensitive));
+    QString stubDriverPath = 0;
+    if (index != -1) {
+        stubDriverPath = envs.at(index);
+        exp = QString("^%1=").arg(MyStubDriverPathKey);
+        stubDriverPath = stubDriverPath.remove(QRegExp(exp,Qt::CaseInsensitive));
+        if (!stubDriverPath.isEmpty()) {
+            qDebug() << "manual set driver path:" << stubDriverPath;
+        }
+    }
+
+    m_subject = MImEngineFactory::instance();
+    if (m_subject) {
+        QStringList driverList = m_subject->drivers();
+        QVERIFY(driverList.count() > 0);
+        QVERIFY(driverList.indexOf("stubdriver1_hwr") != -1);
+        gInterface = (StubDriverHwr *)m_subject->createEngineHwr("stubdriver1_hwr");
+        QVERIFY(gInterface != NULL);        
+    }
+}
+
+void Ut_MImEngineHwrInterfaceFactory::cleanupTestCase()
+{
+}
+
+void Ut_MImEngineHwrInterfaceFactory::init()
+{
+    QStringList driverList = m_subject->drivers();
+    QVERIFY(driverList.indexOf("stubdriver1_hwr") != -1);
+}
+
+void Ut_MImEngineHwrInterfaceFactory::cleanup()
+{
+}
+
+void Ut_MImEngineHwrInterfaceFactory::test_setAreaSize()
+{
+    gInterface->stubReset();
+    gInterface->setAreaSize(QSize());
+    QVERIFY(gInterface->stubCallCount("setAreaSize") == 1);
+}
+
+void Ut_MImEngineHwrInterfaceFactory::test_areaSize()
+{
+      gInterface->stubReset();
+      gInterface->stubSetReturnValue<QSize>("areaSize", QSize(100, 200));
+      QVERIFY(gInterface->areaSize() == QSize(100, 200));
+      QVERIFY(gInterface->stubCallCount("areaSize") == 1);
+ }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_setScreenSize()
+  {
+      gInterface->stubReset();
+      gInterface->setScreenSize(QSize());
+      QVERIFY(gInterface->stubCallCount("setScreenSize") == 1);
+  }
+
+
+  void Ut_MImEngineHwrInterfaceFactory::test_screenSize()
+  {
+      gInterface->stubReset();
+      gInterface->stubSetReturnValue<QSize>("screenSize", QSize(100, 200));
+      QVERIFY(gInterface->screenSize() == QSize(100, 200));
+      QVERIFY(gInterface->stubCallCount("screenSize") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_setScripts()
+  {
+        gInterface->stubReset();
+        gInterface->stubSetReturnValue<bool>("setScript" , false);
+        QCOMPARE(gInterface->setScripts(QStringList(QString("HanA"))), false);
+        QVERIFY(gInterface->stubCallCount("setScripts") == 1);
+
+        gInterface->stubReset();
+        gInterface->stubSetReturnValue<bool>("setScripts" , true);
+        QCOMPARE(gInterface->setScripts(QStringList(QString("Hans"))), true);
+        QVERIFY(gInterface->stubCallCount("setScripts") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_scripts()
+  {
+      gInterface->stubReset();
+      gInterface->stubSetReturnValue<QStringList>("scripts", QStringList(QString("Hans")));
+      QCOMPARE(gInterface->scripts(), QStringList(QString("Hans")));
+      QVERIFY(gInterface->stubCallCount("scripts") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_recognize()
+  {
+      gInterface->stubReset();
+      gInterface->stubSetReturnValue<QStringList>("recognize", QStringList(QString("三")));
+      QCOMPARE(gInterface->recognize() , QStringList( QString("三")));
+  	
+      QVERIFY(gInterface->stubCallCount("recognize") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_appendStroke()
+  {       
+       gInterface->stubReset();
+       QList<QPoint> stroke;
+       stroke<<QPoint(1,2)<<QPoint(20,80)<<QPoint(100,200);
+       gInterface->appendStroke(stroke);
+       QVERIFY(gInterface->stubCallCount("appendStroke") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_clear()
+  {
+      gInterface->stubReset();
+      gInterface->clear();
+       QVERIFY(gInterface->stubCallCount("clear") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_train()
+  {
+      gInterface->stubReset();
+      gInterface->train(QString("测试"));
+      QVERIFY(gInterface->stubCallCount("train") == 1);
+  }
+
+  void Ut_MImEngineHwrInterfaceFactory::test_drivers()
+  {
+      qDebug() << m_subject->drivers().count();
+      QVERIFY(m_subject->drivers().count() >= 1);
+  }
+
+void Ut_MImEngineHwrInterfaceFactory::checkMultipleDriverLoad()
+{
+    QString driver1, driver2;
+
+    driver1 = "stubdriver1_hwr";
+    driver2 = "stubdriver2_hwr";
+
+    QStringList driverList = m_subject->drivers();
+    //check that driver exists
+    QVERIFY(driverList.indexOf(driver1) != -1);
+    QVERIFY(driverList.indexOf(driver2) != -1);
+    QVERIFY(gInterface->driver() == driver1);
+    QVERIFY(driverList.count() >= 2);
+
+    // set second driver
+    gInterface = (StubDriverHwr *)m_subject->createEngineHwr(driver2);
+    QVERIFY(gInterface->driver() == driver2);
+
+    //check that all driver exists
+    QVERIFY(driverList.indexOf(driver1) != -1);
+    QVERIFY(driverList.indexOf(driver2) != -1);
+
+    gInterface = (StubDriverHwr *)m_subject->createEngineHwr(driver1);
+    QVERIFY(gInterface->driver() == driver1);
+    QVERIFY(driverList.indexOf(driver1) != -1);
+    QVERIFY(driverList.indexOf(driver2) != -1);
+
+    driverList = m_subject->drivers();
+    QVERIFY(driverList.count() >= 2);
+}
+QTEST_MAIN(Ut_MImEngineHwrInterfaceFactory)
--- unit_test/ut_meegoimengine_hwr/ut_mimengine.h
+++ unit_test/ut_meegoimengine_hwr/ut_mimengine.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef UT_MIMENGINE
+#define UT_MIMENGINE
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include "mimenginefactory.h"
+Q_DECLARE_METATYPE(MImEngineFactory *);
+class Ut_MImEngineHwrInterfaceFactory : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+
+    void init();
+    void cleanup(); 
+
+    void test_setScreenSize();
+
+    void test_screenSize();
+
+    void test_setAreaSize();
+
+    void  test_areaSize();
+
+    void test_setScripts();
+
+    void  test_scripts();
+
+    void test_recognize();
+
+    void test_appendStroke();
+
+    void test_clear();
+
+    void test_train();
+
+    void test_drivers();
+
+    //! Test checks if multiple drivers can be loaded and changed on runtime
+    void checkMultipleDriverLoad();
+private:
+    MImEngineFactory *m_subject;
+};
+
+#endif //MYTEST_H
--- unit_test/ut_meegoimengine_words
+++ unit_test/ut_meegoimengine_words
+(directory)
--- unit_test/ut_meegoimengine_words/README
+++ unit_test/ut_meegoimengine_words/README
(renamed from unit_test/ut_meegoimengine/README)
--- unit_test/ut_meegoimengine_words/env.sh
+++ unit_test/ut_meegoimengine_words/env.sh
(renamed from unit_test/ut_meegoimengine/env.sh)
--- unit_test/ut_meegoimengine_words/ut_meegoimengine_words.pro
+++ unit_test/ut_meegoimengine_words/ut_meegoimengine_words.pro
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 19 09:19:04 2008
+######################################################################
+TARGET = ut_meegoimengine_words
+DEFINES += ET9_ALPHABETIC_MODULE
+LIBS += -lmeegoimengine 
+LIBS += -L../lib -L../../src
+LIBS += -L/usr/lib/meego-imengines/drivers/words -Wl,-rpath-link=/usr/lib/meego-imengines/drivers/words -lstubdriver1_words
+
+
+INCLUDEPATH += ../mydriverstub_words ../../src ../../includes ../stubbase
+
+# stub
+HEADERS += ../stubbase/stubbase.h
+SOURCES += ../stubbase/stubbase.cpp
+
+# Input
+HEADERS += ut_mimengine.h \                       
+
+SOURCES += ut_mimengine.cpp \
+
+CONFIG += debug
+QT = core testlib
+
+include(../common_check.pri)
+
+target.path = /usr/lib/libmeegoimengine-tests/words/$$TARGET
+
--- unit_test/ut_meegoimengine_words/ut_mimengine.cpp
+++ unit_test/ut_meegoimengine_words/ut_mimengine.cpp
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "ut_mimengine.h"
+
+#include "stubdriver.h"
+
+#include <QStringList>
+#include <QtDebug>
+#include <QFile>
+#include <QProcess>
+#include <QRegExp>
+
+
+//namespace
+//{
+//    const QString defaultDriverDir = "/usr/lib/meego-imengines/drivers/words";
+//}
+
+StubDriver *gInterface = NULL;
+namespace
+{
+    const QString MyStubDriverPathKey = "MYSTUBDRIVER_PATH";
+}
+
+void Ut_MImEngineWordsInterfaceFactory::initTestCase()
+{
+    QStringList envs = QProcess::systemEnvironment();
+    QString exp = QString("^%1=.*").arg(MyStubDriverPathKey);
+    int index = envs.indexOf(QRegExp(exp, Qt::CaseInsensitive));
+    QString stubDriverPath = 0;
+    if (index != -1) {
+        stubDriverPath = envs.at(index);
+        exp = QString("^%1=").arg(MyStubDriverPathKey);
+        stubDriverPath = stubDriverPath.remove(QRegExp(exp,Qt::CaseInsensitive));
+        if (!stubDriverPath.isEmpty()) {
+            qDebug() << "manual set driver path:" << stubDriverPath;
+        }
+    }
+
+    m_subject = MImEngineFactory::instance();
+    if (m_subject) {
+        QStringList driverList = m_subject->drivers();
+        qDebug()<<driverList;
+        QVERIFY(driverList.count() > 0);
+        QVERIFY(driverList.indexOf("stubdriver1_words") != -1);
+        gInterface = (StubDriver *)m_subject->createEngineWords("stubdriver1_words");
+        QVERIFY(gInterface != NULL);
+        gInterface->setKeyboardLayout("EN");
+        gInterface->enableDictionary(MImEngine::DictionaryTypeLanguage);
+    }
+}
+
+
+void Ut_MImEngineWordsInterfaceFactory::cleanupTestCase()
+{
+
+}
+
+void Ut_MImEngineWordsInterfaceFactory::init()
+{
+    QStringList driverList = m_subject->drivers();
+    QVERIFY(driverList.indexOf("stubdriver1_words") != -1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::cleanup()
+{
+}
+
+void Ut_MImEngineWordsInterfaceFactory::setLanguage()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setLanguage", false);
+    QCOMPARE(gInterface->setLanguage("TEST", MImEngine::LanguagePriorityPrimary), false);
+    QVERIFY(gInterface->stubCallCount("setLanguage") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setLanguage", true);
+    QCOMPARE(gInterface->setLanguage("EN", MImEngine::LanguagePriorityPrimary), true);
+    QVERIFY(gInterface->stubCallCount("setLanguage") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::setKeyboardLayoutKeys()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setKeyboardLayoutKeys", true);
+    QCOMPARE(gInterface->setKeyboardLayoutKeys(QList<MImEngine::KeyboardLayoutKey>()), true);
+    QVERIFY(gInterface->stubCallCount("setKeyboardLayoutKeys") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setKeyboardLayoutKeys", false);
+    QCOMPARE(gInterface->setKeyboardLayoutKeys(QList<MImEngine::KeyboardLayoutKey>()), false);
+    QVERIFY(gInterface->stubCallCount("setKeyboardLayoutKeys") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::disableDictionary()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("disableDictionary", true);
+    QCOMPARE(gInterface->disableDictionary(MImEngine::DictionaryTypeLanguage), true);
+    QVERIFY(gInterface->stubCallCount("disableDictionary") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("disableDictionary", false);
+    QCOMPARE(gInterface->disableDictionary(MImEngine::DictionaryTypeLanguage), false);
+    QVERIFY(gInterface->stubCallCount("disableDictionary") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::enableDictionary()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("enableDictionary", true);
+    QCOMPARE(gInterface->enableDictionary(MImEngine::DictionaryTypeLanguage), true);
+    QVERIFY(gInterface->stubCallCount("enableDictionary") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("enableDictionary", false);
+    QCOMPARE(gInterface->enableDictionary(MImEngine::DictionaryTypeLanguage), false);
+    QVERIFY(gInterface->stubCallCount("enableDictionary") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::disablePrediction()
+{
+    gInterface->stubReset();
+    gInterface->disablePrediction();
+    QVERIFY(gInterface->stubCallCount("disablePrediction") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::enablePrediction()
+{
+    gInterface->stubReset();
+    gInterface->enablePrediction();
+    QVERIFY(gInterface->stubCallCount("enablePrediction") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::disableCompletion()
+{
+    gInterface->stubReset();
+    gInterface->disableCompletion();
+    QVERIFY(gInterface->stubCallCount("disableCompletion") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::enableCompletion()
+{
+    gInterface->stubReset();
+    gInterface->enableCompletion();
+    QVERIFY(gInterface->stubCallCount("enableCompletion") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::disableCorrection()
+{
+    gInterface->stubReset();
+    gInterface->disableCorrection();
+    QVERIFY(gInterface->stubCallCount("disableCorrection") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::enableCorrection()
+{
+    gInterface->stubReset();
+    gInterface->enableCorrection();
+    QVERIFY(gInterface->stubCallCount("enableCorrection") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::appendString()
+{
+    gInterface->stubReset();
+    gInterface->appendString("aak");
+    QVERIFY(gInterface->stubCallCount("appendString") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::appendCharacter()
+{
+    gInterface->stubReset();
+    QString teststr = "aak";
+    for (int i = 0; i < teststr.count(); i++)
+        gInterface->appendCharacter(teststr.at(i));
+    QVERIFY(gInterface->stubCallCount("appendCharacter") == teststr.count());
+}
+
+void Ut_MImEngineWordsInterfaceFactory::tapKeyboard()
+{
+    gInterface->stubReset();
+    gInterface->tapKeyboard(QPoint(), false, QChar());
+    QVERIFY(gInterface->stubCallCount("tapKeyboard") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::reselectString()
+{
+    gInterface->stubReset();
+    gInterface->reselectString("aak");
+    QVERIFY(gInterface->stubCallCount("reselectString") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::setContext()
+{
+    gInterface->stubReset();
+    gInterface->setContext("aak", 0);
+    QVERIFY(gInterface->stubCallCount("setContext") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::addDictionaryWord()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("addDictionaryWord", true);
+    QCOMPARE(gInterface->addDictionaryWord("test", MImEngine::DictionaryTypeLanguage), true);
+    QVERIFY(gInterface->stubCallCount("addDictionaryWord") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("addDictionaryWord", false);
+    QCOMPARE(gInterface->addDictionaryWord("test", MImEngine::DictionaryTypeLanguage), false);
+    QVERIFY(gInterface->stubCallCount("addDictionaryWord") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::removeDictionaryWord()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("removeDictionaryWord", false);
+    QCOMPARE(gInterface->removeDictionaryWord("test", MImEngine::DictionaryTypeLanguage), false);
+    QVERIFY(gInterface->stubCallCount("removeDictionaryWord") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("removeDictionaryWord", true);
+    QCOMPARE(gInterface->removeDictionaryWord("test", MImEngine::DictionaryTypeLanguage), true);
+    QVERIFY(gInterface->stubCallCount("removeDictionaryWord") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::removeDictionary()
+{
+    gInterface->stubReset();
+    gInterface->removeDictionary(MImEngine::DictionaryTypeLanguage);
+    QVERIFY(gInterface->stubCallCount("removeDictionary") == 1);
+}
+
+
+void Ut_MImEngineWordsInterfaceFactory::predictionEnabled()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("predictionEnabled", true);
+    QCOMPARE(gInterface->predictionEnabled(), true);
+    QVERIFY(gInterface->stubCallCount("predictionEnabled") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("predictionEnabled", false);
+    QCOMPARE(gInterface->predictionEnabled(), false);
+    QVERIFY(gInterface->stubCallCount("predictionEnabled") == 1);
+}
+void Ut_MImEngineWordsInterfaceFactory::correctionEnabled()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("correctionEnabled", true);
+    QCOMPARE(gInterface->correctionEnabled(), true);
+    QVERIFY(gInterface->stubCallCount("correctionEnabled") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("correctionEnabled", false);
+    QCOMPARE(gInterface->correctionEnabled(), false);
+    QVERIFY(gInterface->stubCallCount("correctionEnabled") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::completionEnabled()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("completionEnabled", true);
+    QCOMPARE(gInterface->completionEnabled(), true);
+    QVERIFY(gInterface->stubCallCount("completionEnabled") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("completionEnabled", false);
+    QCOMPARE(gInterface->completionEnabled(), false);
+    QVERIFY(gInterface->stubCallCount("completionEnabled") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::language()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<QString>("language", QString("EN"));
+    QVERIFY(gInterface->language() == "EN");
+    QVERIFY(gInterface->stubCallCount("language") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::keyboardLayoutKeys()
+{
+    const QRect rect(1, 1, 2, 2);
+    const QChar symbol('a');
+    const MImEngine::KeyboardLayoutKeyType type = MImEngine::KeyboardLayoutKeyRegional;
+
+    MImEngine::KeyboardLayoutKey key;
+    key.rect = rect;
+    key.type = type;
+    key.symbols.append(symbol);
+    QList<MImEngine::KeyboardLayoutKey> keys;
+    keys.append(key);
+
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<QList<MImEngine::KeyboardLayoutKey> >("keyboardLayoutKeys", keys);
+    QList<MImEngine::KeyboardLayoutKey> keys2 = gInterface->keyboardLayoutKeys();
+    QVERIFY(keys2.size() == 1);
+    QVERIFY(keys2[0].rect == rect);
+    QVERIFY(keys2[0].type == type);
+    QVERIFY(keys2[0].symbols.size() == 1);
+    QVERIFY(keys2[0].symbols[0] == symbol);
+    QVERIFY(gInterface->stubCallCount("keyboardLayoutKeys") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::exportAsNokiaDictionary()
+{
+    QString fileName = "test.xml";
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("exportAsNokiaDictionary", true);
+    QCOMPARE(gInterface->exportAsNokiaDictionary(fileName), true);
+    QVERIFY(gInterface->stubCallCount("exportAsNokiaDictionary") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("exportAsNokiaDictionary", false);
+    QCOMPARE(gInterface->exportAsNokiaDictionary(fileName), false);
+    QVERIFY(gInterface->stubCallCount("exportAsNokiaDictionary") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::importNokiaUserDictionary()
+{
+    QString fileName = "test.xml";
+    if (QFile::exists(fileName))
+        QFile::remove(fileName);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("importNokiaUserDictionary", true);
+    QCOMPARE(gInterface->importNokiaUserDictionary(fileName), true);
+    QCOMPARE(gInterface->error().isEmpty(), true);
+    gInterface->stubReset();
+    QFile testFile(fileName);
+    testFile.open(QIODevice::WriteOnly);
+    testFile.close();
+    QCOMPARE(gInterface->importNokiaUserDictionary(fileName), false);
+    QVERIFY(gInterface->stubCallCount("importNokiaUserDictionary") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::setMaximumErrors()
+{
+    gInterface->stubReset();
+    gInterface->setMaximumErrors(5);
+    QVERIFY(gInterface->stubCallCount("setMaximumErrors") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::maximumErrors()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<int>("maximumErrors", 5);
+    QVERIFY(gInterface->maximumErrors() == 5);
+    QVERIFY(gInterface->stubCallCount("maximumErrors") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::setMaximumCandidates()
+{
+    gInterface->stubReset();
+    gInterface->setMaximumCandidates(8);
+    QVERIFY(gInterface->stubCallCount("setMaximumCandidates") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::maximumCandidates()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<int>("maximumCandidates", 8);
+    QVERIFY(gInterface->maximumCandidates() == 8);
+    QVERIFY(gInterface->stubCallCount("maximumCandidates") == 1);
+}
+void Ut_MImEngineWordsInterfaceFactory::setSuggestedCandidateIndex()
+{
+    int index = 2;
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setSuggestedCandidateIndex", true);
+    QCOMPARE(gInterface->setSuggestedCandidateIndex(index), true);
+    QVERIFY(gInterface->stubCallCount("setSuggestedCandidateIndex") == 1);
+}
+void Ut_MImEngineWordsInterfaceFactory::suggestedCandidateIndex()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<int>("suggestedCandidateIndex", 2);
+    QVERIFY(gInterface->suggestedCandidateIndex() == 2);
+    QVERIFY(gInterface->stubCallCount("suggestedCandidateIndex") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::clearEngineBuffer()
+{
+    gInterface->stubReset();
+    gInterface->clearEngineBuffer();
+    QVERIFY(gInterface->stubCallCount("clearEngineBuffer") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::saveAndClearEngineBuffer()
+{
+    gInterface->stubReset();
+    gInterface->saveAndClearEngineBuffer();
+    QVERIFY(gInterface->stubCallCount("saveAndClearEngineBuffer") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::drivers()
+{
+    qDebug() << m_subject->drivers().count();
+    QVERIFY(m_subject->drivers().count() >= 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::checkExactWordposition()
+{
+    gInterface->setExactWordPositionInList(MImEngine::ExactInListOff);
+    QVERIFY(gInterface->stubCallCount("setExactWordPositionInList") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::checkErrorCorrectionCandidates()
+{
+    //this can only be checked with a 'real' engine
+    QStringList list;
+    list << "candidates";
+    gInterface->stubSetReturnValue<QStringList>("candidates", list);
+    QVERIFY(gInterface->candidates() == list);
+    QVERIFY(gInterface->stubCallCount("candidates") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::checkMultipleDriverLoad()
+{
+    QString driver1, driver2;
+
+    driver1 = "stubdriver1_words";
+    driver2 = "stubdriver2_words";
+
+    QStringList driverList = m_subject->drivers();
+    //check that driver exists
+    QVERIFY(driverList.indexOf(driver1) != -1);
+    QVERIFY(driverList.indexOf(driver2) != -1);
+    QVERIFY(gInterface->driver() == driver1);
+    QVERIFY(driverList.count() >= 2);
+
+    // set second driver
+    gInterface = (StubDriver *)m_subject->createEngineWords(driver2);
+    QVERIFY(gInterface->driver() == driver2);
+
+    //check that all driver exists
+    QVERIFY(driverList.indexOf(driver1) != -1);
+    QVERIFY(driverList.indexOf(driver2) != -1);
+
+    gInterface = (StubDriver *)m_subject->createEngineWords(driver1);
+    QVERIFY(gInterface->driver() == driver1);
+    QVERIFY(driverList.indexOf(driver1) != -1);
+    QVERIFY(driverList.indexOf(driver2) != -1);
+
+    driverList = m_subject->drivers();
+    QVERIFY(driverList.count() >= 2);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::matchedLength()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<int>("matchedLength", 2);
+    QVERIFY(gInterface->matchedLength() == 2);
+    QVERIFY(gInterface->stubCallCount("matchedLength") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::matchedSyllables()
+{
+    QStringList sValue;
+    gInterface->stubSetReturnValue<QStringList>("matchedSyllables", sValue);
+    QVERIFY(gInterface->matchedSyllables() == sValue);
+    QVERIFY(gInterface->stubCallCount("matchedSyllables") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::totalCandidates()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<int>("totalCandidates", 5);
+    QVERIFY(gInterface->totalCandidates() == 5);
+    QVERIFY(gInterface->stubCallCount("totalCandidates") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::setScript()
+{
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setScript", true);
+    QCOMPARE(gInterface->setScript("testValue"), true);
+    QVERIFY(gInterface->stubCallCount("setScript") == 1);
+    gInterface->stubReset();
+    gInterface->stubSetReturnValue<bool>("setScript", false);
+    QCOMPARE(gInterface->setScript("testValue"), false);
+    QVERIFY(gInterface->stubCallCount("setScript") == 1);
+}
+
+void Ut_MImEngineWordsInterfaceFactory::script()
+{
+    QString sValue("testValue");
+    gInterface->stubSetReturnValue<QString>("script", sValue);
+    QVERIFY(gInterface->script() == sValue);
+    QVERIFY(gInterface->stubCallCount("script") == 1);
+}
+
+QTEST_MAIN(Ut_MImEngineWordsInterfaceFactory)
--- unit_test/ut_meegoimengine_words/ut_mimengine.h
+++ unit_test/ut_meegoimengine_words/ut_mimengine.h
+/* This file is part of meegoimengine *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#ifndef UT_MIMENGINE
+#define UT_MIMENGINE
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include "mimenginefactory.h"
+Q_DECLARE_METATYPE(MImEngineFactory *);
+class Ut_MImEngineWordsInterfaceFactory : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+
+    void init();
+    void cleanup();
+
+    void setLanguage();
+
+    void setKeyboardLayoutKeys();
+
+    void enableDictionary();
+    void disableDictionary();
+
+    void enablePrediction();
+    void disablePrediction();
+
+    void enableCorrection();
+    void disableCorrection();
+
+    void enableCompletion();
+    void disableCompletion();
+
+    void appendString();
+    void appendCharacter();
+    void tapKeyboard();
+    void reselectString();
+    void setContext();
+
+    void addDictionaryWord();
+    void removeDictionaryWord();
+
+    void removeDictionary();
+
+    void predictionEnabled();
+    void correctionEnabled();
+    void completionEnabled();
+
+    void language();
+
+    void keyboardLayoutKeys();
+
+    void exportAsNokiaDictionary();
+    void importNokiaUserDictionary();
+
+    void setMaximumErrors();
+    void maximumErrors();
+
+    void setMaximumCandidates();
+    void maximumCandidates();
+
+    void suggestedCandidateIndex();
+    void setSuggestedCandidateIndex();
+
+    void clearEngineBuffer();
+    void saveAndClearEngineBuffer();
+
+    void totalCandidates();
+
+    void matchedLength();
+
+    void matchedSyllables();
+
+    void drivers();
+
+    void setScript();
+    void script();
+
+    //! can only be tested with a real engine
+    void checkExactWordposition();
+
+    //! test candidates can't be checked with stub (needs to be checked in engine)
+    void checkErrorCorrectionCandidates();
+
+    //! Test checks if multiple drivers can be loaded and changed on runtime
+    void checkMultipleDriverLoad();
+private:
+    MImEngineFactory *m_subject;
+};
+
+#endif //MYTEST_H
--- words
+++ words
-(directory)
--- words/MImEngineWordsInterface
+++ words/MImEngineWordsInterface
(renamed to src/MImEngineWordsInterface)
--- words/MeegoImEngineWords.pc
+++ words/MeegoImEngineWords.pc
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include/qt4/meegoimenginewords
-
-Name: MeegoImEngineWords
-Description: Meego Touch Input Method Engine Framework
-Version: 0.1.0
-Cflags: -I${includedir}
-Libs: -L${libdir} -lmeegoimenginewords
-
--- words/meegoimenginewords.prf
+++ words/meegoimenginewords.prf
-MEEGOIMENGINE_WORDS_PREFIX=/usr
-LIBS+=-L$${MEEGOIMENGINE_WORDS_PREFIX}/lib
-qtAddLibrary(meegoimenginewords)
--- words/mimenginewordsinterface.h
+++ words/mimenginewordsinterface.h
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#ifndef MIMENGINEWORDSINTERFACE_H
-#define MIMENGINEWORDSINTERFACE_H
-
-#include "mimenginetypes.h"
-#include <QString>
-#include <QtPlugin>
-
-class QPoint;
-class QStringList;
-
-/*!
-  \class MImEngineWordsInterface
-
-  \brief Abstract driver class for adding new error correction/prediction
-  engines plugins.
-
-  Implementing a new engine driver means to subclass and implement the virtual methods.
- */
-class MImEngineWordsInterface
-{
-public:
-    /*!
-     * Initialization
-     *\param parent point of QObject*
-     *\return bool
-     */
-    virtual bool init() = 0;
-
-    /*!
-     * Adds a new word to dictionary
-     *\param word, reference of const QString
-     *\param MImEngine::DictionaryType to which type of dictionary the word should be added
-     *\return bool true if the word is successfully added
-     */
-    virtual bool addDictionaryWord(const QString &word,
-                                   MImEngine::DictionaryType) = 0;
-
-    /*!
-     * Removes a word from dictionary
-     *\param word, reference of const QString
-     *\param MImEngine::DictionaryType from which type of dictionary the word should be removed
-     *\return bool true if the word is successfully removed
-     */
-    virtual bool removeDictionaryWord(const QString &word,
-                                      MImEngine::DictionaryType) = 0;
-
-    /*!
-     * Disables dictionary
-     *\param MImEngine::DictionaryType dictionary type which shall be disabled
-     *\return bool true if the dictionary is successfully disabled
-     */
-    virtual bool disableDictionary(MImEngine::DictionaryType) = 0;
-
-    /*!
-     * Enables dictionary
-     *\param MImEngine::DictionaryType dictionary type which shall be enabled
-     *\return bool true if the dictionary is successfully enabled
-     */
-    virtual bool enableDictionary(MImEngine::DictionaryType) = 0;
-
-    /*!
-     * Removes dictionary from disk
-     *\param MImEngine::DictionaryType dictionary type which shall be removed
-     *\return bool true if dictionary is successfully removed
-     */
-    virtual bool removeDictionary(MImEngine::DictionaryType) = 0;
-
-    /*!
-     * Appends one character to engine buffer
-     * \param s, reference of const QString
-     */
-    virtual void appendString(const QString &s) = 0;
-
-    /*!
-     * Appends string to engine buffer
-     * \param c, reference of const QChar
-     */
-    virtual void appendCharacter(const QChar &c) = 0;
-
-    /*!
-     * Tap to keyboard
-     * \param position, position of the tap in the keyboard layout
-     * \param shift, indicates whether the shift is on or not
-     * \param symbol, the preferred symbol
-     */
-    virtual void tapKeyboard(const QPoint &position, bool shift, QChar symbol) = 0;
-
-    /*!
-     * Reselects a previously accepted word. Called when user highlights a previously accepted
-     * word to recreate the candidate list with the original input sequence and key values.
-     * \param s, word to reselect
-     */
-    virtual void reselectString(const QString &s) = 0;
-
-    /*!
-     * Sets context information to the engine. \n
-     * Context information is needed for better completion or for next word completion. 
-     * The context information is usually a part of committed texts which should be passed 
-     * to the engine before getting the completed/predicted word/character sequence from 
-     * the engine.
-     * \param s, the text block used as context information.
-     * \param cursor, the cursor position in the text block.
-     */
-    virtual void setContext(const QString &s, int cursor) = 0;
-
-    /*!
-     * Disables word prediction feature
-     */
-    virtual void disablePrediction() = 0;
-
-    /*!
-     * Enables word prediction feature
-     *\param  N/A
-     *\return N/A
-     */
-    virtual void enablePrediction() = 0;
-
-    /*!
-     * Gets the current status of word prediction
-     *\param  N/A
-     *\return bool, true if word prediction is enabled
-     */
-    virtual bool predictionEnabled() = 0;
-
-    /*!
-     * Disables word completion feature
-     */
-    virtual void disableCompletion() = 0;
-
-    /*!
-     * Enables word completion feature.
-     */
-    virtual void enableCompletion() = 0;
-
-    /*!
-     * Gets the current status of word completion
-     *\return bool, true if word completion is enabled
-     */
-    virtual bool completionEnabled() = 0;
-
-    /*!
-     * Disables auto correction feature
-     * Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".
-     */
-    virtual void disableCorrection() = 0;
-
-    /*!
-     * Enables auto correction feature
-     * Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".
-     */
-    virtual void enableCorrection() = 0;
-
-    /*!
-     * Gets the current status of auto correction
-     * Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".
-     *\return bool, true if auto correction is enabled
-     */
-    virtual bool correctionEnabled() = 0;
-
-    /*!
-     * Clears engine input buffer. Note: clearEngineBuffer will not save the input word and its frequency.
-     * \sa saveAndClearEngineBuffer(), appendString(), appendCharacter()
-     */
-    virtual void clearEngineBuffer() = 0;
-
-    /*!
-     * Saves the input word in engine buffer, and then clears the engine input buffer.
-     * Engine will store the input word to user dictionary (if new word), and store its used frequency.
-     * \sa appendString(), appendCharacter()
-     */
-    virtual void saveAndClearEngineBuffer() = 0;
-
-    /*!
-     * Gets the candidates given by the engine. \n
-     * Notes:
-     * -# By default, this method returns a candidate list which contains all candidates as much as 
-     * the number which is specified by "setMaximumCandidates()".
-     * -# If you want to specify the start index and the number of the candidates that you want, please
-     * pass your arguments to this method.
-     * -# The index of whole candidates starts from "0". And if your specified index or number exceeds 
-     * the actual range of candidates, an empty candidate list will be returned.
-     *
-     *\param uStartIndex, the start index of the whole candidate set. And the index starts from "0".
-     *\param uNum, the number of required candidates. If its value is "0", the default "Maximum" of 
-     * candidates will be returned.
-     *\return QStringList, the list of words given by the engine
-     */
-    virtual QStringList candidates(unsigned int uStartIndex = 0, unsigned int uNum = 0) = 0;
-
-    /*!
-     * Gets the number of all available candidates currently.
-     * \return int, the number of all available candidates or -1 if failure occurs.
-     */
-    virtual int totalCandidates() = 0;
-
-    /*!
-     * Gets matched length of the chosen candidate for current input sequence. \n
-     * Notes:
-     * According to the input character sequence, "candidates()" can return a list and the user can choose
-     * one candidate from it and notify the result to the engine by invoking "setSuggestedCandidateIndex()" 
-     * or "setContext()" method. The chosen candidate might not match the whole input sequence and might 
-     * match only part of the input sequence. So this method will tell the matched length of the chosen 
-     * candidate for current input sequence.
-     *\return int, the matched length of the chosen candidate for current input sequence.
-     */
-    virtual int matchedLength() = 0;
-
-    /*!
-     * Returns the index in the candidate list suggested by the engine as the most appropriate candidate.
-     * Call this after calling candidates(). Useful when doing error correction.
-     *\return the index of suggested candidate
-     *\sa candidates()
-     */
-    virtual int suggestedCandidateIndex() = 0;
-
-    /*!
-     * Sets the index of the suggested candidate in the candidates' list, when user select one word from the
-     * candidates' list, this API should be called, to info engine which one is the user preferred,
-     * then the engine can store the relative information( new word, used frequency, etc.).
-     *\param index, the index which is use selected
-     *\return indicate whether set seccessfully.
-     */
-    virtual bool setSuggestedCandidateIndex(int index) = 0;
-
-    /*!
-     * Sets exact word position in candidate list. Call this to tell engine to position the exact word candidate in the list.
-     * The exact word  can appear in first or last position
-     * of the candidate list and can also can be deleted from the candidate list.
-     * \param setting, indicates whether the exact word in the cadidate list.
-     *
-     * \sa MImEngine::ExactInListType.
-     */
-    virtual void setExactWordPositionInList(MImEngine::ExactInListType setting) = 0;
-
-    /*!
-     * Returns the source dictionary where the candidate comes from.
-     *
-     * \param index indicates the index of candidate in the candidates() list.
-     * \sa candidates().
-     */
-    virtual MImEngine::DictionaryType candidateSource(int index) = 0;
-
-    /*!
-     * Gets current language
-     *\param  N/A
-     *\return QString, current language
-     */
-    virtual QString language() = 0;
-
-
-    /*!
-     * Sets language with the indicated priority
-     *\param  lang, reference of const QString. the language to be set
-     *\param  MImEngine::LanguagePriority. the priority for the language
-     *\return N/A
-     */
-    virtual bool setLanguage(const QString &lang,
-                             MImEngine::LanguagePriority) = 0;
-
-    /*!
-     * DEPRECATED !!! Use setKeyboardLayoutKeys instead!
-     */
-    bool setKeyboardLayout(const QString &) { return false; }
-
-    /*!
-     * DEPRECATED !!! Use keyboardLayoutKeys instead!
-     */
-    QString keyboardLayout()  { return QString(); }
-
-    /*!
-     * Loads new keyboard layout keys for the engine.
-     * \param keys, list of keys in the keyboard layout
-     * \return bool, status
-     */
-    virtual bool setKeyboardLayoutKeys(const QList<MImEngine::KeyboardLayoutKey> &keys) = 0;
-
-    /*!
-     * Gets current keyboard layout keys
-     *\param  N/A
-     *\return QList<MImEngine::KeyboardLayoutKey>, current keyboard layout keys
-     */
-    virtual QList<MImEngine::KeyboardLayoutKey> keyboardLayoutKeys() = 0;
-
-    /*!
-     * Exports the user dictionary into an xml file
-     * \return bool status
-     */
-    virtual bool exportAsNokiaDictionary(const QString &fileName) = 0;
-
-    /*!
-      * Imports user dictionary from an xml file
-      * \return bool status
-      */
-    virtual bool importNokiaUserDictionary(const QString &fileName) = 0;
-
-    /*!
-     * Gets name for current driver
-     *\param  N/A
-     *\return QString, current driver name
-     */
-    virtual QString driver() = 0;
-
-    /*!
-     * Sets the maximum number of errors could happen in a word.
-     *\param int, the maximum number to be set
-     *\return N/A
-     * \sa setMaximumCandidates()
-     */
-    virtual void setMaximumErrors(int maxErrors) = 0;
-
-    /*!
-     * Gets the maximum number of errors that could happen in a word.
-     *\param  N/A
-     *\return int, the maximum allowed errors in a word. If the errors in a word is larger than this,
-     * then engine maybe can not do proper correction.
-     */
-    virtual int maximumErrors() = 0;
-
-    /*!
-     * Sets the maximum number of candidates, including prediction and error correction
-     * The maximum number can not be bigger than 10.
-     *\param int, the maximum number to be set
-     *\return N/A
-     */
-    virtual void setMaximumCandidates(int maxCandidates) = 0;
-
-    /*!
-     * Sets the maximum number for candidates, including prediction and error correction
-     *\param  N/A
-     *\return int, the allowed maximum candidates' count
-     */
-    virtual int maximumCandidates() = 0;
-
-    /*!
-     * Gets error
-     *\param  N/A
-     *\return QString, error
-     */
-    virtual QString error() = 0;
-};
-
-Q_DECLARE_INTERFACE(MImEngineWordsInterface,
-                    "com.nokia.Meego.MImEngineWordsInterface/0.1")
-
-
-#endif // MIMENGINEWORDSINTERFACE_H
-
-/*! \page
-\section intro_sec Input Method Engine Words Interface
-
-This interface provides typical word related functionalities, e.g. word prediction, word completion and error correction.
-
- */
--- words/mimenginewordsinterfacefactory.cpp
+++ words/mimenginewordsinterfacefactory.cpp
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "mimenginewordsinterfacefactory.h"
-
-#include <QDir>
-#include <QPluginLoader>
-#include <QTimer>
-#include <QtDebug>
-
-namespace
-{
-    const QString defaultDriverDir = "/usr/lib/meego-imengines/drivers";
-}
-
-class MImEngineWordsInterfaceFactoryPrivate
-{
-    Q_DISABLE_COPY(MImEngineWordsInterfaceFactoryPrivate)
-    Q_DECLARE_PUBLIC(MImEngineWordsInterfaceFactory)
-    friend class Ut_MImEngineWordsInterfaceFactory;
-
-protected:
-    MImEngineWordsInterfaceFactoryPrivate();
-    ~MImEngineWordsInterfaceFactoryPrivate();
-    void updateDrivers();
-    MImEngineWordsInterface *createEngine(const QString &driver);
-    void deleteEngine(MImEngineWordsInterface *engine);
-    QStringList drivers();
-
-    //1:driver name; 2:file absolute name
-    QMap<QString, QString> driversMap;
-    QMap<MImEngineWordsInterface*, QPluginLoader*> pluginMap;
-    QString driversPath;
-    MImEngineWordsInterfaceFactory *q_ptr;
-};
-
-MImEngineWordsInterfaceFactoryPrivate::MImEngineWordsInterfaceFactoryPrivate()
-    :driversPath(defaultDriverDir)
-{
-
-}
-
-MImEngineWordsInterfaceFactoryPrivate::~MImEngineWordsInterfaceFactoryPrivate()
-{
-    QMap<MImEngineWordsInterface*, QPluginLoader*>::const_iterator i = pluginMap.constBegin();
-    while (i != pluginMap.constEnd()) {
-        QPluginLoader *plugin = i.value();
-        if (plugin) {
-            if (plugin->isLoaded()) {
-                plugin->unload();
-            }
-            delete plugin;
-        }
-        ++i;
-    }
-}
-
-QStringList MImEngineWordsInterfaceFactoryPrivate::drivers()
-{
-    updateDrivers();
-    return driversMap.keys();
-}
-
-void MImEngineWordsInterfaceFactoryPrivate::updateDrivers()
-{
-    //read the default directory for engine
-    QDir pluginsDir(driversPath);
-    QPluginLoader *plugin = 0;
-    QStringList filterList("*.so");
-    QObject *p = 0;
-    MImEngineWordsInterface *driverIface = 0;
-    QString absoluteFileName;
-
-    driversMap.clear();
-
-    foreach (const QString &fileName, pluginsDir.entryList(filterList, QDir::Files)) {
-        plugin = 0;
-        p = 0;
-        driverIface = 0;
-        absoluteFileName = pluginsDir.absoluteFilePath(fileName);
-
-        qDebug() << __PRETTY_FUNCTION__ << "try to load plugin: " << fileName;
-
-        if (!absoluteFileName.isEmpty())
-            plugin = new QPluginLoader(absoluteFileName);
-        if (plugin)
-            p = plugin->instance();
-        if (p)
-            driverIface = qobject_cast<MImEngineWordsInterface *>(p);
-        else
-            qDebug() << plugin->errorString();
-
-        if (driverIface) {
-            driversMap.insert(driverIface->driver(), absoluteFileName);
-        }
-        if (plugin) {
-            if (plugin->isLoaded()) {
-                plugin->unload();
-            }
-            delete plugin;
-        }
-    }
-
-    qDebug() << __PRETTY_FUNCTION__ << "valid drivers:" << driversMap;
-}
-
-MImEngineWordsInterface *MImEngineWordsInterfaceFactoryPrivate::createEngine(const QString &driver)
-{
-    updateDrivers();
-
-    QPluginLoader *plugin = 0;
-    QObject *p = 0;
-    MImEngineWordsInterface *driverIface = 0;
-
-    qDebug() << __PRETTY_FUNCTION__ << "try to create driver:" << driver;
-
-    if(driversMap.contains(driver)) {
-        QString absoluteFileName = driversMap.value(driver);
-        qDebug() << __PRETTY_FUNCTION__ << "find driver file:" << absoluteFileName;
-        plugin = new QPluginLoader(absoluteFileName);
-        if (plugin)
-            p = plugin->instance();
-        if (p)
-            driverIface = qobject_cast<MImEngineWordsInterface *>(p);
-        else
-            qDebug() << __PRETTY_FUNCTION__ << "failed create driver:" << plugin->errorString();
-    }
-    else {
-        qDebug() << __PRETTY_FUNCTION__ << "can't find driver file for:" << driver;
-    }
-
-    if (driverIface) {
-        if (!driverIface->init()) {
-            qDebug() << __PRETTY_FUNCTION__ << "load driver" << driver << "success, but init failed";
-            driverIface = 0;
-        }
-    }
-
-    if(driverIface){
-        qDebug() << __PRETTY_FUNCTION__ << "successfully create driver:" << driver;
-        pluginMap.insert(driverIface, plugin);
-    }
-    else {
-        if (plugin) {
-            if (plugin->isLoaded()) {
-                plugin->unload();
-            }
-            delete plugin;
-        }
-    }
-
-    return driverIface;
-}
-
-void MImEngineWordsInterfaceFactoryPrivate::deleteEngine(MImEngineWordsInterface *engine)
-{
-    if(engine && pluginMap.contains(engine)) {
-        QPluginLoader *plugin = pluginMap.value(engine);
-        if (plugin) {
-            if (plugin->isLoaded()) {
-                plugin->unload();
-            }
-            delete plugin;
-        }
-        pluginMap.remove(engine);
-    }
-}
-
-
-MImEngineWordsInterfaceFactory::MImEngineWordsInterfaceFactory()
-    :d_ptr(new MImEngineWordsInterfaceFactoryPrivate)
-{
-    Q_D(MImEngineWordsInterfaceFactory);
-    d->q_ptr = this;
-}
-
-MImEngineWordsInterfaceFactory::~MImEngineWordsInterfaceFactory()
-{
-    delete d_ptr;
-}
-
-MImEngineWordsInterfaceFactory *MImEngineWordsInterfaceFactory::instance()
-{
-    static MImEngineWordsInterfaceFactory ap_instance;
-    return &ap_instance;
-}
-
-QStringList MImEngineWordsInterfaceFactory::drivers()
-{
-    return d_ptr->drivers();
-}
-
-MImEngineWordsInterface *MImEngineWordsInterfaceFactory::createEngine(const QString &driver)
-{
-    return d_ptr->createEngine(driver);
-}
-
-void MImEngineWordsInterfaceFactory::deleteEngine(MImEngineWordsInterface *engine)
-{
-    return d_ptr->deleteEngine(engine);
-}
--- words/mimenginewordsinterfacefactory.h
+++ words/mimenginewordsinterfacefactory.h
-/* This file is part of meegoimengine *
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * Contact: Nokia Corporation (directui at nokia.com)
- *
- * If you have questions regarding the use of this file, please contact
- * Nokia at directui at nokia.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#ifndef MIMENGINEWORDSINTERFACEFACTORY_H
-#define MIMENGINEWORDSINTERFACEFACTORY_H
-
-#include <QObject>
-#include <QStringList>
-#include <QMap>
-#include "mimenginetypes.h"
-#include "mimenginewordsinterface.h"
-
-class MImEngineWordsInterfaceFactoryPrivate;
-
-/*!
-  \class MImEngineWordsInterfaceFactory
-
-  \brief The MImEngineWordsInterfaceFactory class provides a singleton interface
-  to create MImEngineWordsInterface object.
-*/
-class MImEngineWordsInterfaceFactory
-{
-    Q_DISABLE_COPY(MImEngineWordsInterfaceFactory)
-    friend class Ut_MImEngineWordsInterfaceFactory;
-
-public:
-    /*!
-     * get the singleton instance for MImEngineWordsInterfaceFactory
-     * note: the driver should be placed here: "/usr/lib/meego-imengines/drivers";
-     * \return the singleton instance for MImEngineWordsInterfaceFactory
-     */
-    static MImEngineWordsInterfaceFactory *instance();
-
-    /*!
-     * create MImEngineWordsInterface object.
-     * \param driver the Engine name
-     * \return MImEngineWordsInterface object pointer or null if instantiation failed
-     */
-    MImEngineWordsInterface *createEngine(const QString &driver);
-
-    /*!
-     * delete MImEngineWordsInterface object.
-     * \param engine the Engine object pointer
-     */
-    void deleteEngine(MImEngineWordsInterface *engine);
-
-    /*!
-     * get driver names
-     * \return driver names
-     */
-    QStringList drivers();
-
-    /*!
-     * MImEngineWordsInterfaceFactory destructor
-     */
-    ~MImEngineWordsInterfaceFactory();
-
-private:
-    MImEngineWordsInterfaceFactory();
-    MImEngineWordsInterfaceFactoryPrivate *const d_ptr;
-    Q_DECLARE_PRIVATE(MImEngineWordsInterfaceFactory);
-};
-
-#endif
--- words/words.pro
+++ words/words.pro
-VERSION = 0.1.0
-TEMPLATE = lib
-TARGET=meegoimenginewords
-QMAKE_CXXFLAGS += -Werror
-CONFIG +=  debug
-INCLUDEPATH = ./ ../includes
-LIBS += -L./
-
-include(../meegoimengine.prf)
-
-LIBS += -L$$[QT_INSTALL_LIBS]
-QT = core
-
-# coverage flags are off per default, but can be enabled via qmake COV_OPTION=on
-for(OPTION,$$list($$lower($$COV_OPTION))){
-    isEqual(OPTION, on){
-        QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs -fno-elide-constructors
-        LIBS += -lgcov
-    }
-}
-
-QMAKE_CLEAN += *.gcno *.gcda
-
-SOURCES +=  mimenginewordsinterfacefactory.cpp
-HEADERS +=  mimenginewordsinterface.h \
-            MImEngineWordsInterface \
-            mimenginewordsinterfacefactory.h \
-            ../includes/mimenginetypes.h \
-
-CONFIG +=  debug
-
-target.path += $$MEEGOIMENGINE_PREFIX/lib
-
-headers.path += $$MEEGOIMENGINE_INSTALL_HEADERS
-headers.files += $$HEADERS
-
-install_headers.path = $$MEEGOIMENGINE_INSTALL_HEADERS
-install_headers.files = include/*
-
-install_pkgconfig.path = $$[QT_INSTALL_LIBS]/pkgconfig
-install_pkgconfig.files = MeegoImEngineWords.pc
-
-install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
-install_prf.files = meegoimenginewords.prf
-
-INSTALLS += target \
-    headers \
-    install_headers \
-    install_pkgconfig \
-    install_prf \
-
-QMAKE_EXTRA_TARGETS += check-xml
-check-xml.depends = lib$${TARGET}.so.$$VERSION
-check-xml.commands = $$system(true)
-
-QMAKE_EXTRA_TARGETS += check
-check.depends = lib$${TARGET}.so.$$VERSION
-check.commands = $$system(true)
-
-QMAKE_EXTRA_TARGETS += memcheck
-memcheck.depends = lib$${TARGET}.so.$$VERSION
-memcheck.commands = $$system(true)
-

++++++ meegotouch-inputmethodengine.yaml
--- meegotouch-inputmethodengine.yaml
+++ meegotouch-inputmethodengine.yaml
@@ -1,6 +1,6 @@
 Name: meegotouch-inputmethodengine
-Summary: Direct UI Input Method Engine
-Version: 0.3.0
+Summary: Meego UI Input Method Engine
+Version: 0.4.0
 Release: 1
 Group: System/Libraries
 License: LGPLv2.1
@@ -10,7 +10,7 @@
 Requires:
     - "%{name} >= %{version}"
 Description: |
-    Direct UI Input Method Engine
+    Meego UI Input Method Engine
 PkgConfigBR:
     - QtCore >= 4.6.0
     - gstreamer-0.10
@@ -29,7 +29,24 @@
 Builder: qmake
 SubPackages:
     - Name: devel
-      Summary: Development files for the Direct UI Input Method Engine
+      Summary: Development files for the Meego UI Input Method Engine
       Group: Development/Libraries
-      Description: |
-          This package contains the files necessary to develop duiimengine applications.
+      Description: This package contains the files necessary to develop meegoimengine applications.
+
+    - Name: libmeegoimenginewords0
+      AsWholeName: yes
+      Summary: Meego Touch Input Method Engine Framework library
+      Group: Development/Libraries
+      Description: Meego Touch Input Method Engine Framework library, word correction/prediction
+
+    - Name: tests
+      Summary: Unit tests for the MeeGo UI Input Method Engine
+      Group: Development/Libraries
+      Description: This package contains the unit tests for the MeeGo UI Input Method Engine
+      Requires: libmeegoimenginewords0
+
+    - Name: dummydriver
+      Summary: Dummy Driver for libmeegoimengine
+      Group: Development/Libraries
+      Description: This package contains Dummy Driver for libmeegoimengine
+      Requires: libmeegoimenginewords0



More information about the MeeGo-commits mailing list