File indexing completed on 2024-04-28 03:57:09

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2011 Kuzmich Svyatoslav
0004     SPDX-FileCopyrightText: 2012-2013 Simon St James <kdedevel@etotheipiplusone.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef EMULATEDCOMMANDBAR_TEST_H
0010 #define EMULATEDCOMMANDBAR_TEST_H
0011 
0012 #include "base.h"
0013 
0014 class QCompleter;
0015 class QLabel;
0016 class QColor;
0017 
0018 namespace Kate
0019 {
0020 class TextRange;
0021 }
0022 
0023 class EmulatedCommandBarTest : public BaseTest
0024 {
0025     Q_OBJECT
0026 
0027 private Q_SLOTS:
0028     void EmulatedCommandBarTests();
0029 
0030 private:
0031     QCompleter *emulatedCommandBarCompleter();
0032 
0033     void verifyCommandBarCompletionVisible();
0034     void verifyCommandBarCompletionsMatches(const QStringList &expectedCompletionList);
0035     void verifyCommandBarCompletionContains(const QStringList &expectedCompletionList);
0036     QLabel *emulatedCommandTypeIndicator();
0037     void verifyCursorAt(KTextEditor::Cursor expectedCursorPos);
0038 
0039     void clearSearchHistory();
0040     QStringList searchHistory();
0041     void clearCommandHistory();
0042     QStringList commandHistory();
0043     void clearReplaceHistory();
0044     QStringList replaceHistory();
0045 
0046     QList<Kate::TextRange *> rangesOnFirstLine();
0047     void verifyTextEditBackgroundColour(const QColor &expectedBackgroundColour);
0048     QLabel *commandResponseMessageDisplay();
0049     void waitForEmulatedCommandBarToHide(long int timeout);
0050     void verifyShowsNumberOfReplacementsAcrossNumberOfLines(int numReplacements, int acrossNumLines);
0051 };
0052 
0053 class FailsIfSlotNotCalled : public QObject
0054 {
0055     Q_OBJECT
0056 public:
0057     FailsIfSlotNotCalled();
0058     ~FailsIfSlotNotCalled() override;
0059 public Q_SLOTS:
0060     void slot();
0061 
0062 private:
0063     bool m_slotWasCalled = false;
0064 };
0065 
0066 class FailsIfSlotCalled : public QObject
0067 {
0068     Q_OBJECT
0069 public:
0070     explicit FailsIfSlotCalled(const QString &failureMessage);
0071 public Q_SLOTS:
0072     void slot();
0073 
0074 private:
0075     const QString m_failureMessage;
0076 };
0077 
0078 #endif
0079 
0080 // kate: space-indent on; indent-width 2; replace-tabs on;