2 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include <QtTest/QtTest>
22 #include <qtouchwebpage.h>
23 #include <qtouchwebview.h>
24 #include <qwebnavigationcontroller.h>
25 #include "../testwindow.h"
28 Q_DECLARE_METATYPE(QTouchWebPage*);
30 class tst_QTouchWebView : public QObject {
39 void navigationActionsStatusAtStartup();
42 inline QTouchWebView* webView() const;
43 QScopedPointer<TestWindow> m_window;
46 tst_QTouchWebView::tst_QTouchWebView()
48 addQtWebProcessToPath();
49 qRegisterMetaType<QTouchWebPage*>("QTouchWebPage*");
52 void tst_QTouchWebView::init()
54 m_window.reset(new TestWindow(new QTouchWebView));
57 void tst_QTouchWebView::cleanup()
62 inline QTouchWebView* tst_QTouchWebView::webView() const
64 return static_cast<QTouchWebView*>(m_window->webView.data());
67 void tst_QTouchWebView::accessPage()
69 QTouchWebPage* const pageDirectAccess = webView()->page();
71 QVariant pagePropertyValue = webView()->property("page");
72 QTouchWebPage* const pagePropertyAccess = pagePropertyValue.value<QTouchWebPage*>();
73 QCOMPARE(pagePropertyAccess, pageDirectAccess);
76 void tst_QTouchWebView::navigationActionsStatusAtStartup()
78 QAction* backAction = webView()->page()->navigationController()->backAction();
80 QCOMPARE(backAction->isEnabled(), false);
82 QAction* forwardAction = webView()->page()->navigationController()->forwardAction();
83 QVERIFY(forwardAction);
84 QCOMPARE(forwardAction->isEnabled(), false);
86 QAction* stopAction = webView()->page()->navigationController()->stopAction();
88 QCOMPARE(stopAction->isEnabled(), false);
90 QAction* reloadAction = webView()->page()->navigationController()->reloadAction();
91 QVERIFY(reloadAction);
92 QCOMPARE(reloadAction->isEnabled(), false);
96 QTEST_MAIN(tst_QTouchWebView)
98 #include "tst_qtouchwebview.moc"