From c896cc340d7e6e0878b3249c5792e6d88a12cf42 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 30 Apr 2010 11:23:37 +0200 Subject: A coding style round --- src/tests/findbar_test.cpp | 8 +++---- src/tests/mainview_test.cpp | 42 ++++++++++++++++----------------- src/tests/mainwindow_test.cpp | 6 ++--- src/tests/networkaccessmanager_test.cpp | 10 ++++---- src/tests/protocolhandler_test.cpp | 42 ++++++++++++++++----------------- src/tests/sessionmanager_test.cpp | 10 ++++---- src/tests/tabbar_test.cpp | 38 ++++++++++++++++++----------- src/tests/urlbar_test.cpp | 10 ++++---- src/tests/walletbar_test.cpp | 10 ++++---- src/tests/webpage_test.cpp | 14 +++++------ src/tests/websnap_test.cpp | 10 ++++---- src/tests/webtab_test.cpp | 8 +++---- src/tests/webview_test.cpp | 10 ++++---- 13 files changed, 114 insertions(+), 104 deletions(-) (limited to 'src/tests') diff --git a/src/tests/findbar_test.cpp b/src/tests/findbar_test.cpp index a79f44a2..c9555441 100644 --- a/src/tests/findbar_test.cpp +++ b/src/tests/findbar_test.cpp @@ -31,11 +31,11 @@ class FindBarTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: void matchCase(); void notifyMatch(); @@ -60,10 +60,10 @@ void FindBarTest::cleanupTestCase() { delete bar; } - + void FindBarTest::matchCase() { - + } void FindBarTest::notifyMatch() diff --git a/src/tests/mainview_test.cpp b/src/tests/mainview_test.cpp index 596ac4e1..d32eb58f 100644 --- a/src/tests/mainview_test.cpp +++ b/src/tests/mainview_test.cpp @@ -11,9 +11,9 @@ * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy +* by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. -* +* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -47,31 +47,31 @@ public slots: private slots: void tabwidget_data(); void tabwidget(); - + void closeTab_data(); void closeTab(); - + void currentWebView_data(); void currentWebView(); - + void newTab_data(); void newTab(); - + void nextTab_data(); void nextTab(); - + void previousTab_data(); void previousTab(); - + void recentlyClosedTabs_data(); void recentlyClosedTabs(); - + void setCurrentTitle_data(); void setCurrentTitle(const QString &); - + void showStatusBarMessage_data(); void showStatusBarMessage(const QString &); - + void currentChanged_data(); void currentChanged(); @@ -108,13 +108,13 @@ void MainViewTest::tabwidget_data() void MainViewTest::tabwidget() { QCOMPARE(view->currentIndex(), -1); - -// view->newTab(); -// QCOMPARE(view->currentIndex(), 1); + +// view->newTab(); +// QCOMPARE(view->currentIndex(), 1); // view->newTab(); // view->nextTab(); // QCOMPARE(view->currentIndex(), 0); -// +// // view->previousTab(); // QCOMPARE(view->currentIndex(), 0); } @@ -131,18 +131,18 @@ void MainViewTest::closeTab_data() void MainViewTest::closeTab() { // QFETCH(int, index); -// +// // QSignalSpy spy1(view, SIGNAL(linkHovered(const QString &))); // QSignalSpy spy2(view, SIGNAL(setCurrentTitle(const QString &))); // QSignalSpy spy3(view, SIGNAL(tabsChanged())); // QSignalSpy spy4(view, SIGNAL(lastTabClosed())); -// +// // view->newTab(); // view->closeTab(index); // view->newTab(); // view->closeTab(index); // view->newTab(); -// +// // QCOMPARE(spy1.count(), 0); // QCOMPARE(spy2.count(), 2); // QCOMPARE(spy3.count(), 0); @@ -197,15 +197,15 @@ void MainViewTest::newTab_data() void MainViewTest::newTab() { // QFETCH(int, foo); -// +// // QSignalSpy spy0(view, SIGNAL(linkHovered(const QString &))); // QSignalSpy spy1(view, SIGNAL(setCurrentTitle(const QString &))); // QSignalSpy spy2(view, SIGNAL(showStatusBarMessage(const QString &))); // QSignalSpy spy3(view, SIGNAL(tabsChanged())); // QSignalSpy spy4(view, SIGNAL(lastTabClosed())); -// +// // view->newTab(); -// +// // QCOMPARE(spy0.count(), 0); // QCOMPARE(spy1.count(), 0); // QCOMPARE(spy2.count(), 0); diff --git a/src/tests/mainwindow_test.cpp b/src/tests/mainwindow_test.cpp index d3ab6bef..af3a2aa2 100644 --- a/src/tests/mainwindow_test.cpp +++ b/src/tests/mainwindow_test.cpp @@ -32,11 +32,11 @@ class MainWindowTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: @@ -61,5 +61,5 @@ void MainWindowTest::cleanupTestCase() // ------------------------------------------- -QTEST_KDEMAIN(MainWindowTest,GUI) +QTEST_KDEMAIN(MainWindowTest, GUI) #include "mainwindow_test.moc" diff --git a/src/tests/networkaccessmanager_test.cpp b/src/tests/networkaccessmanager_test.cpp index ac6cf89e..28b05075 100644 --- a/src/tests/networkaccessmanager_test.cpp +++ b/src/tests/networkaccessmanager_test.cpp @@ -31,11 +31,11 @@ class NetworkAccessManagerTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: private: @@ -55,13 +55,13 @@ void NetworkAccessManagerTest::cleanupTestCase() { delete manager; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(NetworkAccessManagerTest,GUI) +QTEST_KDEMAIN(NetworkAccessManagerTest, GUI) #include "networkaccessmanager_test.moc" diff --git a/src/tests/protocolhandler_test.cpp b/src/tests/protocolhandler_test.cpp index a3c78c2f..dbf33684 100644 --- a/src/tests/protocolhandler_test.cpp +++ b/src/tests/protocolhandler_test.cpp @@ -33,18 +33,18 @@ class ProtocolhandlerTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: void preHandling_data(); void preHandling(); void postHandling_data(); void postHandling(); - + private: ProtocolHandler *handler; }; @@ -62,8 +62,8 @@ void ProtocolhandlerTest::cleanupTestCase() { delete handler; } - - + + // ------------------------------------------- @@ -71,7 +71,7 @@ void ProtocolhandlerTest::preHandling_data() { QTest::addColumn("urlString"); QTest::addColumn("result"); - + QTest::newRow("mailto") << "mailto:me@here.com" << true ; QTest::newRow("relative") << "google.it" << false ; QTest::newRow("javascript") << "javascript:alertbox('hello')" << true ; @@ -84,15 +84,15 @@ void ProtocolhandlerTest::preHandling_data() void ProtocolhandlerTest::preHandling() { - QFETCH( QString, urlString ); - QFETCH( bool , result ); - + QFETCH(QString, urlString); + QFETCH(bool , result); + QWebView *view = new QWebView; QWebFrame *frame = view->page()->mainFrame(); - - QNetworkRequest request = QNetworkRequest( QUrl(urlString) ); - QCOMPARE( handler->preHandling( request, frame ) , result ); + QNetworkRequest request = QNetworkRequest(QUrl(urlString)); + + QCOMPARE(handler->preHandling(request, frame) , result); } @@ -100,7 +100,7 @@ void ProtocolhandlerTest::postHandling_data() { QTest::addColumn("urlString"); QTest::addColumn("result"); - + QTest::newRow("mailto") << "mailto:me@here.com" << true ; QTest::newRow("relative") << "google.it" << false ; QTest::newRow("javascript") << "javascript:alertbox('hello')" << false ; @@ -113,18 +113,18 @@ void ProtocolhandlerTest::postHandling_data() void ProtocolhandlerTest::postHandling() { - QFETCH( QString, urlString ); - QFETCH( bool , result ); - + QFETCH(QString, urlString); + QFETCH(bool , result); + QWebView *view = new QWebView; QWebFrame *frame = view->page()->mainFrame(); - - QNetworkRequest request = QNetworkRequest( QUrl(urlString) ); - QCOMPARE( handler->postHandling( request, frame ) , result ); + QNetworkRequest request = QNetworkRequest(QUrl(urlString)); + + QCOMPARE(handler->postHandling(request, frame) , result); } - + // ------------------------------------------- -QTEST_KDEMAIN(ProtocolhandlerTest,GUI) +QTEST_KDEMAIN(ProtocolhandlerTest, GUI) #include "protocolhandler_test.moc" diff --git a/src/tests/sessionmanager_test.cpp b/src/tests/sessionmanager_test.cpp index e3e1b329..bb784219 100644 --- a/src/tests/sessionmanager_test.cpp +++ b/src/tests/sessionmanager_test.cpp @@ -32,11 +32,11 @@ class SessionManagerTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: private: @@ -57,13 +57,13 @@ void SessionManagerTest::cleanupTestCase() { delete sessman; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(SessionManagerTest,GUI) +QTEST_KDEMAIN(SessionManagerTest, GUI) #include "sessionmanager_test.moc" diff --git a/src/tests/tabbar_test.cpp b/src/tests/tabbar_test.cpp index 560f2c9b..6df38657 100644 --- a/src/tests/tabbar_test.cpp +++ b/src/tests/tabbar_test.cpp @@ -35,23 +35,33 @@ class SubTabBar : public TabBar { public: - + SubTabBar(QWidget *parent) : TabBar(parent) {}; QSize call_tabSizeHint(int index) const - { return SubTabBar::tabSizeHint(index); } - + { + return SubTabBar::tabSizeHint(index); + } + void call_mouseMoveEvent(QMouseEvent* event) - { return SubTabBar::mouseMoveEvent(event); } - + { + return SubTabBar::mouseMoveEvent(event); + } + void call_leaveEvent(QEvent* event) - { return SubTabBar::leaveEvent(event); } - + { + return SubTabBar::leaveEvent(event); + } + void call_mousePressEvent(QMouseEvent* event) - { return SubTabBar::mousePressEvent(event); } - + { + return SubTabBar::mousePressEvent(event); + } + void call_mouseReleaseEvent(QMouseEvent* event) - { return SubTabBar::mouseReleaseEvent(event); } + { + return SubTabBar::mouseReleaseEvent(event); + } }; @@ -65,14 +75,14 @@ class TabBarTest : public QObject public slots: void initTestCase(); void cleanupTestCase(); - + private slots: void tabSizeHint_data(); void tabSizeHint(); - + void mousePress_data(); void mousePress(); - + private: SubTabBar *_bar; }; @@ -128,7 +138,7 @@ void TabBarTest::mousePress() { // QTest::mousePress(_bar, Qt::MidButton); // // QCOMPARE(); ? -// +// // QTest::mousePress(_bar, Qt::LeftButton); // // QCOMPARE(); ? } diff --git a/src/tests/urlbar_test.cpp b/src/tests/urlbar_test.cpp index 7a1fb40b..fc7c1718 100644 --- a/src/tests/urlbar_test.cpp +++ b/src/tests/urlbar_test.cpp @@ -35,11 +35,11 @@ class UrlBarTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: private: @@ -62,13 +62,13 @@ void UrlBarTest::cleanupTestCase() delete bar; delete tab; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(UrlBarTest,GUI) +QTEST_KDEMAIN(UrlBarTest, GUI) #include "urlbar_test.moc" diff --git a/src/tests/walletbar_test.cpp b/src/tests/walletbar_test.cpp index ec9c3559..d4036981 100644 --- a/src/tests/walletbar_test.cpp +++ b/src/tests/walletbar_test.cpp @@ -31,11 +31,11 @@ class WalletBarTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: private: @@ -57,13 +57,13 @@ void WalletBarTest::cleanupTestCase() { delete bar; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(WalletBarTest,GUI) +QTEST_KDEMAIN(WalletBarTest, GUI) #include "walletbar_test.moc" diff --git a/src/tests/webpage_test.cpp b/src/tests/webpage_test.cpp index 3051b8bf..c06ce7a5 100644 --- a/src/tests/webpage_test.cpp +++ b/src/tests/webpage_test.cpp @@ -34,11 +34,11 @@ class WebPageTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: void manageNetworkErrors(); void downloadRequest(); @@ -46,9 +46,9 @@ private slots: void createWindow(); void acceptNavigationRequest(); - + void handleUnsupportedContent(); - + void loadFinished(); private: @@ -73,8 +73,8 @@ void WebPageTest::cleanupTestCase() { delete tab; } - - + + // ------------------------------------------- @@ -108,5 +108,5 @@ void WebPageTest::loadFinished() // ------------------------------------------- -QTEST_KDEMAIN(WebPageTest,GUI) +QTEST_KDEMAIN(WebPageTest, GUI) #include "webpage_test.moc" diff --git a/src/tests/websnap_test.cpp b/src/tests/websnap_test.cpp index 53fc1d4f..1bfb440d 100644 --- a/src/tests/websnap_test.cpp +++ b/src/tests/websnap_test.cpp @@ -33,11 +33,11 @@ class WebSnapTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: private: @@ -57,13 +57,13 @@ void WebSnapTest::cleanupTestCase() { delete snap; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(WebSnapTest,GUI) +QTEST_KDEMAIN(WebSnapTest, GUI) #include "websnap_test.moc" diff --git a/src/tests/webtab_test.cpp b/src/tests/webtab_test.cpp index 2c6edf35..0e5833b4 100644 --- a/src/tests/webtab_test.cpp +++ b/src/tests/webtab_test.cpp @@ -34,7 +34,7 @@ class WebTabTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); @@ -57,12 +57,12 @@ void WebTabTest::cleanupTestCase() { delete tab; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(WebTabTest,GUI) +QTEST_KDEMAIN(WebTabTest, GUI) #include "webtab_test.moc" diff --git a/src/tests/webview_test.cpp b/src/tests/webview_test.cpp index 11d1a46c..7eb968c7 100644 --- a/src/tests/webview_test.cpp +++ b/src/tests/webview_test.cpp @@ -33,11 +33,11 @@ class WebViewTest : public QObject { Q_OBJECT - + public slots: void initTestCase(); void cleanupTestCase(); - + private slots: private: @@ -60,12 +60,12 @@ void WebViewTest::cleanupTestCase() { delete tab; } - - + + // ------------------------------------------- // ------------------------------------------- -QTEST_KDEMAIN(WebViewTest,GUI) +QTEST_KDEMAIN(WebViewTest, GUI) #include "webview_test.moc" -- cgit v1.2.1