Changeset View
Changeset View
Standalone View
Standalone View
autotests/src/testutils.h
Show All 18 Lines | |||||
19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
20 | * Boston, MA 02110-1301, USA. | 20 | * Boston, MA 02110-1301, USA. | ||
21 | * | 21 | * | ||
22 | */ | 22 | */ | ||
23 | #ifndef TESTUTILS_H | 23 | #ifndef TESTUTILS_H | ||
24 | #define TESTUTILS_H | 24 | #define TESTUTILS_H | ||
25 | 25 | | |||
26 | #include "katescriptview.h" | 26 | #include "katescriptview.h" | ||
27 | #include "katescriptdocument.h" | | |||
28 | 27 | | |||
29 | #include <QtScript/QScriptable> | 28 | #include "katescriptdocument.h" | ||
29 | #include <QtQml/QJSEngine> | ||||
30 | 30 | | |||
31 | namespace KTextEditor { class ViewPrivate; } | 31 | namespace KTextEditor { class ViewPrivate; } | ||
32 | class RegressionTest; | 32 | class RegressionTest; | ||
33 | class KCmdLineArgs; | 33 | class KCmdLineArgs; | ||
34 | class OutputObject; | 34 | class OutputObject; | ||
35 | class KateViewObject; | 35 | class KateViewObject; | ||
36 | class KateDocumentObject; | 36 | class KateDocumentObject; | ||
37 | 37 | | |||
38 | /** | 38 | /** | ||
39 | * @internal | 39 | * @internal | ||
40 | * The backbone of Kate's automatic regression tests. | 40 | * The backbone of Kate's automatic regression tests. | ||
41 | */ | 41 | */ | ||
42 | class TestScriptEnv : public QObject | 42 | class TestScriptEnv : public QObject | ||
43 | { | 43 | { | ||
44 | public: | 44 | public: | ||
45 | explicit TestScriptEnv(KTextEditor::DocumentPrivate *part, bool &cflag); | 45 | explicit TestScriptEnv(KTextEditor::DocumentPrivate *part, bool &cflag); | ||
46 | virtual ~TestScriptEnv(); | 46 | virtual ~TestScriptEnv(); | ||
47 | 47 | | |||
48 | QScriptEngine *engine() const | 48 | QJSEngine *engine() const | ||
49 | { | 49 | { | ||
50 | return m_engine; | 50 | return m_engine; | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | /** returns the output object */ | 53 | /** returns the output object */ | ||
54 | OutputObject *output() const | 54 | OutputObject *output() const | ||
55 | { | 55 | { | ||
56 | return m_output; | 56 | return m_output; | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | private: | 59 | private: | ||
60 | QScriptEngine *m_engine; | 60 | QJSEngine *m_engine; | ||
61 | KateViewObject *m_viewObj; | 61 | KateViewObject *m_viewObj; | ||
62 | KateDocumentObject *m_docObj; | 62 | KateDocumentObject *m_docObj; | ||
63 | 63 | | |||
64 | OutputObject *m_output; | 64 | OutputObject *m_output; | ||
65 | }; | 65 | }; | ||
66 | 66 | | |||
67 | /** | 67 | /** | ||
68 | * @internal | 68 | * @internal | ||
69 | */ | 69 | */ | ||
70 | class KateViewObject : public KateScriptView | 70 | class KateViewObject : public KateScriptView | ||
71 | { | 71 | { | ||
72 | Q_OBJECT | 72 | Q_OBJECT | ||
73 | 73 | | |||
74 | public: | 74 | public: | ||
75 | 75 | | |||
76 | explicit KateViewObject(KTextEditor::ViewPrivate *view); | 76 | explicit KateViewObject(QJSEngine *engine, KTextEditor::ViewPrivate *view); | ||
77 | virtual ~KateViewObject(); | 77 | virtual ~KateViewObject(); | ||
78 | 78 | | |||
79 | // Edit functions | 79 | // Edit functions | ||
80 | Q_INVOKABLE void keyReturn(int cnt = 1); | 80 | Q_INVOKABLE void keyReturn(int cnt = 1); | ||
81 | Q_INVOKABLE void backspace(int cnt = 1); | 81 | Q_INVOKABLE void backspace(int cnt = 1); | ||
82 | Q_INVOKABLE void deleteWordLeft(int cnt = 1); | 82 | Q_INVOKABLE void deleteWordLeft(int cnt = 1); | ||
83 | Q_INVOKABLE void keyDelete(int cnt = 1); | 83 | Q_INVOKABLE void keyDelete(int cnt = 1); | ||
84 | Q_INVOKABLE void deleteWordRight(int cnt = 1); | 84 | Q_INVOKABLE void deleteWordRight(int cnt = 1); | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | |||||
150 | /** | 150 | /** | ||
151 | * @internal | 151 | * @internal | ||
152 | */ | 152 | */ | ||
153 | class KateDocumentObject : public KateScriptDocument | 153 | class KateDocumentObject : public KateScriptDocument | ||
154 | { | 154 | { | ||
155 | Q_OBJECT | 155 | Q_OBJECT | ||
156 | 156 | | |||
157 | public: | 157 | public: | ||
158 | explicit KateDocumentObject(KTextEditor::DocumentPrivate *doc); | 158 | explicit KateDocumentObject(QJSEngine *engine, KTextEditor::DocumentPrivate *doc); | ||
159 | virtual ~KateDocumentObject(); | 159 | virtual ~KateDocumentObject(); | ||
160 | 160 | | |||
161 | private: | 161 | private: | ||
162 | Q_DISABLE_COPY(KateDocumentObject) | 162 | Q_DISABLE_COPY(KateDocumentObject) | ||
163 | }; | 163 | }; | ||
164 | 164 | | |||
165 | /** | 165 | /** | ||
166 | * Customizing output to result-files. Writing any output into result files | 166 | * Customizing output to result-files. Writing any output into result files | ||
167 | * inhibits outputting the content of the katepart after script execution, | 167 | * inhibits outputting the content of the katepart after script execution, | ||
168 | * enabling one to check for coordinates and the like. | 168 | * enabling one to check for coordinates and the like. | ||
169 | * @internal | 169 | * @internal | ||
170 | */ | 170 | */ | ||
171 | class OutputObject : public QObject, protected QScriptable | 171 | class OutputObject : public QObject | ||
172 | { | 172 | { | ||
173 | Q_OBJECT | 173 | Q_OBJECT | ||
174 | 174 | | |||
175 | public: | 175 | public: | ||
176 | OutputObject(KTextEditor::ViewPrivate *v, bool &cflag); | 176 | OutputObject(KTextEditor::ViewPrivate *v, bool &cflag); | ||
177 | virtual ~OutputObject(); | 177 | virtual ~OutputObject(); | ||
178 | 178 | | |||
179 | void output(bool cp, bool ln); | 179 | void output(bool cp, bool ln); | ||
Show All 16 Lines | |||||
196 | Q_INVOKABLE void pos(); | 196 | Q_INVOKABLE void pos(); | ||
197 | Q_INVOKABLE void posln(); | 197 | Q_INVOKABLE void posln(); | ||
198 | Q_INVOKABLE void posLn(); | 198 | Q_INVOKABLE void posLn(); | ||
199 | 199 | | |||
200 | private: | 200 | private: | ||
201 | KTextEditor::ViewPrivate *view; | 201 | KTextEditor::ViewPrivate *view; | ||
202 | bool &cflag; | 202 | bool &cflag; | ||
203 | }; | 203 | }; | ||
204 | | ||||
205 | #endif // TESTUTILS_H | 204 | #endif // TESTUTILS_H |