• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • part
test_regression.h
1 
24 #ifndef TEST_REGRESSION_H
25 #define TEST_REGRESSION_H
26 
27 #include <katejscript.h>
28 #include <kateview.h>
29 #include <kurl.h>
30 #include <tqobject.h>
31 #include <tqstringlist.h>
32 #include <kjs/ustring.h>
33 #include <kjs/object.h>
34 #include <kjs/interpreter.h>
35 
36 class KateDocument;
37 class KateView;
38 class RegressionTest;
39 class TQTimer;
40 
41 namespace KParts {
42  class URLArgs;
43 }
44 
45 class OutputObject;
46 
51 class TestJScriptEnv : public KateJScript
52 {
53  public:
54  TestJScriptEnv(KateDocument *part);
55  virtual ~TestJScriptEnv();
56 
58  KJS::Object global() const { return *m_global; }
60  KJS::Interpreter &interpreter() { return *m_interpreter; }
62  KJS::Object document() const { return *m_document; }
64  KJS::Object view() const { return *m_view; }
66  OutputObject *output() const { return m_output; }
67 
68  protected:
69  OutputObject *m_output;
70 };
71 
75 class KateViewObject : public KJS::ObjectImp
76 {
77  public:
78  KateViewObject(KJS::ExecState *exec, KateView *v, KJS::ObjectImp *fallback);
79  virtual ~KateViewObject();
80 
81  virtual const KJS::ClassInfo *classInfo() const;
82  virtual KJS::Value get(KJS::ExecState *exec, const KJS::Identifier &propertyName) const;
83 
84  private:
85  // evil hack I: class layout of katejscript/KateJSView must be duplicated
86  // here, structurally as well as functionally
87  KateView *view;
88  // end evil hack
89  KJS::ObjectImp *fallback;
90 };
91 
95 class KateViewFunction : public KJS::ObjectImp
96 {
97  public:
98  KateViewFunction(KJS::ExecState *exec, KateView *v, int _id, int length);
99 
100  bool implementsCall() const;
101  KJS::Value call(KJS::ExecState *exec, KJS::Object &thisObj, const KJS::List &args);
102 
103  enum { KeyReturn, Type, Backspace, DeleteWordLeft, KeyDelete,
104  DeleteWordRight, Transpose, CursorLeft, ShiftCursorLeft, CursorRight,
105  ShiftCursorRight, WordLeft, ShiftWordLeft, WordRight, ShiftWordRight,
106  Home, ShiftHome, End, ShiftEnd, Up, ShiftUp, Down, ShiftDown, ScrollUp,
107  ScrollDown, TopOfView, ShiftTopOfView, BottomOfView, ShiftBottomOfView,
108  PageUp, ShiftPageUp, PageDown, ShiftPageDown, Top, ShiftTop, Bottom,
109  ShiftBottom, ToMatchingBracket, ShiftToMatchingBracket };
110  private:
111  KateView *m_view;
112  int id;
113 };
114 
115 class OutputFunction;
116 
122 class OutputObject : public KJS::ObjectImp
123 {
124  public:
125  OutputObject(KJS::ExecState *exec, KateDocument *d, KateView *v);
126  virtual ~OutputObject();
127 
128  virtual KJS::UString className() const;
129 
130  void setChangedFlag(bool *flag) { changed = flag; }
131  void setOutputString(TQString *s) { outstr = s; }
132 
133  private:
134  KateDocument *doc;
135  KateView *view;
136  bool *changed;
137  TQString *outstr;
138 
139  friend class OutputFunction;
140 };
141 
146 class OutputFunction : public KJS::ObjectImp
147 {
148  public:
149  OutputFunction(KJS::ExecState *exec, OutputObject *obj, int _id, int length);
150 
151  bool implementsCall() const;
152  virtual KJS::Value call(KJS::ExecState *exec, KJS::Object &thisObj, const KJS::List &args);
153 
154  enum { Write, Writeln, WriteCursorPosition, WriteCursorPositionln };
155  private:
156  OutputObject *o;
157  int id;
158 };
159 
163 class RegressionTest : public TQObject
164 {
165  TQ_OBJECT
166 public:
167 
168  RegressionTest(KateDocument *part, TDEConfig *baseConfig,
169  const TQString &baseDir, const TQString &outputDir,
170  bool _genOutput);
171  ~RegressionTest();
172 
173  enum OutputType { ResultDocument };
174  void testStaticFile(const TQString& filename, const TQStringList &commands);
175  enum CheckResult { Failure = 0, Success = 1, Ignored = 2 };
176  CheckResult checkOutput(const TQString& againstFilename);
177  enum FailureType { NoFailure = 0, AllFailure = 1, ResultFailure = 4, NewFailure = 65536 };
178  bool runTests(TQString relPath = TQString::null, bool mustExist = false, int known_failure = NoFailure);
179  bool reportResult( bool passed, const TQString & description = TQString::null, bool *newfailure = 0 );
180  bool reportResult(CheckResult result, const TQString & description = TQString::null, bool *newfailure = 0 );
181  void rereadConfig();
182  static void createMissingDirs(const TQString &path);
183 
184  void setFailureSnapshotConfig(TDEConfig *cfg, const TQString &snapshotname);
185  void setFailureSnapshotSaver(TDEConfig *cfg, const TQString &snapshotname);
186 
187  void createLink( const TQString& test, int failures );
188  void doFailureReport( const TQString& test, int failures );
189 
190  KateDocument *m_part;
191  KateView *m_view;
192  TDEConfig *m_baseConfig;
193  TQString m_baseDir;
194  TQString m_outputDir;
195  bool m_genOutput;
196  TQString m_currentBase;
197  TDEConfig *m_failureComp;
198  TDEConfig *m_failureSave;
199 
200  TQString m_currentOutput;
201  TQString m_currentCategory;
202  TQString m_currentTest;
203 
204  bool m_keepOutput;
205  bool m_getOutput;
206  bool m_showGui;
207  int m_passes_work;
208  int m_passes_fail;
209  int m_passes_new;
210  int m_failures_work;
211  int m_failures_fail;
212  int m_failures_new;
213  int m_errors;
214  bool saw_failure;
215  bool ignore_errors;
216  int m_known_failures;
217  bool m_outputCustomised;
218  TQString m_outputString;
219 
220  static RegressionTest *curr;
221 
222 private:
223  void printDescription(const TQString& description);
224 
225  static bool svnIgnored( const TQString &filename );
226 
227 private:
234  bool evalJS( KJS::Interpreter &interp, const TQString &filename, bool ignore = false);
241  TQStringList concatListFiles(const TQString &relPath, const TQString &filename);
242 
243 private slots:
244  void slotOpenURL(const KURL &url, const KParts::URLArgs &args);
245  void resizeTopLevelWidget( int, int );
246 
247 };
248 
249 #endif
KURL
KateJScript
Whole Kate Part scripting in one classs Allow subclassing to allow specialized scripting engine for i...
Definition: katejscript.h:53
KateJScript::m_global
KJS::Object * m_global
global object of interpreter
Definition: katejscript.h:96
KateJScript::m_interpreter
KJS::Interpreter * m_interpreter
js interpreter
Definition: katejscript.h:101
KateJScript::m_document
KJS::Object * m_document
object for document
Definition: katejscript.h:106
KateJScript::m_view
KJS::Object * m_view
object for view
Definition: katejscript.h:111
OutputFunction
Customizing output to result-files.
Definition: test_regression.h:147
OutputObject
Customizing output to result-files.
Definition: test_regression.h:123
TDEConfig
Kate::document
KATEPARTINTERFACES_EXPORT Document * document(KTextEditor::Document *doc)
Check if given document is a Kate::Document.
Definition: interfaces.cpp:98
KParts::URLArgs

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.1
This website is maintained by Timothy Pearson.