File indexing completed on 2024-12-01 12:38:43
0001 /* 0002 SPDX-License-Identifier: LGPL-2.0-or-later 0003 */ 0004 0005 #ifndef SCRIPT_TEST_H 0006 #define SCRIPT_TEST_H 0007 0008 #include <QObject> 0009 #include <QPair> 0010 #include <QStringList> 0011 0012 class TestScriptEnv; 0013 namespace KTextEditor 0014 { 0015 class DocumentPrivate; 0016 } 0017 namespace KTextEditor 0018 { 0019 class ViewPrivate; 0020 } 0021 class QMainWindow; 0022 0023 class ScriptTestBase : public QObject 0024 { 0025 Q_OBJECT 0026 0027 protected: 0028 void initTestCase(); 0029 void cleanupTestCase(); 0030 typedef QPair<const char *, const char *> Failure; 0031 typedef QList<Failure> ExpectedFailures; 0032 void getTestData(const QString &script); 0033 void runTest(const ExpectedFailures &failures); 0034 0035 TestScriptEnv *m_env; 0036 KTextEditor::DocumentPrivate *m_document; 0037 QMainWindow *m_toplevel; 0038 bool m_outputWasCustomised; 0039 QStringList m_commands; 0040 KTextEditor::ViewPrivate *m_view; 0041 QString m_section; // dir name in testdata/ 0042 QString m_script_dir; // dir name in part/script/data/ 0043 0044 public: 0045 static QtMessageHandler m_msgHandler; 0046 }; 0047 0048 #endif // SCRIPT_TEST_H