aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2011-10-14 11:37:25 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-14 04:47:56 +0200
commit52d9a57814f840859b89e540554990d0e86894b7 (patch)
tree3211bcee73a545e3aef8476e8dd0da83211687b2
parent5774a1c6c3e85290ed634427c9bef444c543190b (diff)
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 <michael.brasser@nokia.com>
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/qsgitem2/data/mapCoordinates.qml45
-rw-r--r--tests/auto/declarative/qsgitem2/qsgitem2.pro (renamed from tests/auto/declarative/qsgitem2/qsgitem.pro)0
-rw-r--r--tests/auto/declarative/qsgitem2/tst_qsgitem.cpp24
4 files changed, 55 insertions, 15 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 6e14648943..9f1cf1c412 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 a5a073c1a0..566cb220ff 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
index 517e67619b..517e67619b 100644
--- a/tests/auto/declarative/qsgitem2/qsgitem.pro
+++ b/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 bd437dff41..fd1f9cd373 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<QPointF>(), qobject_cast<QSGItem*>(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<QWidget *>(canvas));
QSGItem *item = findItem<QSGItem>(canvas->rootObject(), "item");
QSGItem *parentItem = findItem<QSGItem>(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();