24 #ifndef TEST_REGRESSION_H
25 #define TEST_REGRESSION_H
27 #include <katejscript.h>
31 #include <tqstringlist.h>
32 #include <kjs/ustring.h>
33 #include <kjs/object.h>
34 #include <kjs/interpreter.h>
54 TestJScriptEnv(KateDocument *part);
55 virtual ~TestJScriptEnv();
58 KJS::Object global()
const {
return *
m_global; }
64 KJS::Object view()
const {
return *
m_view; }
75 class KateViewObject :
public KJS::ObjectImp
78 KateViewObject(KJS::ExecState *exec, KateView *v, KJS::ObjectImp *fallback);
79 virtual ~KateViewObject();
81 virtual const KJS::ClassInfo *classInfo()
const;
82 virtual KJS::Value get(KJS::ExecState *exec,
const KJS::Identifier &propertyName)
const;
89 KJS::ObjectImp *fallback;
95 class KateViewFunction :
public KJS::ObjectImp
98 KateViewFunction(KJS::ExecState *exec, KateView *v,
int _id,
int length);
100 bool implementsCall()
const;
101 KJS::Value call(KJS::ExecState *exec, KJS::Object &thisObj,
const KJS::List &args);
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 };
125 OutputObject(KJS::ExecState *exec, KateDocument *d, KateView *v);
128 virtual KJS::UString className()
const;
130 void setChangedFlag(
bool *flag) { changed = flag; }
131 void setOutputString(TQString *s) { outstr = s; }
151 bool implementsCall()
const;
152 virtual KJS::Value call(KJS::ExecState *exec, KJS::Object &thisObj,
const KJS::List &args);
154 enum { Write, Writeln, WriteCursorPosition, WriteCursorPositionln };
163 class RegressionTest :
public TQObject
168 RegressionTest(KateDocument *part,
TDEConfig *baseConfig,
169 const TQString &baseDir,
const TQString &outputDir,
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 );
182 static void createMissingDirs(
const TQString &path);
184 void setFailureSnapshotConfig(
TDEConfig *cfg,
const TQString &snapshotname);
185 void setFailureSnapshotSaver(
TDEConfig *cfg,
const TQString &snapshotname);
187 void createLink(
const TQString& test,
int failures );
188 void doFailureReport(
const TQString& test,
int failures );
190 KateDocument *m_part;
194 TQString m_outputDir;
196 TQString m_currentBase;
200 TQString m_currentOutput;
201 TQString m_currentCategory;
202 TQString m_currentTest;
216 int m_known_failures;
217 bool m_outputCustomised;
218 TQString m_outputString;
220 static RegressionTest *curr;
223 void printDescription(
const TQString& description);
225 static bool svnIgnored(
const TQString &filename );
234 bool evalJS( KJS::Interpreter &interp,
const TQString &filename,
bool ignore =
false);
241 TQStringList concatListFiles(
const TQString &relPath,
const TQString &filename);
245 void resizeTopLevelWidget(
int,
int );
Whole Kate Part scripting in one classs Allow subclassing to allow specialized scripting engine for i...
KJS::Object * m_global
global object of interpreter
KJS::Interpreter * m_interpreter
js interpreter
KJS::Object * m_document
object for document
KJS::Object * m_view
object for view
Customizing output to result-files.
Customizing output to result-files.
KATEPARTINTERFACES_EXPORT Document * document(KTextEditor::Document *doc)
Check if given document is a Kate::Document.