From 4aa6a63f0f77a86f1af7c2e25b92b4d0ed92a267 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 13 Nov 2009 15:20:33 +1000 Subject: WebView tests and testability. --- src/declarative/graphicsitems/graphicsitems.pri | 1 + .../graphicsitems/qmlgraphicswebview.cpp | 96 +- .../graphicsitems/qmlgraphicswebview_p_p.h | 150 ++ .../qmlgraphicswebview/data/elements.html | 14 + .../qmlgraphicswebview/data/elements.qml | 7 + .../qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 67 + .../visual/webview/zooming/data/zooming.0.png | Bin 0 -> 735 bytes .../visual/webview/zooming/data/zooming.1.png | Bin 0 -> 735 bytes .../visual/webview/zooming/data/zooming.2.png | Bin 0 -> 735 bytes .../visual/webview/zooming/data/zooming.3.png | Bin 0 -> 735 bytes .../visual/webview/zooming/data/zooming.qml | 2115 ++++++++++++++++++++ .../visual/webview/zooming/zooming.html | 6 + .../declarative/visual/webview/zooming/zooming.qml | 17 + 13 files changed, 2380 insertions(+), 93 deletions(-) create mode 100644 src/declarative/graphicsitems/qmlgraphicswebview_p_p.h create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/elements.html create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/elements.qml create mode 100644 tests/auto/declarative/visual/webview/zooming/data/zooming.0.png create mode 100644 tests/auto/declarative/visual/webview/zooming/data/zooming.1.png create mode 100644 tests/auto/declarative/visual/webview/zooming/data/zooming.2.png create mode 100644 tests/auto/declarative/visual/webview/zooming/data/zooming.3.png create mode 100644 tests/auto/declarative/visual/webview/zooming/data/zooming.qml create mode 100644 tests/auto/declarative/visual/webview/zooming/zooming.html create mode 100644 tests/auto/declarative/visual/webview/zooming/zooming.qml diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index ef10e51..da3a0d4 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -83,5 +83,6 @@ contains(QT_CONFIG, webkit) { QT+=webkit SOURCES += graphicsitems/qmlgraphicswebview.cpp HEADERS += graphicsitems/qmlgraphicswebview_p.h + HEADERS += graphicsitems/qmlgraphicswebview_p_p.h } diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index 6dbf053..00fdd6d 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -59,6 +59,7 @@ #include #include "qmlgraphicswebview_p.h" +#include "qmlgraphicswebview_p_p.h" #include QT_BEGIN_NAMESPACE @@ -67,97 +68,6 @@ QML_DEFINE_NOCREATE_TYPE(QAction) static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system -class QmlGraphicsWebSettings : public QObject { - Q_OBJECT - - Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) - Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) - Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) - Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) - Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) - Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) - - Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) - Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) - Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) - Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) - - Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) - Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) - Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) - Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) - Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) - Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) - Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) - Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) - Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) - Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) - Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) - Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) - Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) - Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) - Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) - -public: - QmlGraphicsWebSettings() {} - - QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } - void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } - QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } - void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } - QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } - void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } - QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } - void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } - QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } - void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } - QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } - void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } - - int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } - void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } - int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } - void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } - int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } - void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } - int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } - void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } - - bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } - void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } - bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } - void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } - bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } - void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } - bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } - void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } - bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } - void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } - bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } - void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } - bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } - void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } - bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } - void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } - bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } - void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } - bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } - void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } - bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } - void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } - bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } - void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } - bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } - void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } - bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } - void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } - bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } - void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } - - QWebSettings *s; -}; - -QML_DECLARE_TYPE(QmlGraphicsWebSettings) QML_DEFINE_NOCREATE_TYPE(QmlGraphicsWebSettings) class QmlGraphicsWebViewPrivate : public QmlGraphicsPaintedItemPrivate @@ -706,7 +616,7 @@ void QmlGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) \i includes (\a clickX, \a clickY) \i fits into the preferredWidth and preferredHeight \i zooms by no more than \a maxzoom - \i is more than 20% above the current zoom + \i is more than 10% above the current zoom \endlist If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, @@ -722,7 +632,7 @@ bool QmlGraphicsWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) qreal z = qMin(qreal(d->preferredwidth)*ozf/showarea.width(),qreal(d->preferredheight)*ozf/showarea.height()); if (z > maxzoom) z = maxzoom; - if (z/ozf > 1.2) { + if (z/ozf > 1.1) { QRectF r(showarea.left()/ozf*z, showarea.top()/ozf*z, showarea.width()/ozf*z, showarea.height()/ozf*z); emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); return true; diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h new file mode 100644 index 0000000..5063669 --- /dev/null +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSWEBVIEW_P_H +#define QMLGRAPHICSWEBVIEW_P_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QmlGraphicsWebSettings : public QObject { + Q_OBJECT + + Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) + Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) + Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) + Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) + Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) + Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) + + Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) + Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) + Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) + Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) + + Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) + Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) + Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) + Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) + Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) + Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) + Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) + Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) + Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) + Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) + Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) + Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) + Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) + Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) + Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) + +public: + QmlGraphicsWebSettings() {} + + QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } + void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } + QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } + void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } + QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } + void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } + QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } + void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } + QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } + void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } + QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } + void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } + + int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } + void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } + int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } + void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } + int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } + void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } + int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } + void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } + + bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } + void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } + bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } + void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } + bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } + void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } + bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } + void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } + bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } + void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } + bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } + void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } + bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } + void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } + bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } + void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } + bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } + void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } + bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } + void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } + bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } + void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } + bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } + void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } + bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } + void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } + bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } + void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } + bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } + void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } + + QWebSettings *s; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlGraphicsWebSettings) + +QT_END_HEADER + +#endif diff --git a/tests/auto/declarative/qmlgraphicswebview/data/elements.html b/tests/auto/declarative/qmlgraphicswebview/data/elements.html new file mode 100644 index 0000000..9236867 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/elements.html @@ -0,0 +1,14 @@ + + + + + + +

