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 <QGraphicsScene>
22 #include <QGraphicsView>
23 #include <QResizeEvent>
25 #include <QtTest/QtTest>
26 #include <qgraphicswkview.h>
27 #include <qwkcontext.h>
31 class tst_QGraphicsWKView : public QObject {
44 class View : public QGraphicsView {
47 QGraphicsWKView* m_webView;
50 void resizeEvent(QResizeEvent*);
55 QGraphicsScene* const scene = new QGraphicsScene(this);
58 QWKContext* context = new QWKContext(this);
59 m_webView = new QGraphicsWKView(context);
60 scene->addItem(m_webView);
63 void View::resizeEvent(QResizeEvent* event)
65 QGraphicsView::resizeEvent(event);
66 QRectF rect(QPoint(0, 0), event->size());
67 m_webView->setGeometry(rect);
68 scene()->setSceneRect(rect);
71 void tst_QGraphicsWKView::init()
76 void tst_QGraphicsWKView::cleanup()
82 void tst_QGraphicsWKView::loadEmptyPage()
86 m_view->m_webView-> load(QUrl::fromLocalFile(TESTDIR "/html/basic_page.html"));
87 QVERIFY(waitForSignal(m_view->m_webView, SIGNAL(loadFinished(bool))));
90 QTEST_MAIN(tst_QGraphicsWKView)
92 #include "tst_qgraphicswkview.moc"