From 71b0c10cb0a0186b6978143566bb0b35b3de3b54 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 6 Nov 2009 11:03:18 +1000 Subject: move --- tests/auto/declarative/qfxwebview/data/basic.html | 12 -- tests/auto/declarative/qfxwebview/data/basic.png | Bin 3961 -> 0 bytes tests/auto/declarative/qfxwebview/data/basic.qml | 5 - tests/auto/declarative/qfxwebview/data/sethtml.qml | 5 - tests/auto/declarative/qfxwebview/qfxwebview.pro | 8 -- .../auto/declarative/qfxwebview/tst_qfxwebview.cpp | 153 --------------------- .../declarative/qmlgraphicswebview/data/basic.html | 12 ++ .../declarative/qmlgraphicswebview/data/basic.png | Bin 0 -> 3961 bytes .../declarative/qmlgraphicswebview/data/basic.qml | 5 + .../qmlgraphicswebview/data/sethtml.qml | 5 + .../qmlgraphicswebview/qmlgraphicswebview.pro | 8 ++ .../qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 153 +++++++++++++++++++++ 12 files changed, 183 insertions(+), 183 deletions(-) delete mode 100644 tests/auto/declarative/qfxwebview/data/basic.html delete mode 100644 tests/auto/declarative/qfxwebview/data/basic.png delete mode 100644 tests/auto/declarative/qfxwebview/data/basic.qml delete mode 100644 tests/auto/declarative/qfxwebview/data/sethtml.qml delete mode 100644 tests/auto/declarative/qfxwebview/qfxwebview.pro delete mode 100644 tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/basic.html create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/basic.png create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/basic.qml create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml create mode 100644 tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro create mode 100644 tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp diff --git a/tests/auto/declarative/qfxwebview/data/basic.html b/tests/auto/declarative/qfxwebview/data/basic.html deleted file mode 100644 index c262f12..0000000 --- a/tests/auto/declarative/qfxwebview/data/basic.html +++ /dev/null @@ -1,12 +0,0 @@ - -Basic - - - - - - - -
This is a basic test.
- - diff --git a/tests/auto/declarative/qfxwebview/data/basic.png b/tests/auto/declarative/qfxwebview/data/basic.png deleted file mode 100644 index 35717cc..0000000 Binary files a/tests/auto/declarative/qfxwebview/data/basic.png and /dev/null differ diff --git a/tests/auto/declarative/qfxwebview/data/basic.qml b/tests/auto/declarative/qfxwebview/data/basic.qml deleted file mode 100644 index 5394837..0000000 --- a/tests/auto/declarative/qfxwebview/data/basic.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt 4.6 - -WebView { - url: "basic.html" -} diff --git a/tests/auto/declarative/qfxwebview/data/sethtml.qml b/tests/auto/declarative/qfxwebview/data/sethtml.qml deleted file mode 100644 index 063b5a8..0000000 --- a/tests/auto/declarative/qfxwebview/data/sethtml.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt 4.6 - -WebView { - html: "

This is a string set on the WebView" -} diff --git a/tests/auto/declarative/qfxwebview/qfxwebview.pro b/tests/auto/declarative/qfxwebview/qfxwebview.pro deleted file mode 100644 index b75e057..0000000 --- a/tests/auto/declarative/qfxwebview/qfxwebview.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qfxwebview.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp deleted file mode 100644 index a8a0854..0000000 --- a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** 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 test suite 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$ -** -****************************************************************************/ -#include -#include "../../../shared/util.h" -#include -#include -#include -#include -#include -#include -#include - -class tst_qfxwebview : public QObject -{ - Q_OBJECT -public: - tst_qfxwebview() {} - -private slots: - void basicProperties(); - void setHtml(); - void cleanupTestCase(); - - -private: - void checkNoErrors(const QmlComponent& component); - QmlEngine engine; - QString tmpDir() const - { - static QString tmpd = QDir::tempPath()+"/tst_qfxwebview-" - + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); - return tmpd; - } -}; - -void removeRecursive(const QString& dirname) -{ - QDir dir(dirname); - QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); - for (int i = 0; i < entries.count(); ++i) - if (entries[i].isDir()) - removeRecursive(entries[i].filePath()); - else - dir.remove(entries[i].fileName()); - QDir().rmdir(dirname); -} - -void tst_qfxwebview::cleanupTestCase() -{ - removeRecursive(tmpDir()); -} - -void tst_qfxwebview::checkNoErrors(const QmlComponent& component) -{ - if (component.isError()) { - QList errors = component.errors(); - for (int ii = 0; ii < errors.count(); ++ii) { - const QmlError &error = errors.at(ii); - QByteArray errorStr = QByteArray::number(error.line()) + ":" + - QByteArray::number(error.column()) + ":" + - error.description().toUtf8(); - qWarning() << errorStr; - } - } - QVERIFY(!component.isError()); -} - -void tst_qfxwebview::basicProperties() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QmlGraphicsWebView *wv = qobject_cast(component.create()); - QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("Basic")); - QTRY_COMPARE(wv->icon().width(), 48); - QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png")); - QCOMPARE(wv->statusText(),QString("")); - QFile htmlfile(SRCDIR "/data/basic.html"); - QVERIFY(htmlfile.open(QIODevice::ReadOnly)); - QString actualhtml____ = wv->html(); // "____" is to make errors line up for easier reading - QString expectedhtml = htmlfile.readAll(); - actualhtml____.replace(QRegExp("\\s+"),""); - expectedhtml.replace(QRegExp("\\s+"),""); - QCOMPARE(actualhtml____,expectedhtml); // same, ignoring whitespace - QCOMPARE(wv->width(), 123.0); - QCOMPARE(wv->webPageWidth(), 0); - QCOMPARE(wv->preferredWidth(), 0); - QCOMPARE(wv->zoomFactor(), 1.0); - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); - QCOMPARE(wv->status(), QmlGraphicsWebView::Ready); - QVERIFY(wv->reloadAction()); - QVERIFY(wv->reloadAction()->isEnabled()); - QVERIFY(wv->backAction()); - QVERIFY(!wv->backAction()->isEnabled()); - QVERIFY(wv->forwardAction()); - QVERIFY(!wv->forwardAction()->isEnabled()); - QVERIFY(wv->stopAction()); - QVERIFY(!wv->stopAction()->isEnabled()); -} - -void tst_qfxwebview::setHtml() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/sethtml.qml")); - checkNoErrors(component); - QmlGraphicsWebView *wv = qobject_cast(component.create()); - QVERIFY(wv != 0); - QCOMPARE(wv->html(),QString("

