1/* 2 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 3 * 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. 8 * 9 * This program 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. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this program; 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. 18 * 19 */ 20 21#ifndef qwebkittest_p_h 22#define qwebkittest_p_h 23 24#include "qwebkitglobal.h" 25#include "qquickwebview_p.h" 26 27#include <QtCore/QJsonObject> 28#include <QtCore/QObject> 29#include <QtCore/QPointer> 30#include <QtCore/QSize> 31#include <QtCore/QVariant> 32#include <QtQuick/qquickitem.h> 33 34class QQuickWebViewPrivate; 35 36class QWEBKIT_EXPORT QWebKitTest : public QObject { 37 Q_OBJECT 38 39 Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeChanged) 40 41 Q_PROPERTY(QVariant contentsScale READ contentsScale NOTIFY contentsScaleChanged) 42 43 Q_PROPERTY(QVariant devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged) 44 Q_PROPERTY(QJsonObject viewport READ viewport NOTIFY viewportChanged) 45 46Q_SIGNALS: 47 void contentsSizeChanged(); 48 void contentsScaleChanged(); 49 void contentsScaleCommitted(); 50 void devicePixelRatioChanged(); 51 void viewportChanged(); 52 53public Q_SLOTS: 54 bool touchTap(QObject* item, qreal x, qreal y, int delay = -1); 55 bool touchDoubleTap(QObject* item, qreal x, qreal y, int delay = -1); 56 bool wheelEvent(QObject* item, qreal x, qreal y, int delta, Qt::Orientation orient = Qt::Vertical); 57 58public: 59 QWebKitTest(QQuickWebViewPrivate* webviewPrivate, QObject* parent = 0); 60 virtual ~QWebKitTest(); 61 62 bool sendTouchEvent(QQuickWebView* window, QEvent::Type type, const QList<QTouchEvent::TouchPoint>& points, ulong timestamp); 63 64 QSize contentsSize() const; 65 QVariant contentsScale() const; 66 67 QVariant devicePixelRatio() const; 68 QJsonObject viewport() const; 69 70private: 71 QQuickWebViewPrivate* m_webViewPrivate; 72}; 73 74#endif // qwebkittest_p 75