From: Bartosz Szatkowski Date: Fri, 6 Aug 2010 08:35:20 +0000 (+0200) Subject: Added tests and some maintenance X-Git-Tag: 0.4~70^2~17 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=b4d16f5d0472feb294ed45dbb7543b1de1c1a936;p=mdictionary Added tests and some maintenance --- diff --git a/trunk/src/base/backbone/backbone.cpp b/trunk/src/base/backbone/backbone.cpp index 023c82f..680feca 100644 --- a/trunk/src/base/backbone/backbone.cpp +++ b/trunk/src/base/backbone/backbone.cpp @@ -119,7 +119,6 @@ void Backbone::stopSearching() { void Backbone::search(QString word) { - //TODO add running searches in new threads _timer.stop(); _result.clear(); _innerResult.clear(); diff --git a/trunk/src/base/backbone/backbone.h b/trunk/src/base/backbone/backbone.h index a2750cf..fdcce17 100644 --- a/trunk/src/base/backbone/backbone.h +++ b/trunk/src/base/backbone/backbone.h @@ -87,7 +87,9 @@ public Q_SLOTS: //! Fired when dictionary call finalTranslation(..) with translation ready void translation(); + //! Removes given dictionary void removeDictionary(CommonDictInterface* dict); + // TODO addToBookmark(Translation*); // TODO removeFromBookmark(Translation*); diff --git a/trunk/tests/mDictionaryTests/tst_Backbone.cpp b/trunk/tests/mDictionaryTests/tst_Backbone.cpp index 9bfdae8..c39f9f7 100644 --- a/trunk/tests/mDictionaryTests/tst_Backbone.cpp +++ b/trunk/tests/mDictionaryTests/tst_Backbone.cpp @@ -51,6 +51,7 @@ private Q_SLOTS: void stopSearchingTest(); void searchTest(); void translationTest(); + void quitTest(); }; BackboneTest::BackboneTest() @@ -190,7 +191,29 @@ void BackboneTest::translationTest() { back->translation(); QVERIFY2(translatS.count() == 1, "Lost finall 'ready()' signal"); - QVERIFY2(back->result().size() == total*2, "Lost some of translations"); + QVERIFY2(back->result().size() == total*2, "Lost some of the translations"); +} + +void BackboneTest::quitTest() { + QSignalSpy translatS(back, SIGNAL(closeOk())); + for(int i = 0; i < total; i++) { + CommonDictInterfaceMock *m = (CommonDictInterfaceMock*) dict[i]; + m->stopped = 0; + back->addDictionary(dict[i]); + } + + for(int i = 0; i < total; i++) { + CommonDictInterfaceMock *m = (CommonDictInterfaceMock*)dict[i]; + QCOMPARE(m->stopped, 0); + } + + back->quit(); + + for(int i = 0; i < total; i++) { + CommonDictInterfaceMock *m = (CommonDictInterfaceMock*)dict[i]; + QCOMPARE(m->stopped, 1); + } + QVERIFY2(translatS.count() == 1, "Lost finall 'closeOk()' signal"); }