This is a string set on the WebView

")); -} - -QTEST_MAIN(tst_qfxwebview) - -#include "tst_qfxwebview.moc" diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.html b/tests/auto/declarative/qmlgraphicswebview/data/basic.html new file mode 100644 index 0000000..c262f12 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/basic.html @@ -0,0 +1,12 @@ + +Basic + + + + + + + +
This is a basic test.
+ + diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.png b/tests/auto/declarative/qmlgraphicswebview/data/basic.png new file mode 100644 index 0000000..35717cc Binary files /dev/null and b/tests/auto/declarative/qmlgraphicswebview/data/basic.png differ diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.qml b/tests/auto/declarative/qmlgraphicswebview/data/basic.qml new file mode 100644 index 0000000..5394837 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/basic.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +WebView { + url: "basic.html" +} diff --git a/tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml b/tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml new file mode 100644 index 0000000..063b5a8 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +WebView { + html: "

This is a string set on the WebView" +} diff --git a/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro b/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro new file mode 100644 index 0000000..cce3df2 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qmlgraphicswebview.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp new file mode 100644 index 0000000..a8a0854 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** 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 test suite 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$ +** +****************************************************************************/ +#include +#include "../../../shared/util.h" +#include +#include +#include +#include +#include +#include +#include + +class tst_qfxwebview : public QObject +{ + Q_OBJECT +public: + tst_qfxwebview() {} + +private slots: + void basicProperties(); + void setHtml(); + void cleanupTestCase(); + + +private: + void checkNoErrors(const QmlComponent& component); + QmlEngine engine; + QString tmpDir() const + { + static QString tmpd = QDir::tempPath()+"/tst_qfxwebview-" + + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); + return tmpd; + } +}; + +void removeRecursive(const QString& dirname) +{ + QDir dir(dirname); + QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); + for (int i = 0; i < entries.count(); ++i) + if (entries[i].isDir()) + removeRecursive(entries[i].filePath()); + else + dir.remove(entries[i].fileName()); + QDir().rmdir(dirname); +} + +void tst_qfxwebview::cleanupTestCase() +{ + removeRecursive(tmpDir()); +} + +void tst_qfxwebview::checkNoErrors(const QmlComponent& component) +{ + if (component.isError()) { + QList errors = component.errors(); + for (int ii = 0; ii < errors.count(); ++ii) { + const QmlError &error = errors.at(ii); + QByteArray errorStr = QByteArray::number(error.line()) + ":" + + QByteArray::number(error.column()) + ":" + + error.description().toUtf8(); + qWarning() << errorStr; + } + } + QVERIFY(!component.isError()); +} + +void tst_qfxwebview::basicProperties() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + checkNoErrors(component); + QWebSettings::enablePersistentStorage(tmpDir()); + + QmlGraphicsWebView *wv = qobject_cast(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->title(),QString("Basic")); + QTRY_COMPARE(wv->icon().width(), 48); + QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png")); + QCOMPARE(wv->statusText(),QString("")); + QFile htmlfile(SRCDIR "/data/basic.html"); + QVERIFY(htmlfile.open(QIODevice::ReadOnly)); + QString actualhtml____ = wv->html(); // "____" is to make errors line up for easier reading + QString expectedhtml = htmlfile.readAll(); + actualhtml____.replace(QRegExp("\\s+"),""); + expectedhtml.replace(QRegExp("\\s+"),""); + QCOMPARE(actualhtml____,expectedhtml); // same, ignoring whitespace + QCOMPARE(wv->width(), 123.0); + QCOMPARE(wv->webPageWidth(), 0); + QCOMPARE(wv->preferredWidth(), 0); + QCOMPARE(wv->zoomFactor(), 1.0); + QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); + QCOMPARE(wv->status(), QmlGraphicsWebView::Ready); + QVERIFY(wv->reloadAction()); + QVERIFY(wv->reloadAction()->isEnabled()); + QVERIFY(wv->backAction()); + QVERIFY(!wv->backAction()->isEnabled()); + QVERIFY(wv->forwardAction()); + QVERIFY(!wv->forwardAction()->isEnabled()); + QVERIFY(wv->stopAction()); + QVERIFY(!wv->stopAction()->isEnabled()); +} + +void tst_qfxwebview::setHtml() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/sethtml.qml")); + checkNoErrors(component); + QmlGraphicsWebView *wv = qobject_cast(component.create()); + QVERIFY(wv != 0); + QCOMPARE(wv->html(),QString("

This is a string set on the WebView

")); +} + +QTEST_MAIN(tst_qfxwebview) + +#include "tst_qfxwebview.moc" -- cgit v0.12