summaryrefslogtreecommitdiff
path: root/src/tests/mainview_test.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-27 15:29:58 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-27 15:29:58 +0100
commit0f1dfeac60cdf35e44838b1323d98db8383738c7 (patch)
tree7f01671350c421a8bb82ec17d57c6afeda26b367 /src/tests/mainview_test.cpp
parenttests support for every Qt derived rekonq class (diff)
downloadrekonq-0f1dfeac60cdf35e44838b1323d98db8383738c7.tar.xz
New (embrional) unit tests: mainview, tabbar, webtab, webpage
Diffstat (limited to 'src/tests/mainview_test.cpp')
-rw-r--r--src/tests/mainview_test.cpp47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/tests/mainview_test.cpp b/src/tests/mainview_test.cpp
index f56d73ab..1dfffcbe 100644
--- a/src/tests/mainview_test.cpp
+++ b/src/tests/mainview_test.cpp
@@ -31,8 +31,21 @@
#include <QtCore>
#include <QtGui>
-#include "../mainview.h"
-#include "../webview.h"
+#include "mainview.h"
+#include "webview.h"
+
+
+// Subclass that exposes the protected functions.
+class SubMainView : public MainView
+{
+public:
+ SubMainView(MainWindow *parent) : MainView(parent) {};
+
+ void call_resizeEvent(QResizeEvent *event)
+ { return SubMainView::resizeEvent(event); }
+};
+
+// -----------------------------------------------------------
class MainViewTest : public QObject
@@ -42,8 +55,6 @@ class MainViewTest : public QObject
public slots:
void initTestCase();
void cleanupTestCase();
- void init();
- void cleanup();
private slots:
void tabwidget_data();
@@ -75,38 +86,30 @@ private slots:
void currentChanged_data();
void currentChanged();
+
+private:
+ MainWindow *mainWindow;
+ SubMainView *mainView;
};
-// Subclass that exposes the protected functions.
-class SubMainView : public MainView
-{
-public:
- void call_resizeEvent(QResizeEvent *event)
- { return SubMainView::resizeEvent(event); }
-};
+// -------------------------------------------------------------------------------
// This will be called before the first test function is executed.
// It is only called once.
void MainViewTest::initTestCase()
{
+ mainWindow = new MainWindow;
+ mainView = new SubMainView(mainWindow);
}
// This will be called after the last test function is executed.
// It is only called once.
void MainViewTest::cleanupTestCase()
{
-}
-
-// This will be called before each test function is executed.
-void MainViewTest::init()
-{
-}
-
-// This will be called after every test function.
-void MainViewTest::cleanup()
-{
+ delete mainView;
+ delete mainWindow;
}
// -------------------------------------------
@@ -117,7 +120,6 @@ void MainViewTest::tabwidget_data()
void MainViewTest::tabwidget()
{
- SubMainView widget;
// widget.currentWebView();
// QCOMPARE(widget.currentIndex(), 0);
// widget.newTab();
@@ -140,7 +142,6 @@ void MainViewTest::closeTab()
{
QFETCH(int, index);
- SubMainView widget;
/*
QSignalSpy spy0(&widget, SIGNAL(linkHovered(const QString &)));
QSignalSpy spy3(&widget, SIGNAL(setCurrentTitle(const QString &)));