[ktexteditor] /: fix unit completion_test

Christoph Cullmann cullmann at kde.org
Sat Oct 3 09:31:39 UTC 2015


Git commit ffe46c917e2f760d91f87d275e9d17caeacad7c8 by Christoph Cullmann.
Committed on 03/10/2015 at 09:31.
Pushed by cullmann into branch 'master'.

fix unit completion_test

the problem was the countItems, not sure since how long this was broken, an other problem
was that we skipped all tests if we have no ksycoca, which is a stupid idea imho
as this will just hide the problems locally for you (and I think we don't need
it anyway given ktexteditor should load fine without)

CCMAIL: kwrite-devel at kde.org
CCMAIL: kde-frameworks-devel at kde.org

M  +5    -5    autotests/src/completion_test.cpp
M  +1    -1    src/completion/katecompletionmodel.cpp

http://commits.kde.org/ktexteditor/ffe46c917e2f760d91f87d275e9d17caeacad7c8

diff --git a/autotests/src/completion_test.cpp b/autotests/src/completion_test.cpp
index 41c0580..919c2cb 100644
--- a/autotests/src/completion_test.cpp
+++ b/autotests/src/completion_test.cpp
@@ -41,8 +41,12 @@ using namespace KTextEditor;
 
 int countItems(KateCompletionModel *model)
 {
+    const int topLevel = model->rowCount(QModelIndex());
+    if (!model->hasGroups()) {
+        return topLevel;
+    }
     int ret = 0;
-    for (int i = 0; i < model->rowCount(QModelIndex()); ++i) {
+    for (int i = 0; i < topLevel; ++i) {
         ret += model->rowCount(model->index(i, 0));
     }
     return ret;
@@ -80,10 +84,6 @@ static void invokeCompletionBox(KTextEditor::ViewPrivate *view)
 
 void CompletionTest::init()
 {
-    if (!KSycoca::isAvailable()) {
-        QSKIP("ksycoca not available");
-    }
-
     Editor *editor = KTextEditor::Editor::instance();
     QVERIFY(editor);
 
diff --git a/src/completion/katecompletionmodel.cpp b/src/completion/katecompletionmodel.cpp
index e366a08..b48c91c 100644
--- a/src/completion/katecompletionmodel.cpp
+++ b/src/completion/katecompletionmodel.cpp
@@ -1987,7 +1987,7 @@ static inline bool containsAtWordBeginning(const QString &word, const QString &t
         }
     }
     return false;
-};
+}
 
 KateCompletionModel::Item::MatchType KateCompletionModel::Item::match()
 {


More information about the Kde-frameworks-devel mailing list