File indexing completed on 2024-04-28 03:57:09
0001 /* 0002 This file is part of the KDE libraries and the Kate part. 0003 SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef EMULATEDCOMMANDBARSETUPANDTEARDOWN_H 0009 #define EMULATEDCOMMANDBARSETUPANDTEARDOWN_H 0010 0011 #include <QObject> 0012 0013 namespace KTextEditor 0014 { 0015 class ViewPrivate; 0016 } 0017 0018 class KateViInputMode; 0019 class QMainWindow; 0020 0021 /** 0022 * This class is used by the EmulatedCommandBarSetUpAndTearDown class so 0023 * the main window is active all the time. 0024 */ 0025 class WindowKeepActive : public QObject 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit WindowKeepActive(QMainWindow *mainWindow); 0031 0032 public Q_SLOTS: 0033 bool eventFilter(QObject *object, QEvent *event) override; 0034 0035 private: 0036 QMainWindow *m_mainWindow; 0037 }; 0038 0039 /** 0040 * Helper class that is used to setup and tear down tests affecting 0041 * the command bar in any way. 0042 */ 0043 class EmulatedCommandBarSetUpAndTearDown 0044 { 0045 public: 0046 EmulatedCommandBarSetUpAndTearDown(KateViInputMode *inputMode, KTextEditor::ViewPrivate *view, QMainWindow *window); 0047 0048 ~EmulatedCommandBarSetUpAndTearDown(); 0049 0050 private: 0051 KTextEditor::ViewPrivate *m_view; 0052 QMainWindow *m_window; 0053 WindowKeepActive m_windowKeepActive; 0054 KateViInputMode *m_viInputMode; 0055 }; 0056 0057 #endif