File indexing completed on 2024-05-12 15:45:11

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2014 Miquel Sabaté Solà <mikisabate@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef COMPLETION_TEST_H
0009 #define COMPLETION_TEST_H
0010 
0011 #include "base.h"
0012 #include "fakecodecompletiontestmodel.h"
0013 
0014 namespace KTextEditor
0015 {
0016 class CodeCompletionInterface;
0017 }
0018 
0019 /**
0020  * This class handles implements a completion model for the completion
0021  * tests defined in the CompletionTest class.
0022  */
0023 class VimCodeCompletionTestModel : public KTextEditor::CodeCompletionModel
0024 {
0025 public:
0026     explicit VimCodeCompletionTestModel(KTextEditor::View *parent);
0027     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0028     KTextEditor::CodeCompletionInterface *cc() const;
0029 };
0030 
0031 /**
0032  * This class implements a completion model used in the CompletionTest class
0033  * to test that code completion is not invoked.
0034  */
0035 class FailTestOnInvocationModel : public KTextEditor::CodeCompletionModel
0036 {
0037 public:
0038     explicit FailTestOnInvocationModel(KTextEditor::View *parent);
0039     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0040     void failTest() const;
0041     KTextEditor::CodeCompletionInterface *cc() const;
0042 };
0043 
0044 class CompletionTest : public BaseTest
0045 {
0046     Q_OBJECT
0047 
0048 private Q_SLOTS:
0049     void FakeCodeCompletionTests();
0050     void CompletionTests();
0051 
0052 private:
0053     void waitForCompletionWidgetToActivate();
0054     void clearTrackedDocumentChanges();
0055 };
0056 
0057 #endif /* COMPLETION_TEST_H */