|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
5 ** |
|
6 ** This file is part of the examples of the Qt Toolkit. |
|
7 ** |
|
8 ** $QT_BEGIN_LICENSE:LGPL$ |
|
9 ** No Commercial Usage |
|
10 ** This file contains pre-release code and may not be distributed. |
|
11 ** You may use this file in accordance with the terms and conditions |
|
12 ** contained in the either Technology Preview License Agreement or the |
|
13 ** Beta Release License Agreement. |
|
14 ** |
|
15 ** GNU Lesser General Public License Usage |
|
16 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
17 ** General Public License version 2.1 as published by the Free Software |
|
18 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
19 ** packaging of this file. Please review the following information to |
|
20 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
21 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
22 ** |
|
23 ** In addition, as a special exception, Nokia gives you certain |
|
24 ** additional rights. These rights are described in the Nokia Qt LGPL |
|
25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this |
|
26 ** package. |
|
27 ** |
|
28 ** GNU General Public License Usage |
|
29 ** Alternatively, this file may be used under the terms of the GNU |
|
30 ** General Public License version 3.0 as published by the Free Software |
|
31 ** Foundation and appearing in the file LICENSE.GPL included in the |
|
32 ** packaging of this file. Please review the following information to |
|
33 ** ensure the GNU General Public License version 3.0 requirements will be |
|
34 ** met: http://www.gnu.org/copyleft/gpl.html. |
|
35 ** |
|
36 ** If you are unsure which license is appropriate for your use, please |
|
37 ** contact the sales department at http://qt.nokia.com/contact. |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef TESTTHREAD_H |
|
43 #define TESTTHREAD_H |
|
44 |
|
45 #include <QThread> |
|
46 #include <QMutex> |
|
47 #include <QWaitCondition> |
|
48 #include <QScriptable> |
|
49 |
|
50 #include "testcontroller.h" |
|
51 |
|
52 class QApplication; |
|
53 |
|
54 class TestThread : public QThread, protected QScriptable |
|
55 { |
|
56 Q_OBJECT |
|
57 public: |
|
58 virtual ~TestThread(); |
|
59 |
|
60 Q_PROPERTY(TestController *mController READ controller WRITE setController) |
|
61 Q_PROPERTY(ResultLogger *mResultLogger READ resultLogger WRITE setResultLogger) |
|
62 |
|
63 void addTestFunctionBenchmark(const QString &functionName, const QString &benchmarkTag, const qreal value); |
|
64 |
|
65 public slots: |
|
66 void setController(TestController *controller); |
|
67 TestController* controller() const; |
|
68 void setResultLogger(ResultLogger *logger); |
|
69 ResultLogger* resultLogger() const; |
|
70 |
|
71 // These are available to test script |
|
72 void fillListTest(int itemCount, int listType, TestFunctionResult *testFunctionResult, const QString &tag); |
|
73 void deleteListTest(TestFunctionResult *testFunctionResult, const QString &tag); |
|
74 void scrollListTest(int scrollMaxTime, TestFunctionResult *testFunctionResult, const QString &tag); |
|
75 void addToBeginningOfListTest(int itemCount, TestFunctionResult *testFunctionResult, const QString &tag); |
|
76 void removeFromBeginningOfListTest(int itemCount, TestFunctionResult *testFunctionResult, const QString &tag); |
|
77 void forceUpdateTest(int updateMaxTime, TestFunctionResult *testFunctionResult, const QString &tag); |
|
78 void themeChangeTest(int theme, TestFunctionResult *testFunctionResult, const QString &tag); |
|
79 |
|
80 int themeCount() const; |
|
81 void setTheme(int index); |
|
82 int currentThemeId() const; |
|
83 QString currentThemeName() const; |
|
84 QString themeName(int theme) const; |
|
85 void setImageBasedRendering(const bool imageBasedRendering); |
|
86 void setSubtreeCache(const bool enabled); |
|
87 void setScrollStep(const int step); |
|
88 bool imageBasedRendering() const; |
|
89 bool subtreeCache() const; |
|
90 int scrollStep() const; |
|
91 void rotateMainWindow(const int angle); |
|
92 int mainWindowRotationAngle() const; |
|
93 void setTwoColumns(const bool twoCols); |
|
94 bool twoColumns() const; |
|
95 |
|
96 signals: |
|
97 void fillList(int itemCount, Benchmark::ListType listType, TestFunctionResult *testFunctionResult, const QString &tag); |
|
98 void deleteList(TestFunctionResult *testFunctionResult, const QString &tag); |
|
99 void themeChange(int theme, TestFunctionResult *testFunctionResult, const QString &tag); |
|
100 void scrollList(int maxTimeMs, TestFunctionResult *testFunctionResult, const QString &tag); |
|
101 void forceUpdate(int maxTimeMs, TestFunctionResult *testFunctionResult, const QString &tag); |
|
102 void addToBeginningOfList(int itemCount, TestFunctionResult *testFunctionResult, const QString &tag); |
|
103 void removeFromBeginningOfList(int itemCount, TestFunctionResult *testFunctionResult, const QString &tag); |
|
104 void doRotateMainWindow(int); |
|
105 void doSetTwoColumns(bool); |
|
106 void changeTheme(Theme::Themes theme); |
|
107 |
|
108 protected slots: |
|
109 void stop(); |
|
110 |
|
111 protected: |
|
112 TestThread(TestController *ctrl, QObject *parent=0); |
|
113 |
|
114 bool m_doExit; |
|
115 //QApplication *mApplication; |
|
116 ResultLogger *m_resultLogger; |
|
117 |
|
118 private slots: |
|
119 void testDone(); |
|
120 |
|
121 private: |
|
122 Q_DISABLE_COPY(TestThread) |
|
123 |
|
124 QMutex m_mutex; |
|
125 QWaitCondition m_waitCondition; |
|
126 TestController *m_controller; |
|
127 }; |
|
128 |
|
129 #endif // TESTTHREAD_H |