From: Damian Jansen Date: Fri, 14 Oct 2011 01:37:25 +0000 (+1000) Subject: Tst_qsgitem2 test update inline with refactor X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=52d9a57814f840859b89e540554990d0e86894b7;p=konrad%2Fqtdeclarative.git Tst_qsgitem2 test update inline with refactor Change widget to window based code Make compile and pass Add license header Change-Id: Id0826bf644836654de7eff559a8ff40a55d02616 Reviewed-on: http://codereview.qt-project.org/6635 Reviewed-by: Michael Brasser --- diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 6e14648..9f1cf1c 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -75,6 +75,7 @@ SGTESTS = \ qsggridview \ qsgimage \ qsgitem \ + qsgitem2 \ qsglistview \ qsgloader \ qsgmousearea \ diff --git a/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml b/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml index a5a073c..566cb22 100644 --- a/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml +++ b/tests/auto/declarative/qsgitem2/data/mapCoordinates.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + import QtQuick 2.0 Item { @@ -33,11 +74,11 @@ Item { function checkMapAToInvalid(x, y) { var pos = itemA.mapToItem(1122, x, y) - return pos.x == undefined && pos.y == undefined + return pos == undefined; } function checkMapAFromInvalid(x, y) { var pos = itemA.mapFromItem(1122, x, y) - return pos.x == undefined && pos.y == undefined + return pos == undefined; } } diff --git a/tests/auto/declarative/qsgitem2/qsgitem.pro b/tests/auto/declarative/qsgitem2/qsgitem2.pro similarity index 100% rename from tests/auto/declarative/qsgitem2/qsgitem.pro rename to tests/auto/declarative/qsgitem2/qsgitem2.pro diff --git a/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp index bd437df..fd1f9cd 100644 --- a/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp +++ b/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp @@ -204,7 +204,7 @@ void tst_QSGItem::initTestCase() void tst_QSGItem::keys() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(240,320)); KeysTestObject *testObject = new KeysTestObject; canvas->rootContext()->setContextProperty("keysTestObject", testObject); @@ -328,7 +328,7 @@ void tst_QSGItem::keys() void tst_QSGItem::keysProcessingOrder() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(240,320)); KeysTestObject *testObject = new KeysTestObject; canvas->rootContext()->setContextProperty("keysTestObject", testObject); @@ -543,7 +543,7 @@ void tst_QSGItem::layoutMirroringIllegalParent() void tst_QSGItem::keyNavigation() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(240,320)); canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml"))); canvas->show(); @@ -623,7 +623,7 @@ void tst_QSGItem::keyNavigation() void tst_QSGItem::keyNavigation_RightToLeft() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(240,320)); canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml"))); canvas->show(); @@ -676,7 +676,7 @@ void tst_QSGItem::keyNavigation_RightToLeft() void tst_QSGItem::keyNavigation_skipNotVisible() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(240,320)); canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml"))); canvas->show(); @@ -754,7 +754,7 @@ void tst_QSGItem::keyNavigation_skipNotVisible() void tst_QSGItem::keyNavigation_implicitSetting() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(240,320)); canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest_implicit.qml"))); canvas->show(); @@ -941,7 +941,7 @@ void tst_QSGItem::mapCoordinates() QFETCH(int, y); QSGView *canvas = new QSGView(0); - canvas->setFixedSize(300, 300); + canvas->setBaseSize(QSize(300, 300)); canvas->setSource(QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml"))); canvas->show(); qApp->processEvents(); @@ -971,8 +971,8 @@ void tst_QSGItem::mapCoordinates() Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value(), qobject_cast(a)->mapFromScene(QPointF(x, y))); - QString warning1 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":7:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item"; - QString warning2 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":7:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item"; + QString warning1 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":48:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item"; + QString warning2 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":48:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QVERIFY(QMetaObject::invokeMethod(root, "checkMapAToInvalid", @@ -1054,13 +1054,11 @@ void tst_QSGItem::resourcesProperty() void tst_QSGItem::propertyChanges() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); + canvas->setBaseSize(QSize(300, 300)); canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); canvas->show(); - QApplication::setActiveWindow(canvas); QTest::qWaitForWindowShown(canvas); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); QSGItem *item = findItem(canvas->rootObject(), "item"); QSGItem *parentItem = findItem(canvas->rootObject(), "parentItem"); @@ -1137,8 +1135,8 @@ void tst_QSGItem::propertyChanges() void tst_QSGItem::childrenRect() { QSGView *canvas = new QSGView(0); - canvas->setFixedSize(240,320); canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRect.qml"))); + canvas->setBaseSize(QSize(240,320)); canvas->show(); QSGItem *o = canvas->rootObject();