summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2011-10-22 00:04:37 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-10 03:25:18 +0100
commitf05af7cd00ef88dcfabb4b62c81b661684ef94e6 (patch)
tree6471d95ea463c15e2397b1eecfbd0631560bc81f /tests
parent2bfd0aa62b39890bb0e0c2cb844fa0ee35a4b309 (diff)
Make standalone Item3Ds work.
This is kind of a hack but its so succinct and seems to work so well that I'm inclined to give it a run and see if there is any problems with it before going for something much more complex and disruptive. The alternative would be to try to factor out the rendering logic from the Viewport class into a new class in the libQt3DQuick.so - where it can be accessed by the Item3D implementation (QDeclarativeItem3D) and to make a basic Viewport QML item that used the rendering logic, and to have Item3D use it if it was not a descendant of a Viewport. The hack is good because it avoids all this hand-wringing and anxiety by simply asking the declarative system to create us a viewport using a piece of script, so we don't even need to reference the viewport class at all. Change-Id: I16b4d4666c86e679dd4b9d81c54a8cd12f4a957a Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/fullreferencing/README11
-rw-r--r--tests/manual/fullreferencing/fullreferencing.pro11
-rw-r--r--tests/manual/fullreferencing/main.cpp67
-rw-r--r--tests/manual/fullreferencing/qml/meshes/hazard.pngbin0 -> 64685 bytes
-rw-r--r--tests/manual/fullreferencing/qml/meshes/robot.3dsbin0 -> 76250 bytes
-rw-r--r--tests/manual/fullreferencing/qml/tst_fullreferencing.qml81
-rw-r--r--tests/manual/manual.pro1
7 files changed, 171 insertions, 0 deletions
diff --git a/tests/manual/fullreferencing/README b/tests/manual/fullreferencing/README
new file mode 100644
index 000000000..f7994e818
--- /dev/null
+++ b/tests/manual/fullreferencing/README
@@ -0,0 +1,11 @@
+This test renders a cube against a cleared black background.
+
+The cube should be able to be manipulated by dragging the mouse
+pointer around the window.
+
+The aim is to have the simplest possible test which shows rendering
+3D content with no 2D content.
+
+When the 3D content is free of 2D QML in this way optimized approaches may
+be used and this test (along with "background") is meant to be the simplest test
+of this behavior.
diff --git a/tests/manual/fullreferencing/fullreferencing.pro b/tests/manual/fullreferencing/fullreferencing.pro
new file mode 100644
index 000000000..01577f56f
--- /dev/null
+++ b/tests/manual/fullreferencing/fullreferencing.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+TARGET = tst_fullreferencing
+CONFIG += qt warn_on
+
+SOURCES += main.cpp
+
+INSTALL_DIRS = qml
+
+CONFIG += qt3d_deploy_qml qt3dquick_deploy_pkg
+include(../../../pkg.pri)
+qtcAddDeployment()
diff --git a/tests/manual/fullreferencing/main.cpp b/tests/manual/fullreferencing/main.cpp
new file mode 100644
index 000000000..e7d3c406f
--- /dev/null
+++ b/tests/manual/fullreferencing/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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 QtQuick3D module 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$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include <QtDeclarative/QDeclarativeEngine>
+
+#include "qdeclarativeview3d.h"
+
+#include "../../shared/qmlres.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QDeclarativeView3D view;
+ QString qml = q_get_qmldir(QLatin1String("qml/tst_fullreferencing.qml"));
+ view.setSource(QUrl::fromLocalFile(qml));
+
+ QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
+
+ if (QApplication::arguments().contains(QLatin1String("-maximize")))
+ view.showMaximized();
+ else if (QApplication::arguments().contains(QLatin1String("-fullscreen")))
+ view.showFullScreen();
+ else
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/fullreferencing/qml/meshes/hazard.png b/tests/manual/fullreferencing/qml/meshes/hazard.png
new file mode 100644
index 000000000..a7c0b7fea
--- /dev/null
+++ b/tests/manual/fullreferencing/qml/meshes/hazard.png
Binary files differ
diff --git a/tests/manual/fullreferencing/qml/meshes/robot.3ds b/tests/manual/fullreferencing/qml/meshes/robot.3ds
new file mode 100644
index 000000000..ed872c82a
--- /dev/null
+++ b/tests/manual/fullreferencing/qml/meshes/robot.3ds
Binary files differ
diff --git a/tests/manual/fullreferencing/qml/tst_fullreferencing.qml b/tests/manual/fullreferencing/qml/tst_fullreferencing.qml
new file mode 100644
index 000000000..d3c8f18de
--- /dev/null
+++ b/tests/manual/fullreferencing/qml/tst_fullreferencing.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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 1.0
+import Qt3D 1.0
+import Qt3D.Shapes 1.0
+
+Rectangle {
+ id: screen
+ width: 640
+ height: 520
+ objectName: "toplevelrect"
+ color: "black"
+ // Test displaying of an object that has no parent viewport
+ Item3D {
+ height: screen.height - 80
+ width: screen.width
+ id: solo
+ objectName: "soloItem"
+ y: -1.2
+ scale: 0.3
+ transform: [ Rotation3D { axis: "1,0,0"; angle: 90 }, Rotation3D { axis: "0,1,0"; angle: 60 }]
+ mesh: Mesh { source: "meshes/robot.3ds"; options: "ForceFaceted" }
+ }
+ Rectangle {
+ id: instructions
+ height: 80
+ width: parent.width
+ anchors.bottom: parent.bottom
+ color: "#3333aa"
+ opacity: 0.5
+ Text {
+ id: instructionsText
+ wrapMode: "WordWrap"
+ text: "A robot model should be visible in the window above. (Tap here to Quit)"
+ anchors.centerIn: parent
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+}
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index cdeb40e60..d5d583190 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -9,4 +9,5 @@ SUBDIRS += displaymodel \
translation \
transformations \
animations \
+ fullreferencing \
qrc