A

+ + + + + +

B

C

+
diff --git a/tests/auto/declarative/qmlgraphicswebview/data/elements.qml b/tests/auto/declarative/qmlgraphicswebview/data/elements.qml new file mode 100644 index 0000000..7c030e6 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/elements.qml @@ -0,0 +1,7 @@ +import Qt 4.6 + +WebView { + url: "elements.html" + width: 310 + height: 100 +} diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 308cdd6..da43e68 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ public: private slots: void basicProperties(); + void settings(); void historyNav(); void multipleWindows(); void elementAreaAt(); @@ -156,6 +158,71 @@ void tst_qmlgraphicswebview::basicProperties() QTRY_COMPARE(wv->progress(), 1.0); } +void tst_qmlgraphicswebview::settings() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + checkNoErrors(component); + QmlGraphicsWebView *wv = qobject_cast(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QmlGraphicsWebSettings *s = wv->settingsObject(); + + // merely tests that setting gets stored (in QWebSettings) + // behavioural tests are in WebKit. + for (int b=0; b<=1; ++b) { + bool on = !!b; + + s->setAutoLoadImages(on); + s->setDeveloperExtrasEnabled(on); + s->setJavaEnabled(on); + s->setJavascriptCanAccessClipboard(on); + s->setJavascriptCanOpenWindows(on); + s->setJavascriptEnabled(on); + s->setLinksIncludedInFocusChain(on); + s->setLocalContentCanAccessRemoteUrls(on); + s->setLocalStorageDatabaseEnabled(on); + s->setOfflineStorageDatabaseEnabled(on); + s->setOfflineWebApplicationCacheEnabled(on); + s->setPluginsEnabled(on); + s->setPrintElementBackgrounds(on); + s->setPrivateBrowsingEnabled(on); + s->setZoomTextOnly(on); + + QVERIFY(s->autoLoadImages() == on); + QVERIFY(s->developerExtrasEnabled() == on); + QVERIFY(s->javaEnabled() == on); + QVERIFY(s->javascriptCanAccessClipboard() == on); + QVERIFY(s->javascriptCanOpenWindows() == on); + QVERIFY(s->javascriptEnabled() == on); + QVERIFY(s->linksIncludedInFocusChain() == on); + QVERIFY(s->localContentCanAccessRemoteUrls() == on); + QVERIFY(s->localStorageDatabaseEnabled() == on); + QVERIFY(s->offlineStorageDatabaseEnabled() == on); + QVERIFY(s->offlineWebApplicationCacheEnabled() == on); + QVERIFY(s->pluginsEnabled() == on); + QVERIFY(s->printElementBackgrounds() == on); + QVERIFY(s->privateBrowsingEnabled() == on); + QVERIFY(s->zoomTextOnly() == on); + + QVERIFY(s->property("autoLoadImages") == on); + QVERIFY(s->property("developerExtrasEnabled") == on); + QVERIFY(s->property("javaEnabled") == on); + QVERIFY(s->property("javascriptCanAccessClipboard") == on); + QVERIFY(s->property("javascriptCanOpenWindows") == on); + QVERIFY(s->property("javascriptEnabled") == on); + QVERIFY(s->property("linksIncludedInFocusChain") == on); + QVERIFY(s->property("localContentCanAccessRemoteUrls") == on); + QVERIFY(s->property("localStorageDatabaseEnabled") == on); + QVERIFY(s->property("offlineStorageDatabaseEnabled") == on); + QVERIFY(s->property("offlineWebApplicationCacheEnabled") == on); + QVERIFY(s->property("pluginsEnabled") == on); + QVERIFY(s->property("printElementBackgrounds") == on); + QVERIFY(s->property("privateBrowsingEnabled") == on); + QVERIFY(s->property("zoomTextOnly") == on); + } +} + void tst_qmlgraphicswebview::historyNav() { QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); diff --git a/tests/auto/declarative/visual/webview/zooming/data/zooming.0.png b/tests/auto/declarative/visual/webview/zooming/data/zooming.0.png new file mode 100644 index 0000000..aaab35d Binary files /dev/null and b/tests/auto/declarative/visual/webview/zooming/data/zooming.0.png differ diff --git a/tests/auto/declarative/visual/webview/zooming/data/zooming.1.png b/tests/auto/declarative/visual/webview/zooming/data/zooming.1.png new file mode 100644 index 0000000..aaab35d Binary files /dev/null and b/tests/auto/declarative/visual/webview/zooming/data/zooming.1.png differ diff --git a/tests/auto/declarative/visual/webview/zooming/data/zooming.2.png b/tests/auto/declarative/visual/webview/zooming/data/zooming.2.png new file mode 100644 index 0000000..aaab35d Binary files /dev/null and b/tests/auto/declarative/visual/webview/zooming/data/zooming.2.png differ diff --git a/tests/auto/declarative/visual/webview/zooming/data/zooming.3.png b/tests/auto/declarative/visual/webview/zooming/data/zooming.3.png new file mode 100644 index 0000000..aaab35d Binary files /dev/null and b/tests/auto/declarative/visual/webview/zooming/data/zooming.3.png differ diff --git a/tests/auto/declarative/visual/webview/zooming/data/zooming.qml b/tests/auto/declarative/visual/webview/zooming/data/zooming.qml new file mode 100644 index 0000000..ad83800 --- /dev/null +++ b/tests/auto/declarative/visual/webview/zooming/data/zooming.qml @@ -0,0 +1,2115 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 32 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 48 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 64 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 80 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 96 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 112 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 128 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 144 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 160 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 176 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 192 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 208 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 224 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 240 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 256 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 272 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 288 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 304 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 320 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 336 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 352 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 197; y: 34 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 185; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 368 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 169; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 384 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 161; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 400 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 155; y: 44 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 147; y: 46 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 416 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 141; y: 48 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 138; y: 48 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 432 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 130; y: 48 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 127; y: 48 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 448 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 125; y: 48 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 123; y: 48 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 464 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 480 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 121; y: 49 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 496 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 512 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 117; y: 53 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 116; y: 53 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 528 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 115; y: 54 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 544 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 113; y: 54 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 560 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 111; y: 53 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 111; y: 52 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 576 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 110; y: 50 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 592 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 109; y: 48 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 608 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 108; y: 46 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 624 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 108; y: 45 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 107; y: 44 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 640 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 106; y: 43 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 656 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 42 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 672 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 41 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 688 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 704 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 720 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 736 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 752 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 39 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 768 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 784 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 35 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 800 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 816 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 106; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 832 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 848 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 864 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 880 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 896 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 106; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 912 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 928 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 944 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 960 + image: "zooming.0.png" + } + Frame { + msec: 976 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 106; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 992 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1008 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1024 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1040 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1056 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 106; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1072 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1088 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1104 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1120 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 106; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1136 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1152 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1168 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1184 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 106; y: 34 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 106; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1200 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 105; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1216 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 103; y: 44 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1232 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 102; y: 46 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 98; y: 50 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1248 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 94; y: 56 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 90; y: 62 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1264 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 88; y: 70 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 84; y: 78 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1280 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 84; y: 86 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 84; y: 94 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1296 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 84; y: 104 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 86; y: 114 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1312 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 88; y: 124 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 92; y: 136 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1328 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 94; y: 146 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 156 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1344 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 164 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 172 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1360 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 180 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 188 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1376 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 190 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 96; y: 193 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1392 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 95; y: 195 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 95; y: 197 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1408 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 95; y: 198 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 95; y: 200 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1424 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 94; y: 201 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 94; y: 202 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1440 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 94; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1456 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 93; y: 205 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1472 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 92; y: 206 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1488 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 92; y: 208 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1504 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 92; y: 210 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1520 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 92; y: 211 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 91; y: 212 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1536 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1552 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1568 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1584 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1600 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1616 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1632 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 91; y: 213 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1648 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1664 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1680 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1696 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1712 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 91; y: 214 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 91; y: 214 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1728 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1744 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1760 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1776 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 91; y: 214 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1792 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1808 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1824 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1840 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 91; y: 214 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1856 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1872 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1888 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1904 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1920 + image: "zooming.1.png" + } + Frame { + msec: 1936 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 91; y: 214 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1952 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1968 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 1984 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2000 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2016 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2032 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2048 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2064 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2080 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2096 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2112 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2128 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 91; y: 212 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2144 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2160 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2176 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2192 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 89; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2208 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 88; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2224 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2240 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 86; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2256 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 85; y: 211 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 84; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2272 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 82; y: 211 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 80; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2288 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 77; y: 211 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 75; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2304 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 69; y: 213 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 66; y: 213 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2320 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 64; y: 213 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 213 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2336 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 60; y: 213 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 58; y: 213 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2352 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 56; y: 213 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 55; y: 212 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2368 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2384 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2400 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2416 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2432 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2448 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2464 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2480 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 56; y: 213 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2496 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 58; y: 214 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 59; y: 214 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2512 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 61; y: 215 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2528 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 63; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2544 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2560 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2576 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2592 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 64; y: 216 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 64; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2608 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2624 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2640 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2656 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2672 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 63; y: 216 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 63; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2688 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2704 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2720 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2736 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2752 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 62; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2768 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2784 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2800 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2816 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 62; y: 216 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2832 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2848 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 2864 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 215 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2880 + image: "zooming.2.png" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 214 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2896 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 213 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2912 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 62; y: 212 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 63; y: 211 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2928 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 63; y: 209 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 64; y: 208 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2944 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 66; y: 202 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 70; y: 198 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2960 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 72; y: 192 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 74; y: 186 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2976 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 76; y: 180 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 80; y: 170 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2992 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 84; y: 162 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 88; y: 152 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3008 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 94; y: 142 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 98; y: 130 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3024 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 102; y: 118 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 108; y: 108 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3040 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 112; y: 98 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 114; y: 90 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3056 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 120; y: 80 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 122; y: 72 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3072 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 126; y: 66 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 128; y: 58 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3088 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 132; y: 52 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 134; y: 46 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3104 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 136; y: 40 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 140; y: 32 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3120 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 144; y: 24 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 150; y: 18 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3136 + hash: "c98df558c41f1837398eead42392b780" + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 154; y: 10 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 0 + x: 160; y: 4 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3152 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3168 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3184 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3200 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3216 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3232 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3248 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3264 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3280 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3296 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3312 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3328 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3344 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3360 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3376 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3392 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3408 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3424 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3440 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3456 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3472 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3488 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3504 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3520 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3536 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3552 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3568 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3584 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3600 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3616 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3632 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3648 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3664 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3680 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3696 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3712 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3728 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3744 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3760 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3776 + hash: "c98df558c41f1837398eead42392b780" + } + Frame { + msec: 3792 + hash: "c98df558c41f1837398eead42392b780" + } +} diff --git a/tests/auto/declarative/visual/webview/zooming/zooming.html b/tests/auto/declarative/visual/webview/zooming/zooming.html new file mode 100644 index 0000000..4e91035 --- /dev/null +++ b/tests/auto/declarative/visual/webview/zooming/zooming.html @@ -0,0 +1,6 @@ + + +

Zooming

+

+This test shows how zooming can be to HTML elements.

+ diff --git a/tests/auto/declarative/visual/webview/zooming/zooming.qml b/tests/auto/declarative/visual/webview/zooming/zooming.qml new file mode 100644 index 0000000..3ac57f6 --- /dev/null +++ b/tests/auto/declarative/visual/webview/zooming/zooming.qml @@ -0,0 +1,17 @@ +import Qt 4.6 + +// Note that zooming is better done using zoomFactor and careful +// control of rendering to avoid excessive re-rendering during +// zoom animations. This test is written for simplicity. +WebView { + width: 200 + height: 250 + x: Behavior { NumberAnimation { } } + y: Behavior { NumberAnimation { } } + scale: Behavior { NumberAnimation { } } + url: "zooming.html" + preferredWidth: width + preferredHeight: height + onDoubleClick: {print(clickX,clickY);heuristicZoom(clickX,clickY,2)} + onZoomTo: {print(zoom);scale=zoom;x=width/2-centerX;y=height/2-centerY} +} -- cgit v0.12