BALL  1.5.0
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 
64  class MyMouseEvent
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 
74  class MyEventThread
75  : public QThread
76  {
77  public:
78 
79  MyEventThread();
80 
81  virtual void run();
82 
83  TestFramework* tf;
84  MainControl* mc;
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 Q_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 
158  Timer timer_, runtime_;
159  list<String>lines_;
160  QWidget* widget_, *last_widget_;
161  float time_;
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_;
169  MyEventThread thread_;
175  };
176 
177 } } // namespaces
178 
179 #endif // BALL_VIEW_WIDGETS_TESTFRAMEWORK_H
BALL::VIEW::TestFramework::infile_
File infile_
Definition: testFramework.h:156
BALL_INDEX_TYPE
BALL::VIEW::TestFramework::event_busy_
bool event_busy_
Definition: testFramework.h:162
BALL::VIEW::TestFramework::shortcut_
String shortcut_
Definition: testFramework.h:166
BALL::VIEW::TestFramework::expected_result_
String expected_result_
Definition: testFramework.h:168
BALL::VIEW::TestFramework::y_
Index y_
Definition: testFramework.h:163
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
BALL::VIEW::TestFramework::test_running_
bool test_running_
Definition: testFramework.h:165
timer.h
QWidget
dockWidget.h
BALL_SIZE_TYPE
BALL::VIEW::TestFramework::python_line_
String python_line_
Definition: testFramework.h:167
QThread
BALL_EMBEDDABLE
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
BALL::VIEW::TestFramework::switch_move
QAction * switch_move
Definition: testFramework.h:151
BALL::VIEW::TestFramework
Definition: testFramework.h:58
file.h
QObject
BALL::VIEW::DockWidget
Definition: dockWidget.h:25
BALL
Definition: constants.h:12
BALL::VIEW::TestFramework::last_event_
QEvent * last_event_
Definition: testFramework.h:171
BALL::String
Definition: string.h:56
BALL::VIEW::TestFramework::widget_
QWidget * widget_
Definition: testFramework.h:160
BALL::VIEW::MainControl
Definition: mainControl.h:114
BALL::VIEW::TestFramework::type_
int type_
Definition: testFramework.h:164
BALL::VIEW::TestFramework::lines_
list< String > lines_
Definition: testFramework.h:159
BALL::VIEW::TestFramework::outfile_
File outfile_
Definition: testFramework.h:155
BALL::VIEW::TestFramework::time_
float time_
Definition: testFramework.h:161
BALL::VIEW::TestFramework::thread_
MyEventThread thread_
Definition: testFramework.h:169
BALL::Timer
Definition: timer.h:30
QMouseEvent
BALL::VIEW::TestFramework::is_command_line_
bool is_command_line_
Definition: testFramework.h:172
BALL::VIEW::TestFramework::filename_
String filename_
Definition: testFramework.h:157
BALL::VIEW::TestFramework::timer_
Timer timer_
Definition: testFramework.h:158
BALL::VIEW::ModularWidget
Definition: modularWidget.h:60
BALL::File
Definition: file.h:134
BALL::VIEW::TestFramework::line_nr_
Position line_nr_
Definition: testFramework.h:174
BALL::VIEW::TestFramework::action_
QAction * action_
Definition: testFramework.h:153
BALL::VIEW::TestFramework::errors_
Size errors_
Definition: testFramework.h:170
BALL::VIEW::TestFramework::max_run_time_
float max_run_time_
Definition: testFramework.h:173
QEvent