Skip to content

Commit 37c74e4

Browse files
Andrii MorozAndrii Moroz
authored andcommitted
Added widgest for native tests
1 parent f2303fd commit 37c74e4

File tree

5 files changed

+95
-0
lines changed

5 files changed

+95
-0
lines changed

src/Test/ClickTest.cc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* ClickTest.cc
2+
*/
3+
4+
#include "ClickTest.h"
5+
6+
static const QString WINDOW_TITLE = "CLick Test Window";
7+
8+
ClickTestWidget::ClickTestWidget()
9+
{
10+
connect(&(this->normalBtn), SIGNAL(clicked()), this, SLOT(OnNormalBtnClick()));
11+
connect(&(this->checkBox), SIGNAL(clicked()), this, SLOT(OnCheckBoxClick()));
12+
connect(&(this->btnOnScroolArea), SIGNAL(clicked()), this, SLOT(OnBtnOnScrollClick()));
13+
14+
this->normalBtn.setObjectName("pushBtn");
15+
this->checkBox.setObjectName("checkBox");
16+
this->btnOnScroolArea.setObjectName("btnOnScroll");
17+
this->scrollArea.setViewport(&btnOnScroolArea);
18+
19+
this->setWindowTitle("ClickTest");
20+
}
21+
22+
ClickTestWidget::~ClickTestWidget()
23+
{}
24+
25+
void ClickTestWidget::OnNormalBtnClick()
26+
{
27+
this->setWindowTitle(WINDOW_TITLE);
28+
}
29+
30+
void ClickTestWidget::OnCheckBoxClick()
31+
{
32+
if (checkBox.isChecked())
33+
this->setWindowTitle(WINDOW_TITLE);
34+
}
35+
36+
void ClickTestWidget::OnBtnOnScrollClick()
37+
{
38+
this->setWindowTitle(WINDOW_TITLE);
39+
}

src/Test/ClickTest.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* ClickTest.h
2+
*/
3+
4+
#ifndef CLICKTEST_H
5+
#define CLICKTEST_H
6+
7+
#include <QtGui/QWidget>
8+
#include <QtGui/QPushButton>
9+
#include <QtGui/QCheckBox>
10+
#include <QtGui/QScrollArea>
11+
12+
class ClickTestWidget : public QWidget
13+
{
14+
public:
15+
ClickTestWidget();
16+
~ClickTestWidget();
17+
18+
private slots:
19+
void OnNormalBtnClick();
20+
void OnCheckBoxClick();
21+
void OnBtnOnScrollClick();
22+
23+
private:
24+
QPushButton normalBtn;
25+
QCheckBox checkBox;
26+
QScrollArea scrollArea;
27+
QPushButton btnOnScroolArea;
28+
};
29+
30+
#endif // CLICKTEST_H

src/Test/WindowTest.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* WindowTest.cc
2+
*/
3+
4+
#include "WindowTest.h"
5+
6+
WindowTestWidget::WindowTestWidget()
7+
{}
8+
9+
WindowTestWidget::~WindowTestWidget()
10+
{}

src/Test/WindowTest.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* WindowTest.h
2+
*/
3+
4+
#include <QtGui/QWidget>
5+
6+
class WindowTestWidget : public QWidget
7+
{
8+
public:
9+
WindowTestWidget();
10+
~WindowTestWidget();
11+
};

src/Test/main.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include <QtGui/QApplication>
1515

1616
#include <QtWebKit/QtWebKit>
17+
18+
#include "WindowTest.h"
19+
#include "ClickTest.h"
1720
#endif
1821

1922
#include <QtWebkitWebDriver.h>
@@ -41,6 +44,8 @@ int main(int argc, char *argv[])
4144

4245
registerView<QWebView>("QWebView");
4346
registerView<QWidget>("QWidget");
47+
registerView<WindowTestWidget>("WindowTestWidget");
48+
registerView<ClickTestWidget>("ClickTestWidget");
4449

4550
QFutureWatcher<int> watcher;
4651
QObject::connect(&watcher, SIGNAL(finished()), qApp, SLOT(quit()));

0 commit comments

Comments
 (0)