BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
testFramework.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_WIDGETS_TESTFRAMEWORK_H
6 #define BALL_VIEW_WIDGETS_TESTFRAMEWORK_H
7 
8 #ifndef BALL_VIEW_WIDGETS_DOCKWIDGET_H
10 #endif
11 
12 #ifndef BALL_SYSTEM_FILE_H
13 # include <BALL/SYSTEM/file.h>
14 #endif
15 
16 #ifndef BALL_SYSTEM_TIMER_H
17 # include <BALL/SYSTEM/timer.h>
18 #endif
19 
20 #include <QtCore/QThread>
21 
22 class QAction;
23 
24 namespace BALL
25 {
26  namespace VIEW
27  {
59  : public QWidget,
60  public ModularWidget
61  {
62  Q_OBJECT
63 
65  : public QMouseEvent
66  {
67  public:
68 
69  MyMouseEvent(Type type, const QPoint & position, Qt::MouseButton button,
70  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
71  : QMouseEvent(type, position, button, buttons, modifiers) {}
72  };
73 
75  : public QThread
76  {
77  public:
78 
79  MyEventThread();
80 
81  virtual void run();
82 
85  };
86 
87  friend class MyEventThread;
88 
89  public:
90 
92 
93 
94  TestFramework(QWidget *parent = 0, const char *name = 0);
95 
97  virtual ~TestFramework();
98 
99  //
100  virtual void initializeWidget(MainControl& main_control);
101 
103  void setFilename(const String& filename);
104 
106  void checkMenu(MainControl& main_control);
107 
109  virtual bool canHandle(const String& fileformat) const;
110 
112  virtual bool openFile(const String& filename);
113 
114  public slots:
115 
117  void startTest();
118 
120  void stopTest();
121 
123  void runTest();
124 
126  void abortTest();
127 
129  void saveFile();
130 
132  void loadFile();
133 
135  virtual bool eventFilter(QObject*, QEvent* e);
136 
138  virtual void timeOut();
139 
141  void switchRecordMove();
142 
143  protected:
144 
145  virtual bool event(QEvent* e);
146 
147  void storeEvent(QEvent& e);
148 
149  void processEvent_();
150 
151  QAction* start_recording, *stop_recording, *run_test, *abort_test,
152  *save_file, *load_file, *switch_move;
153  QAction* action_;
154 
155  File outfile_;
156  File infile_;
157  String filename_;
158  Timer timer_, runtime_;
159  list<String>lines_;
160  QWidget* widget_, *last_widget_;
161  float time_;
162  bool event_busy_;
163  Index x_, y_;
164  int modifiers_, type_, our_type_, button_, buttons_;
165  bool test_running_, recording_;
166  String last_event_string_, last_names_, shortcut_;
167  String python_line_;
168  String expected_result_;
169  MyEventThread thread_;
170  Size errors_;
171  QEvent* last_event_;
172  bool is_command_line_;
173  float max_run_time_;
174  Position line_nr_;
175  };
176 
177 } } // namespaces
178 
179 #endif // BALL_VIEW_WIDGETS_TESTFRAMEWORK_H