summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-17 04:04:21 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-17 04:04:21 (GMT)
commit4d5d94b7cf41fbfefd37812ae3b311dd619a6731 (patch)
tree2de262a647fb49b371c1790e44e96486a0adf27d /tests/auto
parent89464ba786864f8a905c0d9939033970ac10f978 (diff)
downloadQt-4d5d94b7cf41fbfefd37812ae3b311dd619a6731.zip
Qt-4d5d94b7cf41fbfefd37812ae3b311dd619a6731.tar.gz
Qt-4d5d94b7cf41fbfefd37812ae3b311dd619a6731.tar.bz2
graphicswidgets basic autotest
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml57
-rw-r--r--tests/auto/declarative/graphicswidgets/graphicswidgets.pro8
-rw-r--r--tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp77
4 files changed, 143 insertions, 0 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index ec2c7d0..5ab272c 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -7,6 +7,7 @@ SUBDIRS += \
datetimeformatter \ # Cover
debugger \ # Cover
examples \
+ graphicswidgets \ # Cover
layouts \ # Cover
numberformatter \ # Cover
parserstress \ # Cover
diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml
new file mode 100644
index 0000000..70fafd6
--- /dev/null
+++ b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml
@@ -0,0 +1,57 @@
+import Qt 4.6
+
+QGraphicsView {
+ objectName: "GView"
+ size: "800x600"
+
+ QGraphicsScene {
+ objectName: "GScene"
+ sceneRect: "0,0,500x300"
+
+ QGraphicsWidget {
+ layout: QGraphicsLinearLayout {
+ orientation: Qt.Horizontal
+ QGraphicsWidget {
+ layout: QGraphicsLinearLayout {
+ spacing: 10; orientation: Qt.Vertical
+ LayoutItem {
+ QGraphicsLinearLayout.stretchFactor: 1
+ objectName: "left"
+ minimumSize: "100x100"
+ maximumSize: "300x300"
+ preferredSize: "100x100"
+ Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent }
+ }
+ LayoutItem {
+ QGraphicsLinearLayout.stretchFactor: 10
+ objectName: "left"
+ minimumSize: "100x100"
+ maximumSize: "300x300"
+ preferredSize: "100x100"
+ Rectangle { objectName: "yellowRect"; color: "blue"; anchors.fill: parent }
+ }
+ }
+ }
+ QGraphicsWidget {
+ layout: QGraphicsLinearLayout {
+ spacing: 10; orientation: Qt.Vertical
+ LayoutItem {
+ objectName: "left"
+ minimumSize: "100x100"
+ maximumSize: "300x300"
+ preferredSize: "100x100"
+ Rectangle { objectName: "yellowRect"; color: "red"; anchors.fill: parent }
+ }
+ LayoutItem {
+ objectName: "left"
+ minimumSize: "100x100"
+ maximumSize: "300x300"
+ preferredSize: "100x100"
+ Rectangle { objectName: "yellowRect"; color: "green"; anchors.fill: parent }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro
new file mode 100644
index 0000000..712c34c
--- /dev/null
+++ b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_graphicswidgets.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp
new file mode 100644
index 0000000..783094b
--- /dev/null
+++ b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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 <qtest.h>
+#include <QFile>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <private/graphicswidgets_p.h>
+
+class tst_graphicswidgets : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_graphicswidgets();
+
+private slots:
+ void widgets();
+};
+
+tst_graphicswidgets::tst_graphicswidgets()
+{
+}
+
+void tst_graphicswidgets::widgets()
+{
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/graphicswidgets.qml"));
+ QGraphicsView *obj = qobject_cast<QGraphicsView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->scene() != 0);
+ QList<QObject*> list;
+ QVERIFY(obj->scene()->children() != list);
+ delete obj;
+}
+
+QTEST_MAIN(tst_graphicswidgets)
+
+#include "tst_graphicswidgets.moc"