From 17b6a9fbfc9de4dae58653b18c26d1ce509e4c21 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 13 Nov 2009 14:31:52 +1000 Subject: test elementAreaAt --- .../qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 9032300..308cdd6 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -59,6 +59,7 @@ private slots: void basicProperties(); void historyNav(); void multipleWindows(); + void elementAreaAt(); void loadError(); void setHtml(); void javaScript(); @@ -258,6 +259,21 @@ void tst_qmlgraphicswebview::setHtml() QCOMPARE(wv->html(),QString("

This is a string set on the WebView

")); } +void tst_qmlgraphicswebview::elementAreaAt() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/elements.qml")); + checkNoErrors(component); + QmlGraphicsWebView *wv = qobject_cast(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QCOMPARE(wv->elementAreaAt(40,30,100,100),QRect(1,1,75,54)); // Area A in data/elements.html + QCOMPARE(wv->elementAreaAt(130,30,200,100),QRect(78,3,110,50)); // Area B + QCOMPARE(wv->elementAreaAt(40,30,400,400),QRect(0,0,310,100)); // Whole view + QCOMPARE(wv->elementAreaAt(130,30,280,280),QRect(76,1,223,54)); // Area BC + QCOMPARE(wv->elementAreaAt(130,30,400,400),QRect(0,0,310,100)); // Whole view +} + void tst_qmlgraphicswebview::javaScript() { QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/javaScript.qml")); -- cgit v0.12