diff options
Diffstat (limited to 'tests/auto/qml3d')
28 files changed, 0 insertions, 3294 deletions
diff --git a/tests/auto/qml3d/QtQuickTest/TestCase.qml b/tests/auto/qml3d/QtQuickTest/TestCase.qml deleted file mode 100644 index 49cb73c4..00000000 --- a/tests/auto/qml3d/QtQuickTest/TestCase.qml +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import "testlogger.js" as TestLogger - -Item { - id: testCase - visible: false - - // Name of the test case to prefix the function name in messages. - property string name - - // Set to true to start the test running. - property bool when: true - - // Set to true once the test has completed. - property bool completed: false - - // Set to true when the test is running but not yet complete. - property bool running: false - - // Set to true if the test doesn't have to run (because some - // other test failed which this one depends on). - property bool optional: false - - // Internal private state - property string currentTestCase - property bool expectingFail - property string expectFailMsg - property bool prevWhen: true - property int testId: -1 - - TestReport { id: reporter } - - function fail(msg) { - if (!msg) - msg = ""; - if (expectingFail) { - TestLogger.log_expect_fail(currentTestCase, expectFailMsg, msg) - throw new Error("QtTest::expect_fail") - } else { - TestLogger.log_fail(currentTestCase, msg) - throw new Error("QtTest::fail") - } - } - - function fail2(msg, msg2) { - if (msg) - fail(msg + ": " + msg2) - else - fail(msg2) - } - - function verify(cond, msg) { - if (!cond) - fail(msg) - } - - function compare(actual, expected, msg) { - if (typeof actual == "number" && typeof expected == "number") { - // Use a fuzzy compare if the two values are floats - if (Math.abs(actual - expected) <= 0.00001) - return - } else if (typeof actual == "object" && typeof expected == "object") { - // Does the expected value look like a vector3d? - if ("x" in expected && "y" in expected && "z" in expected) { - if (Math.abs(actual.x - expected.x) <= 0.00001 && - Math.abs(actual.y - expected.y) <= 0.00001 && - Math.abs(actual.z - expected.z) <= 0.00001) - return - fail2(msg, "actual: Qt.vector3d(" + - actual.x + ", " + actual.y + ", " + actual.z + - "), expected: Qt.vector3d(" + - expected.x + ", " + expected.y + ", " + expected.z + - ")") - return - } - if (actual == expected) - return - } else if (actual == expected) { - return - } - fail2(msg, "actual: " + actual + ", expected: " + expected) - } - - function skip(msg) { - TestLogger.log_skip(currentTestCase, msg) - throw new Error("QtTest::skip") - } - - function expectFail(msg) { - expectingFail = true - expectFailMsg = msg - } - - property variant testCaseResult - - function runInternal(prop, dataDriven, arg, tag) { - currentTestCase = TestLogger.log_prefixed_name(name, prop) - if (dataDriven && tag) - currentTestCase += " [" + tag + "]" - expectingFail = false - var success = true - try { - testCaseResult = testCase[prop](arg) - if (expectingFail) { - success = false - TestLogger.log_expect_fail_pass(currentTestCase) - } else if (!dataDriven) { - TestLogger.log_pass(currentTestCase) - } - } catch (e) { - testCaseResult = [] - if (e.message == "QtTest::fail") { - success = false - } else if (e.message.indexOf("QtTest::") != 0) { - // Test threw an unrecognized exception - fail. - TestLogger.log_fail(currentTestCase, e.message) - success = false - } - } - return success - } - - function run() { - TestLogger.log_start_test(reporter) - var success = true - running = true - var testList = [] - for (var prop in testCase) { - if (prop.indexOf("test_") != 0) - continue - if (filterTestCases.length > 0) { - // if there is a list, only run the tests in the list - var excludeTest = true - for (var i = 0; i < filterTestCases.length && excludeTest; i++) - { - if (filterTestCases[i] == prop) - excludeTest = false - } - if (excludeTest) - continue - } - var tail = prop.lastIndexOf("_data"); - if (tail != -1 && tail == (prop.length - 5)) - continue - testList.push(prop) - } - testList.sort() - for (var index in testList) { - var prop = testList[index] - var datafunc = prop + "_data" - if (datafunc in testCase) { - if (runInternal(datafunc, true)) { - var table = testCaseResult - var successThis = true - var haveData = false - for (var index in table) { - haveData = true - var row = table[index] - if (!runInternal(prop, true, row, row.tag)) - successThis = false - } - if (!haveData) - TestLogger.log_message("WARNING: no data supplied for " + prop + "() by " + datafunc + "()") - if (successThis) { - var prefix; - if (name) - prefix = name + "::" - currentTestCase = prefix + prop + "()" - TestLogger.log_pass(currentTestCase) - } else { - success = false - } - } else { - success = false - } - } else { - if (!runInternal(prop, false)) - success = false - } - } - currentTestCase = "" - running = false - completed = true - TestLogger.log_complete_test(testId, reporter) - return success - } - - onWhenChanged: { - if (when != prevWhen) { - prevWhen = when - if (when && !completed && !running) - run() - } - } - - onOptionalChanged: { - if (!completed) { - if (optional) - TestLogger.log_optional_test(testId) - else - TestLogger.log_mandatory_test(testId) - } - } - - Component.onCompleted: { - testId = TestLogger.log_register_test(name) - if (optional) - TestLogger.log_optional_test(testId) - prevWhen = when - if (when && !completed && !running) - run() - } -} diff --git a/tests/auto/qml3d/QtQuickTest/qmldir b/tests/auto/qml3d/QtQuickTest/qmldir deleted file mode 100644 index 56f9177a..00000000 --- a/tests/auto/qml3d/QtQuickTest/qmldir +++ /dev/null @@ -1 +0,0 @@ -TestCase 1.0 TestCase.qml diff --git a/tests/auto/qml3d/QtQuickTest/testlogger.js b/tests/auto/qml3d/QtQuickTest/testlogger.js deleted file mode 100644 index 54d537cc..00000000 --- a/tests/auto/qml3d/QtQuickTest/testlogger.js +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -.pragma library - -// We need a global place to store the results that can be -// shared between multiple TestCase instances. Because QML -// creates a separate scope for every inclusion of this file, -// we hijack the global "Qt" object to store our data. -function log_init_results() -{ - if (!Qt.testResults) { - Qt.testResults = { - suiteName: "", - reportedStart: false, - numPassed: 0, - numFailed: 0, - numSkipped: 0, - nextId: 0, - testCases: [], - reporter: null - } - } -} - -function log_fail(testcase, msg) -{ - if (!msg) - msg = "" - Qt.testResults.reporter.log_fail(testcase, msg); - ++Qt.testResults.numFailed -} - -function log_expect_fail(testcase, expectmsg, msg) -{ - if (!msg) - msg = "" - if (expectmsg) - Qt.testResults.reporter.log_expect_fail(testcase, expectmsg + " " + msg); - else - Qt.testResults.reporter.log_expect_fail(testcase, msg); - ++Qt.testResults.numPassed -} - -function log_expect_fail_pass(testcase) -{ - Qt.testResults.reporter.log_expect_fail_pass(testcase); - ++Qt.testResults.numFailed -} - -function log_skip(testcase, msg) -{ - if (!msg) - msg = "" - Qt.testResults.reporter.log_skip(testcase, msg); - ++Qt.testResults.numSkipped -} - -function log_pass(testcase) -{ - Qt.testResults.reporter.log_pass(testcase); - ++Qt.testResults.numPassed -} - -function log_message(msg) -{ - Qt.testResults.reporter.log_message(msg); -} - -function log_register_test(name) -{ - log_init_results() - if (name && !Qt.testResults.suiteName) - Qt.testResults.suiteName = name - var testId = Qt.testResults.nextId++ - Qt.testResults.testCases.push(testId) - return testId -} - -function log_optional_test(testId) -{ - log_init_results() - var index = Qt.testResults.testCases.indexOf(testId) - if (index >= 0) - Qt.testResults.testCases.splice(index, 1) -} - -function log_mandatory_test(testId) -{ - log_init_results() - var index = Qt.testResults.testCases.indexOf(testId) - if (index == -1) - Qt.testResults.testCases.push(testId) -} - -function log_start_test(reporter) -{ - log_init_results() - Qt.testResults.reporter = reporter - if (Qt.testResults.reportedStart) - return - Qt.testResults.reportedStart = true -} - -function log_complete_test(testId, reporter) -{ - var index = Qt.testResults.testCases.indexOf(testId) - if (index >= 0) - Qt.testResults.testCases.splice(index, 1) - if (!Qt.testResults.testCases.length) { - reporter.report(Qt.testResults.numPassed, - Qt.testResults.numFailed, - Qt.testResults.numSkipped) - Qt.quit() - } -} - -function log_prefixed_name(name, funcname) -{ - if (!name) - name = Qt.testResults.suiteName - if (name) - return name + "::" + funcname + "()" - else - return funcname + "()" -} diff --git a/tests/auto/qml3d/effect/test.png b/tests/auto/qml3d/effect/test.png Binary files differdeleted file mode 100644 index 80a4868f..00000000 --- a/tests/auto/qml3d/effect/test.png +++ /dev/null diff --git a/tests/auto/qml3d/effect/tst_effect.qml b/tests/auto/qml3d/effect/tst_effect.qml deleted file mode 100644 index bdfa7f1b..00000000 --- a/tests/auto/qml3d/effect/tst_effect.qml +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Item3D { - Effect { - id: "effect" - } - } - - Material { - id: "china" - ambientColor: "#c09680" - specularColor: "#3c3c3c" - shininess: 128 - } - - TestCase { - name: "Effect" - - // Note that test_material must be called before tests that create - // a material e.g. setColor() (tests are run in alphabetical order) - function test_material() { - verify(!effect.material, "default material is null") - effect.material = china; - compare(effect.material, china, "setMaterial()"); - } - - function test_setColor() { - verify(effect.color == "#ffffff", "Default color is white"); - effect.color = "#ff4488"; - verify(effect.color == "#ff4488", "setColor()") - } - - function test_lighting() { - verify(effect.useLighting == true, "Default useLighting value is true"); - effect.useLighting = false; - verify(effect.useLighting == false, "setUseLighting()") - } - - function test_decal() { - verify(effect.decal == false, "Default decal"); - effect.decal = true; - verify(effect.decal == true, "setDecal()"); - } - - function test_blending() { - verify(effect.blending == false, "Default blending"); - effect.blending = true; - verify(effect.blending == true, "setBlending()"); - } - - function test_texture() { - verify(effect.texture == "", "Default texture"); - effect.texture = "test.png"; - verify(effect.texture != ""); - var textureString = ("" + effect.texture); - var protocolString = textureString.substring(0,5); - var stringLength = textureString.length; - var fileNameFragment = textureString.substring(stringLength-8,stringLength); - compare(protocolString, "file:", "recognize local file"); - compare(fileNameFragment, "test.png", "correct file name"); - } - - function test_textureImage() { - // No support for interrogating QImages from QML - // so can't write meaningful test case for textureImage - } - - function test_progress() { - verify(effect.progress == 0.0); - } - } -} diff --git a/tests/auto/qml3d/item3d/square.3ds b/tests/auto/qml3d/item3d/square.3ds Binary files differdeleted file mode 100644 index 60c3be93..00000000 --- a/tests/auto/qml3d/item3d/square.3ds +++ /dev/null diff --git a/tests/auto/qml3d/item3d/test_data/test-image.png b/tests/auto/qml3d/item3d/test_data/test-image.png Binary files differdeleted file mode 100644 index 9a25b489..00000000 --- a/tests/auto/qml3d/item3d/test_data/test-image.png +++ /dev/null diff --git a/tests/auto/qml3d/item3d/tst_item3d.qml b/tests/auto/qml3d/item3d/tst_item3d.qml deleted file mode 100644 index 8689fd6a..00000000 --- a/tests/auto/qml3d/item3d/tst_item3d.qml +++ /dev/null @@ -1,400 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Item3DClicker { - id: mouseClicker - } - - Item3D { - id: "other" - scale: 12 - position: Qt.vector3d(1.0, 3.0, 5.0); - mesh: Mesh { - - } - pretransform: [ - Rotation3D { id: other_item_pretransform1 ; angle: 30 ; axis: Qt.vector3d(0, 1, 0)}, - Rotation3D { id: other_item_pretransform2; angle: 90 ; axis: Qt.vector3d(1, 0, 0)} - ] - - transform: [ - Rotation3D { id: other_teapot_rotate1 ; angle: 0 ; axis: Qt.vector3d(0, 1, 0)}, - Rotation3D { id: other_teapot_rotate2; angle: 0 ; axis: Qt.vector3d(0, 0, 1)} - ] - } - - Effect { - id: "testEffect" - } - - Light { - id: "testLight" - } - - Item3D { - id: item - property int positionHasBeenChanged: 0 - onPositionChanged : positionHasBeenChanged = positionHasBeenChanged + 1; - - property bool onScaleChangedSignalTriggered: false - onScaleChanged: onScaleChangedSignalTriggered = true - - property bool onMeshChangedSignalTriggered: false - onMeshChanged: onMeshChangedSignalTriggered = true - - property bool onEnabledChangedSignalTriggered:false - onEnabledChanged: onEnabledChangedSignalTriggered = true - - property bool onEffectChangedSignalTriggered: false - onEffectChanged: onEffectChangedSignalTriggered = true - - property int childrenHasBeenChanged: 0 - onChildrenChanged: childrenHasBeenChanged = childrenHasBeenChanged + 1 - - property bool onLightChangedSignalTriggered: false - onLightChanged: onLightChangedSignalTriggered = true - - property int stateChangeTestVariable: 0 - - property bool onStateChangedSignalTriggered: false - onStateChanged: onStateChangedSignalTriggered = true - - property bool onSortChildrenSignalTriggered: false - onSortChildrenChanged: onSortChildrenSignalTriggered = true - - property bool onClickedSignalTriggered: false - onClicked: onClickedSignalTriggered = true - - Item3D { - id: child1 - } - - Item3D { - id: child2 - } - - Item3D { - id: inheritEventTestChild - } - - states: [ - State { - name: "testState1" - PropertyChanges { target: item; stateChangeTestVariable: 1} - }, - State { - name: "testState2" - PropertyChanges { target: item; stateChangeTestVariable: 2} - } - ] - - TestCase { - name: "Item3D" - - // Helper function that finds the index of an object in a list - function indexOf(list, object) - { - for (var i = 0; i < list.length; i++) - if (list[i] == object) - return i; - return -1; - } - - function test_position() - { - verify(item.position.x == 0, "Default position x"); - verify(item.position.y == 0, "Default position y"); - verify(item.position.z == 0, "Default position z"); - - verify(item.x == 0, "Default x"); - verify(item.y == 0, "Default y"); - verify(item.z == 0, "Default z"); - - verify(!item.positionHasBeenChanged, "pre signal test"); - item.position = Qt.vector3d(1,-6,1234567); - compare(item.positionHasBeenChanged, 1, "onPositionChanged signal"); - verify(item.position.x == 1, "Set position x"); - verify(item.position.y == -6, "Set position y negative"); - verify(item.position.z == 1234567, "seven significant digits"); - - verify(item.x == 1, "position changes x"); - verify(item.y == -6, "position changes y"); - verify(item.z == 1234567, "position changex z"); - - item.position.x = -1; - compare(item.positionHasBeenChanged, 2, "onPositionChanged signal from position.x property"); - item.position.y = 12; - compare(item.positionHasBeenChanged, 3, "onPositionChanged signal from position.y property"); - item.position.z = 83461; - compare(item.positionHasBeenChanged, 4, "onPositionChanged signal from position.z property"); - verify(item.x == -1, "position.x changes x"); - verify(item.y == 12, "position.y changes y"); - verify(item.z == 83461, "position.z changes z"); - } - - function test_x() - { - item.positionHasBeenChanged = 0; - verify(!item.positionHasBeenChanged, "pre signal test"); - - item.x = 324; - verify(item.x == 324, "Set x"); - verify(item.position.x == 324, "position modified by setting x"); - compare(item.positionHasBeenChanged, 1, "onPositionChanged signal after setting x"); - - item.x = -7; - verify(item.x == -7, "Set x negative"); - verify(item.position.x == -7, "position modified by setting x negative"); - compare(item.positionHasBeenChanged, 2, "onPositionChanged signal after setting x negative"); - - item.position = Qt.vector3d(2,-7,2345671); - verify(item.x == 2, "x changed by setting postion"); - } - - function test_y() - { - item.positionHasBeenChanged = 0; - verify(!item.positionHasBeenChanged, "pre signal test"); - - item.y = 346; - verify(item.y == 346, "Set y"); - verify(item.position.y == 346, "position modified by setting y"); - compare(item.positionHasBeenChanged, 1, "onPositionChanged signal after setting y"); - - item.y = -12; - verify(item.y == -12, "Set y negative"); - verify(item.position.y == -12, "position modified by setting y negative"); - compare(item.positionHasBeenChanged, 2, "onPositionChanged signal after setting y negative"); - - item.position = Qt.vector3d(2, 13,2345671); - verify(item.y == 13, "y changed by setting postion"); - } - - function test_z() - { - item.positionHasBeenChanged = 0; - verify(!item.positionHasBeenChanged, "pre signal test"); - - item.z = 19375; - verify(item.z == 19375, "Set z"); - verify(item.position.z == 19375, "position modified by setting z"); - compare(item.positionHasBeenChanged, 1, "onPositionChanged signal after setting z"); - - item.z = -74635; - verify(item.z == -74635, "Set z negative"); - verify(item.position.z == -74635, "position modified by setting z negative"); - compare(item.positionHasBeenChanged, 2, "onPositionChanged signal after setting z negative"); - - item.z = 0.435; - compare(item.z, 0.435, "setting z to a real number") - compare(item.position.z, 0.435, "position modified by setting z to a real"); - compare(item.positionHasBeenChanged, 3, "onPositionChanged signal after setting z to a real"); - - item.position = Qt.vector3d(2, 67,2345671); - verify(item.z == 2345671, "z changed by setting postion"); - } - - function test_scale() - { - verify(!item.onScaleChangedSignalTriggered); - compare(item.scale, 1, "default value"); - item.scale = 2.5; - compare(item.scale, 2.5, "setScale"); - verify(item.onScaleChangedSignalTriggered, "scaleChanged signal"); - item.scale = other.scale; - compare(item.scale, 12, "setScale from other item"); - } - - function test_transform() - { - compare(item.transform.length, 0, "Default transformations are empty"); - compare(other.transform.length, 2, "non-empty transform"); - // no public set function - } - - function test_pretransform() - { - compare(item.pretransform.length, 0, "Default pretransformations are empty"); - compare(other.pretransform.length, 2, "non-empty pretransform"); - // no public set function - } - - function test_inheritEvents() - { - verify(!item.inheritEvents, "default inheritEvents is false"); - compare(item.onClickedSignalTriggered, false, "pretest onClickedSignalTriggered check"); - compare(inheritEventTestChild.parent, item, "pretest parent check"); - - mouseClicker.click(inheritEventTestChild); - compare(item.onClickedSignalTriggered, false, - "no parent event when inheritEvents is false"); - - item.inheritEvents = true; - verify(item.inheritEvents, "setInheritEvents()"); - mouseClicker.click(inheritEventTestChild); - compare(item.onClickedSignalTriggered, true, "parent event when inheritEvents is true"); - } - - function test_mesh() - { - verify(!item.mesh, "default mesh value"); - verify(other.mesh != null, "non-null mesh"); - item.mesh = other.mesh; - verify(item.onMeshChangedSignalTriggered, "MeshChanged signal"); - verify(item.mesh == other.mesh, "setMesh()"); - } - - function test_effect() - { - verify(!item.effect, "default effect is null"); - item.effect = testEffect; - verify(item.onEffectChangedSignalTriggered, "onEffectChanged signal"); - verify(item.effect == testEffect, "setEffect()"); - } - - function test_light() - { - verify(!item.light, "default lightparamters is null"); - item.light = testLight; - verify(item.onLightChangedSignalTriggered, "onLightChangedSignal"); - verify(item.light == testLight, "setLight()"); - } - - function test_resources() - { - verify(item.resources != undefined, "item has resources"); - verify(other.resources != undefined, "other item has resources"); - // No public write method - } - - function test_data() - { - verify(item.data != undefined, "item has data"); - verify(other.data != undefined, "other item has data"); - // No public write method - } - - function test_children() - { - verify(item.children.length >= 0, "item.children can be called"); - verify(indexOf(item.children, child1) != -1, "item.children contains child1") - verify(indexOf(item.children, child2) != -1, "item.children contains child2") - verify(indexOf(item.children, inheritEventTestChild) != -1, "item.children contains inheritEventTestChild") - } - - function test_states() - { - - } - - function test_state() - { - verify(!item.state, "Default state is null"); - verify(item.stateChangeTestVariable == 0, "property check before state change"); - item.state = "testState1"; - verify(item.onStateChangedSignalTriggered, "onStateChanged signal"); - verify(item.state == "testState1", "setState()"); - verify(item.stateChangeTestVariable == 1, "property changed with new state"); - } - - function test_enabled() - { - verify(item.enabled, "default value") - item.enabled = false; - verify(!item.enabled, "setEnabled false") - verify(item.onEnabledChangedSignalTriggered, "enabledChanged signal") - } - - function test_parent() - { - compare(item.childrenHasBeenChanged,0, "pretest marker verification"); - - // Test the initial Item3D parent/child relationships. - verify(item.parent == viewport, "root item") - verify(child1.parent == item, "child1 item") - verify(child2.parent == item, "child2 item") - compare(child1.children.length, 0, "child1 children") - verify(indexOf(item.children, child1) != -1, "children contains child1") - verify(indexOf(item.children, child2) != -1, "children contains child2") - - // Reparent the second child and re-test. - child2.parent = child1 - compare(item.childrenHasBeenChanged,1, "childrenChanged triggered by removing child"); - - verify(item.parent == viewport, "root item (B)") - verify(child1.parent == item, "child1's parent (B)") - verify(child2.parent == child1, "child2's parent (B)") - compare(child1.children.length, 1, "child1 children (B)") - verify(indexOf(item.children, child1) != -1, "item.children contains child1 (B)") - verify(indexOf(item.children, child2) == -1, "reparented child not removed from old parent (B)"); - verify(indexOf(child1.children, child2) != -1, "child1.children contains child2"); - - // Change the parent back and test again - child2.parent = item - compare(item.childrenHasBeenChanged,2, "childrenChanged triggered by re-adding child"); - - verify(item.parent == viewport, "root item after revert") - verify(child1.parent == item, "child1 item after revert") - verify(child2.parent == item, "child2 item after revert") - compare(child1.children.length, 0, "child1 has no children after revert") - - verify(indexOf(item.children, child1) != -1, "item.children contains child1 after revert"); - verify(indexOf(item.children, child2) != -1, "item.children contains child2 after revert"); - verify(indexOf(child1.children, child2) == -1, "child1.children does not contain child2 after revert"); - } - - function test_sortChildren() - { - verify(item.sortChildren == Item3D.DefaultSorting, "default value") - item.sortChildren = Item3D.BackToFront; - verify(item.sortChildren == Item3D.BackToFront, "back-to-front") - verify(item.onSortChildrenSignalTriggered, "sortChildren signal") - } - } - } -} diff --git a/tests/auto/qml3d/item3d/tst_item3d_local_v_world.qml b/tests/auto/qml3d/item3d/tst_item3d_local_v_world.qml deleted file mode 100644 index 66982035..00000000 --- a/tests/auto/qml3d/item3d/tst_item3d_local_v_world.qml +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - - Item3D { - id: rotateTestItem - Item3D { - id: rotateTestItemChild - transform: Rotation3D {angle: 90 ; axis: Qt.vector3d(0,1,0)} - } - transform: Rotation3D {angle: 90 ; axis: Qt.vector3d(0,1,0)} - } - - Item3D { - id: rotateZTestItem - Item3D { - id: rotateZChild - } - transform: Rotation3D {angle: 90 ; axis: Qt.vector3d(0,0,1)} - } - - Item3D { - id: scaleTestItem - Item3D { - id: scaleTestItemChild - transform: Scale3D { scale: 0.5 } - } - transform: Scale3D { scale: 2.0 } - } - - Item3D { - id: translateTestItem - position: Qt.vector3d(1,1,1) - - Item3D { - id: child - position: Qt.vector3d(1,1,1) - } - - TestCase { - name: "Item3DRelativeTransformTests" - - function test_localToWorld_translate() - { - var testVectorNull = Qt.vector3d(0,0,0); - var resultVector = translateTestItem.localToWorld(testVectorNull); - - compare(resultVector.x, translateTestItem.position.x, "testVectorNull x translation"); - compare(resultVector.y, translateTestItem.position.y, "testVectorNull y translation"); - compare(resultVector.z, translateTestItem.position.z, "testVectorNull z translation"); - - var childResult = child.localToWorld(testVectorNull); - compare(childResult.x, translateTestItem.x + child.x, "child testVectorNull x translation"); - compare(childResult.y, translateTestItem.y + child.y, "child testVectorNull y translation"); - compare(childResult.z, translateTestItem.z + child.z, "child testVectorNull z translation"); - - var testVector2 = Qt.vector3d(-1,0,123456); - var childResult2 = child.localToWorld(testVector2); - compare(childResult2.x, translateTestItem.x + child.x + testVector2.x, "non-zero point, x translation"); - compare(childResult2.y, translateTestItem.y + child.y, "non-zero point, y translation"); - compare(childResult2.z, translateTestItem.z + child.z + testVector2.z, "non-zero point, z translation"); - } - - function test_localToWorld_rotate() - { - var testVectorX = Qt.vector3d(1,0,0); - var resultVector = rotateTestItem.localToWorld(testVectorX); - compare(resultVector.x, 0, "x value of testVectorX rotated 90 degrees around y unit vector"); - compare(resultVector.y, 0, "y value of testVectorX rotated 90 degrees around y unit vector"); - compare(resultVector.z, -1, "z value of testVectorX rotated 90 degrees around y unit vector"); - - var testVectorY = Qt.vector3d(0,1,0); - var resultVectorY = rotateTestItem.localToWorld(testVectorY); - compare(resultVectorY.x, 0, "x value of testVectorY rotated 90 degrees around y unit vector"); - compare(resultVectorY.y, 1, "y value of testVectorY rotated 90 degrees around y unit vector"); - compare(resultVectorY.z, 0, "z value of testVectorY rotated 90 degrees around y unit vector"); - - var testVectorXY = Qt.vector3d(1,2,0); - var resultVectorXY = rotateZChild.localToWorld(testVectorXY); - compare(resultVectorXY.x, -testVectorXY.y, "x value of testVectorY rotated 90 degrees around y unit vector"); - compare(resultVectorXY.y, testVectorXY.x, "y value of testVectorY rotated 90 degrees around y unit vector"); - compare(resultVectorXY.z, testVectorXY.z, "z value of testVectorY rotated 90 degrees around y unit vector"); - } - - function test_localToWorld_scale() - { - var testVectorNull = Qt.vector3d(0,0,0); - var testVectorX = Qt.vector3d(1,0,0); - - var resultVector = scaleTestItem.localToWorld(testVectorNull); - compare(resultVector.x, 0, "x value of testVectorNull scale: 2.0"); - compare(resultVector.y, 0, "y value of testVectorNull scale: 2.0"); - compare(resultVector.z, 0, "z value of testVectorNull scale: 2.0"); - - resultVector = scaleTestItem.localToWorld(testVectorX); - compare(resultVector.x, 2, "testVectorX.x scale: 2.0"); - compare(resultVector.y, 0, "testVectorX.y scale: 2.0"); - compare(resultVector.z, 0, "testVectorX.z scale: 2.0"); - - resultVector = scaleTestItemChild.localToWorld(testVectorNull); - compare(resultVector.x, testVectorNull.x, "testVectorNull.x scaled up and back down"); - compare(resultVector.y, testVectorNull.y, "testVectorNull.y scaled up and back down"); - compare(resultVector.z, testVectorNull.z, "testVectorNull.z scaled up and back down"); - - resultVector = scaleTestItemChild.localToWorld(testVectorX); - compare(resultVector.x, testVectorX.x, "testVectorX.x scaled up and back down"); - compare(resultVector.y, testVectorX.y, "testVectorX.y scaled up and back down"); - compare(resultVector.z, testVectorX.z, "testVectorX.z scaled up and back down"); - } - - function test_worldToLocal_rotate() - { - var testVector = Qt.vector3d(0,0,-1); - var resultVector = rotateTestItem.worldToLocal(testVector); - compare(resultVector.x, 1, "x value of x unitVector rotated 90 degrees around y unit vector"); - compare(resultVector.y, 0, "y value of x unitVector rotated 90 degrees around y unit vector"); - compare(resultVector.z, 0, "z value of x unitVector rotated 90 degrees around y unit vector"); - } - - function test_worldToLocal_scale() - { - var testVectorNull = Qt.vector3d(0,0,0); - var testVectorX = Qt.vector3d(1,0,0); - - var resultVector = scaleTestItem.worldToLocal(testVectorNull); - compare(resultVector.x, 0, "x value of testVectorNull scale: 2.0"); - compare(resultVector.y, 0, "y value of testVectorNull scale: 2.0"); - compare(resultVector.z, 0, "z value of testVectorNull scale: 2.0"); - - resultVector = scaleTestItem.worldToLocal(testVectorX); - compare(resultVector.x, 0.5, "testVectorX.x scale: 2.0"); - compare(resultVector.y, 0, "testVectorX.y scale: 2.0"); - compare(resultVector.z, 0, "testVectorX.z scale: 2.0"); - - resultVector = scaleTestItemChild.worldToLocal(testVectorNull); - compare(resultVector.x, testVectorNull.x, "testVectorNull.x scaled up and back down"); - compare(resultVector.y, testVectorNull.y, "testVectorNull.y scaled up and back down"); - compare(resultVector.z, testVectorNull.z, "testVectorNull.z scaled up and back down"); - - resultVector = scaleTestItemChild.worldToLocal(testVectorX); - compare(resultVector.x, testVectorX.x, "testVectorX.x scaled up and back down"); - compare(resultVector.y, testVectorX.y, "testVectorX.y scaled up and back down"); - compare(resultVector.z, testVectorX.z, "testVectorX.z scaled up and back down"); - } - - function test_worldToLocal_translate() - { - var testVectorNull = Qt.vector3d(0,0,0); - var resultVectorNull = translateTestItem.worldToLocal(testVectorNull); - - compare(resultVectorNull.x, -translateTestItem.position.x, "testVectorNull x translation"); - compare(resultVectorNull.y, -translateTestItem.position.y, "testVectorNull y translation"); - compare(resultVectorNull.z, -translateTestItem.position.z, "testVectorNull z translation"); - - var childResult = child.worldToLocal(testVectorNull); - compare(childResult.x, -translateTestItem.x - child.x, "child x translation"); - compare(childResult.y, -translateTestItem.y - child.y, "child y translation"); - compare(childResult.z, -translateTestItem.z - child.z, "child z translation"); - - var testVector2 = Qt.vector3d(-1,0,123456); - var childResult2 = child.worldToLocal(testVector2); - compare(childResult2.x, testVector2.x -translateTestItem.x - child.x, "non-zero point, x translation"); - compare(childResult2.y, testVector2.y -translateTestItem.y - child.y, "non-zero point, y translation"); - compare(childResult2.z, testVector2.z -translateTestItem.z - child.z, "non-zero point, z translation"); - } - } - } -} diff --git a/tests/auto/qml3d/item3d/tst_missing_texture_coordinates.qml b/tests/auto/qml3d/item3d/tst_missing_texture_coordinates.qml deleted file mode 100644 index 55fc2e45..00000000 --- a/tests/auto/qml3d/item3d/tst_missing_texture_coordinates.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 - -Viewport { - width: 1000 - height: 800 - camera: Camera { - eye.z: 10 - } - - Item3D { - id: testItem - mesh: Mesh { source: "square.3ds" } - effect: Effect { texture: "test_data/test-image.png" } - } - - // HACK. - // The test requires that actual drawing happen, - // and it would be better to verify that directly. - Timer { - running: true - interval: 5 - onTriggered: Qt.quit() - } - - // This test is simply testing to see if the item crashes on startup, - // so this dummy test is probably not even required - function test_exists() - { - verify(testItem.visible); - Qt.quit(); - } -} diff --git a/tests/auto/qml3d/lookat/tst_lookat.qml b/tests/auto/qml3d/lookat/tst_lookat.qml deleted file mode 100644 index 574a1def..00000000 --- a/tests/auto/qml3d/lookat/tst_lookat.qml +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Item3D { - id: target1 - x: 5.0 - } - - Item3D { - id: targetNegativeXAxis - x: -5.0 - } - - Item3D { - id: targetUpVector - y: 5.0 - } - - Item3D { - id: targetExpectedUpVectorTrue - z: 5.0 - } - - Item3D { - id: item1 - transform: LookAt { - id: lookAt1 - subject: target1 - } - Item3D { - id: child1 - z: 5.0 - } - } - - Item3D { - id: itemNegativeXAxis - transform: LookAt { - id: lookAtNegativeXAxis - subject: targetNegativeXAxis - } - Item3D { - id: childNegativeXAxis - z: 5.0 - } - } - - Item3D { - id: itemUpVector - transform: LookAt { - id: lookAtUpVector - subject: targetUpVector - } - Item3D { - id: childUpVector - z: 5.0 - } - } - - Item3D { - id: itemUpVectorTrue - transform: LookAt { - id: lookAtUpVectorTrue - subject: targetUpVector - preserveUpVector: true - } - Item3D { - id: childUpVectorTrue - z: 5.0 - } - } - - TestCase { - name: "LookAt" - - // helper functions - function vectorToString(vector) { - return "Vector3D(" + vector.x + ", " + vector.y + ", " + vector.z + ")"; - } - - function compareVectors(vector1, vector2, string ) - { - compare(vector1.x, vector2.x, string + " x"); - compare(vector1.y, vector2.y, string + " y"); - compare(vector1.z, vector2.z, string + " z"); - } - - function test_lookAt() { - var testPosition = child1.localToWorld(); - var targetPosition = target1.localToWorld(); - compare(testPosition.x, targetPosition.x, "test lookAt along X axis: x"); - compare(testPosition.y, targetPosition.y, "test lookAt along X axis: y"); - compare(testPosition.z, targetPosition.z, "test lookAt along X axis: z"); - - testPosition = childNegativeXAxis.localToWorld(); - targetPosition = targetNegativeXAxis.localToWorld(); - compare(testPosition.x, targetPosition.x, "test negativeXAxis: x"); - compare(testPosition.y, targetPosition.y, "test negativeXAxis: y"); - compare(testPosition.z, targetPosition.z, "test negativeXAxis: z"); - - target1.x = -5.0; - target1.y = -5.0; - target1.z = -5.0; - // Adjust the child's Z offset to match the new target position - child1.z = Math.sqrt(target1.x*target1.x + target1.y*target1.y + - target1.z*target1.z); - - testPosition = child1.localToWorld(); - targetPosition = target1.localToWorld(); - - // compare is fuzzy by default - compare(testPosition.x, targetPosition.x, "test subject position change: x"); - compare(testPosition.y, targetPosition.y, "test subject position change: y"); - compare(testPosition.z, targetPosition.z, "test subject position change: z"); - } - - function test_preserveUpVector() { - compare(lookAtUpVector.preserveUpVector, false, "default preserveUpVector is false"); - - // Verify that the lookAt works: - var childUpVectorPosition = childUpVector.localToWorld(); - var targetUpVectorPosition = targetUpVector.localToWorld(); - compareVectors(childUpVectorPosition, targetUpVectorPosition, "preserveUpVector false"); - - var targetUpVectorPosition = targetUpVector.localToWorld(); - var childUpVectorTruePosition = childUpVectorTrue.localToWorld(); - var expectedUpVectorTruePosition = - targetExpectedUpVectorTrue.localToWorld(); - - compareVectors(childUpVectorTruePosition, - expectedUpVectorTruePosition, - "preserveUpVector true" ); - - // test that changing preserveUpVector works - lookAtUpVector.preserveUpVector = true; - compare(lookAtUpVector.preserveUpVector, true, "setPreserveUpVector(true)"); - childUpVectorPosition = childUpVector.localToWorld(); - compareVectors(childUpVectorPosition, expectedUpVectorTruePosition, "preserveUpVector set to true "); - - lookAtUpVector.preserveUpVector = false; - compare(lookAtUpVector.preserveUpVector, false, "setPreserveUpVector(false)"); - var childUpVectorSetFalsePosition = childUpVector.localToWorld(); - compareVectors(childUpVectorSetFalsePosition, - targetUpVectorPosition, - "preserveUpVector set to false "); - return; - } - } -} diff --git a/tests/auto/qml3d/mesh/test_data/teapot.bez b/tests/auto/qml3d/mesh/test_data/teapot.bez deleted file mode 100644 index 02b2ac44..00000000 --- a/tests/auto/qml3d/mesh/test_data/teapot.bez +++ /dev/null @@ -1,340 +0,0 @@ -32 -1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 -4,17,18,19,8,20,21,22,12,23,24,25,16,26,27,28 -19,29,30,31,22,32,33,34,25,35,36,37,28,38,39,40 -31,41,42,1,34,43,44,5,37,45,46,9,40,47,48,13 -13,14,15,16,49,50,51,52,53,54,55,56,57,58,59,60 -16,26,27,28,52,61,62,63,56,64,65,66,60,67,68,69 -28,38,39,40,63,70,71,72,66,73,74,75,69,76,77,78 -40,47,48,13,72,79,80,49,75,81,82,53,78,83,84,57 -57,58,59,60,85,86,87,88,89,90,91,92,93,94,95,96 -60,67,68,69,88,97,98,99,92,100,101,102,96,103,104,105 -69,76,77,78,99,106,107,108,102,109,110,111,105,112,113,114 -78,83,84,57,108,115,116,85,111,117,118,89,114,119,120,93 -121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136 -124,137,138,121,128,139,140,125,132,141,142,129,136,143,144,133 -133,134,135,136,145,146,147,148,149,150,151,152,69,153,154,155 -136,143,144,133,148,156,157,145,152,158,159,149,155,160,161,69 -162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177 -165,178,179,162,169,180,181,166,173,182,183,170,177,184,185,174 -174,175,176,177,186,187,188,189,190,191,192,193,194,195,196,197 -177,184,185,174,189,198,199,186,193,200,201,190,197,202,203,194 -204,204,204,204,207,208,209,210,211,211,211,211,212,213,214,215,4 -204,204,204,204,210,217,218,219,211,211,211,211,215,220,221,222,4 -204,204,204,204,219,224,225,226,211,211,211,211,222,227,228,229,4 -204,204,204,204,226,230,231,207,211,211,211,211,229,232,233,212,4 -212,213,214,215,234,235,236,237,238,239,240,241,242,243,244,245 -215,220,221,222,237,246,247,248,241,249,250,251,245,252,253,254 -222,227,228,229,248,255,256,257,251,258,259,260,254,261,262,263 -229,232,233,212,257,264,265,234,260,266,267,238,263,268,269,242 -270,270,270,270,279,280,281,282,275,276,277,278,271,272,273,274,4 -270,270,270,270,282,289,290,291,278,286,287,288,274,283,284,285,4 -270,270,270,270,291,298,299,300,288,295,296,297,285,292,293,294,4 -270,270,270,270,300,305,306,279,297,303,304,275,294,301,302,271,4 -306 -0.700000,0.450000,-0.000000 -0.700000,0.450000,0.392000 -0.392000,0.450000,0.700000 -0.000000,0.450000,0.700000 -0.668750,0.515625,-0.000000 -0.668750,0.515625,0.374500 -0.374500,0.515625,0.668750 -0.000000,0.515625,0.668750 -0.718750,0.515625,-0.000000 -0.718750,0.515625,0.402500 -0.402500,0.515625,0.718750 -0.000000,0.515625,0.718750 -0.750000,0.450000,-0.000000 -0.750000,0.450000,0.420000 -0.420000,0.450000,0.750000 -0.000000,0.450000,0.750000 --0.392000,0.450000,0.700000 --0.700000,0.450000,0.392000 --0.700000,0.450000,-0.000000 --0.374500,0.515625,0.668750 --0.668750,0.515625,0.374500 --0.668750,0.515625,-0.000000 --0.402500,0.515625,0.718750 --0.718750,0.515625,0.402500 --0.718750,0.515625,-0.000000 --0.420000,0.450000,0.750000 --0.750000,0.450000,0.420000 --0.750000,0.450000,-0.000000 --0.700000,0.450000,-0.392000 --0.392000,0.450000,-0.700000 -0.000000,0.450000,-0.700000 --0.668750,0.515625,-0.374500 --0.374500,0.515625,-0.668750 -0.000000,0.515625,-0.668750 --0.718750,0.515625,-0.402500 --0.402500,0.515625,-0.718750 -0.000000,0.515625,-0.718750 --0.750000,0.450000,-0.420000 --0.420000,0.450000,-0.750000 -0.000000,0.450000,-0.750000 -0.392000,0.450000,-0.700000 -0.700000,0.450000,-0.392000 -0.374500,0.515625,-0.668750 -0.668750,0.515625,-0.374500 -0.402500,0.515625,-0.718750 -0.718750,0.515625,-0.402500 -0.420000,0.450000,-0.750000 -0.750000,0.450000,-0.420000 -0.875000,0.187500,-0.000000 -0.875000,0.187500,0.490000 -0.490000,0.187500,0.875000 -0.000000,0.187500,0.875000 -1.000000,-0.075000,-0.000000 -1.000000,-0.075000,0.560000 -0.560000,-0.075000,1.000000 -0.000000,-0.075000,1.000000 -1.000000,-0.300000,-0.000000 -1.000000,-0.300000,0.560000 -0.560000,-0.300000,1.000000 -0.000000,-0.300000,1.000000 --0.490000,0.187500,0.875000 --0.875000,0.187500,0.490000 --0.875000,0.187500,-0.000000 --0.560000,-0.075000,1.000000 --1.000000,-0.075000,0.560000 --1.000000,-0.075000,-0.000000 --0.560000,-0.300000,1.000000 --1.000000,-0.300000,0.560000 --1.000000,-0.300000,-0.000000 --0.875000,0.187500,-0.490000 --0.490000,0.187500,-0.875000 -0.000000,0.187500,-0.875000 --1.000000,-0.075000,-0.560000 --0.560000,-0.075000,-1.000000 -0.000000,-0.075000,-1.000000 --1.000000,-0.300000,-0.560000 --0.560000,-0.300000,-1.000000 -0.000000,-0.300000,-1.000000 -0.490000,0.187500,-0.875000 -0.875000,0.187500,-0.490000 -0.560000,-0.075000,-1.000000 -1.000000,-0.075000,-0.560000 -0.560000,-0.300000,-1.000000 -1.000000,-0.300000,-0.560000 -1.000000,-0.525000,-0.000000 -1.000000,-0.525000,0.560000 -0.560000,-0.525000,1.000000 -0.000000,-0.525000,1.000000 -0.750000,-0.637500,-0.000000 -0.750000,-0.637500,0.420000 -0.420000,-0.637500,0.750000 -0.000000,-0.637500,0.750000 -0.750000,-0.675000,-0.000000 -0.750000,-0.675000,0.420000 -0.420000,-0.675000,0.750000 -0.000000,-0.675000,0.750000 --0.560000,-0.525000,1.000000 --1.000000,-0.525000,0.560000 --1.000000,-0.525000,-0.000000 --0.420000,-0.637500,0.750000 --0.750000,-0.637500,0.420000 --0.750000,-0.637500,-0.000000 --0.420000,-0.675000,0.750000 --0.750000,-0.675000,0.420000 --0.750000,-0.675000,-0.000000 --1.000000,-0.525000,-0.560000 --0.560000,-0.525000,-1.000000 -0.000000,-0.525000,-1.000000 --0.750000,-0.637500,-0.420000 --0.420000,-0.637500,-0.750000 -0.000000,-0.637500,-0.750000 --0.750000,-0.675000,-0.420000 --0.420000,-0.675000,-0.750000 -0.000000,-0.675000,-0.750000 -0.560000,-0.525000,-1.000000 -1.000000,-0.525000,-0.560000 -0.420000,-0.637500,-0.750000 -0.750000,-0.637500,-0.420000 -0.420000,-0.675000,-0.750000 -0.750000,-0.675000,-0.420000 --0.800000,0.262500,-0.000000 --0.800000,0.262500,0.150000 --0.750000,0.375000,0.150000 --0.750000,0.375000,-0.000000 --1.150000,0.262500,-0.000000 --1.150000,0.262500,0.150000 --1.250000,0.375000,0.150000 --1.250000,0.375000,-0.000000 --1.350000,0.262500,-0.000000 --1.350000,0.262500,0.150000 --1.500000,0.375000,0.150000 --1.500000,0.375000,-0.000000 --1.350000,0.150000,-0.000000 --1.350000,0.150000,0.150000 --1.500000,0.150000,0.150000 --1.500000,0.150000,-0.000000 --0.750000,0.375000,-0.150000 --0.800000,0.262500,-0.150000 --1.250000,0.375000,-0.150000 --1.150000,0.262500,-0.150000 --1.500000,0.375000,-0.150000 --1.350000,0.262500,-0.150000 --1.500000,0.150000,-0.150000 --1.350000,0.150000,-0.150000 --1.350000,0.037500,-0.000000 --1.350000,0.037500,0.150000 --1.500000,-0.075000,0.150000 --1.500000,-0.075000,-0.000000 --1.250000,-0.187500,-0.000000 --1.250000,-0.187500,0.150000 --1.325000,-0.281250,0.150000 --1.325000,-0.281250,-0.000000 --1.000000,-0.300000,0.150000 --0.950000,-0.450000,0.150000 --0.950000,-0.450000,-0.000000 --1.500000,-0.075000,-0.150000 --1.350000,0.037500,-0.150000 --1.325000,-0.281250,-0.150000 --1.250000,-0.187500,-0.150000 --0.950000,-0.450000,-0.150000 --1.000000,-0.300000,-0.150000 -0.850000,-0.037500,-0.000000 -0.850000,-0.037500,0.330000 -0.850000,-0.450000,0.330000 -0.850000,-0.450000,-0.000000 -1.300000,-0.037500,-0.000000 -1.300000,-0.037500,0.330000 -1.550000,-0.337500,0.330000 -1.550000,-0.337500,-0.000000 -1.150000,0.300000,-0.000000 -1.150000,0.300000,0.125000 -1.200000,0.262500,0.125000 -1.200000,0.262500,-0.000000 -1.350000,0.450000,-0.000000 -1.350000,0.450000,0.125000 -1.650000,0.450000,0.125000 -1.650000,0.450000,-0.000000 -0.850000,-0.450000,-0.330000 -0.850000,-0.037500,-0.330000 -1.550000,-0.337500,-0.330000 -1.300000,-0.037500,-0.330000 -1.200000,0.262500,-0.125000 -1.150000,0.300000,-0.125000 -1.650000,0.450000,-0.125000 -1.350000,0.450000,-0.125000 -1.400000,0.487500,-0.000000 -1.400000,0.487500,0.125000 -1.762500,0.496875,0.125000 -1.762500,0.496875,-0.000000 -1.450000,0.487500,-0.000000 -1.450000,0.487500,0.075000 -1.725000,0.506250,0.075000 -1.725000,0.506250,-0.000000 -1.400000,0.450000,-0.000000 -1.400000,0.450000,0.075000 -1.600000,0.450000,0.075000 -1.600000,0.450000,-0.000000 -1.762500,0.496875,-0.125000 -1.400000,0.487500,-0.125000 -1.725000,0.506250,-0.075000 -1.450000,0.487500,-0.075000 -1.600000,0.450000,-0.075000 -1.400000,0.450000,-0.075000 -0.000000,0.825000,-0.000000 -0.000000,0.825000,0.001000 -0.001000,0.825000,-0.000000 -0.400000,0.825000,-0.000000 -0.400000,0.825000,0.225000 -0.225000,0.825000,0.400000 -0.000000,0.825000,0.400000 -0.000000,0.675000,-0.000000 -0.100000,0.600000,-0.000000 -0.100000,0.600000,0.056000 -0.056000,0.600000,0.100000 -0.000000,0.600000,0.100000 --0.001000,0.825000,-0.000000 --0.225000,0.825000,0.400000 --0.400000,0.825000,0.225000 --0.400000,0.825000,-0.000000 --0.056000,0.600000,0.100000 --0.100000,0.600000,0.056000 --0.100000,0.600000,-0.000000 -0.000000,0.825000,-0.001000 --0.400000,0.825000,-0.225000 --0.225000,0.825000,-0.400000 -0.000000,0.825000,-0.400000 --0.100000,0.600000,-0.056000 --0.056000,0.600000,-0.100000 -0.000000,0.600000,-0.100000 -0.225000,0.825000,-0.400000 -0.400000,0.825000,-0.225000 -0.056000,0.600000,-0.100000 -0.100000,0.600000,-0.056000 -0.200000,0.525000,-0.000000 -0.200000,0.525000,0.112000 -0.112000,0.525000,0.200000 -0.000000,0.525000,0.200000 -0.650000,0.525000,-0.000000 -0.650000,0.525000,0.364000 -0.364000,0.525000,0.650000 -0.000000,0.525000,0.650000 -0.650000,0.450000,-0.000000 -0.650000,0.450000,0.364000 -0.364000,0.450000,0.650000 -0.000000,0.450000,0.650000 --0.112000,0.525000,0.200000 --0.200000,0.525000,0.112000 --0.200000,0.525000,-0.000000 --0.364000,0.525000,0.650000 --0.650000,0.525000,0.364000 --0.650000,0.525000,-0.000000 --0.364000,0.450000,0.650000 --0.650000,0.450000,0.364000 --0.650000,0.450000,-0.000000 --0.200000,0.525000,-0.112000 --0.112000,0.525000,-0.200000 -0.000000,0.525000,-0.200000 --0.650000,0.525000,-0.364000 --0.364000,0.525000,-0.650000 -0.000000,0.525000,-0.650000 --0.650000,0.450000,-0.364000 --0.364000,0.450000,-0.650000 -0.000000,0.450000,-0.650000 -0.112000,0.525000,-0.200000 -0.200000,0.525000,-0.112000 -0.364000,0.525000,-0.650000 -0.650000,0.525000,-0.364000 -0.364000,0.450000,-0.650000 -0.650000,0.450000,-0.364000 -0.000000,-0.750000,-0.000000 -0.750000,-0.675000,-0.000000 -0.750000,-0.675000,-0.420000 -0.420000,-0.675000,-0.750000 -0.000000,-0.675000,-0.750000 -0.750000,-0.712500,-0.000000 -0.750000,-0.712500,-0.420000 -0.420000,-0.712500,-0.750000 -0.000000,-0.712500,-0.750000 -0.712500,-0.750000,-0.000000 -0.712500,-0.750000,-0.399000 -0.399000,-0.750000,-0.712500 -0.000000,-0.750000,-0.712500 --0.420000,-0.675000,-0.750000 --0.750000,-0.675000,-0.420000 --0.750000,-0.675000,-0.000000 --0.420000,-0.712500,-0.750000 --0.750000,-0.712500,-0.420000 --0.750000,-0.712500,-0.000000 --0.399000,-0.750000,-0.712500 --0.712500,-0.750000,-0.399000 --0.712500,-0.750000,-0.000000 --0.750000,-0.675000,0.420000 --0.420000,-0.675000,0.750000 -0.000000,-0.675000,0.750000 --0.750000,-0.712500,0.420000 --0.420000,-0.712500,0.750000 -0.000000,-0.712500,0.750000 --0.712500,-0.750000,0.399000 --0.399000,-0.750000,0.712500 -0.000000,-0.750000,0.712500 -0.420000,-0.675000,0.750000 -0.750000,-0.675000,0.420000 -0.420000,-0.712500,0.750000 -0.750000,-0.712500,0.420000 -0.399000,-0.750000,0.712500 -0.712500,-0.750000,0.399000 diff --git a/tests/auto/qml3d/mesh/tst_mesh.qml b/tests/auto/qml3d/mesh/tst_mesh.qml deleted file mode 100644 index bab75140..00000000 --- a/tests/auto/qml3d/mesh/tst_mesh.qml +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Mesh { - id: url_test_mesh - source: "" - onDataChanged: { dataChangedCounter += 1 } - property int dataChangedCounter: 0 - } - - Mesh { - id: meshName_test_mesh - onDataChanged: { dataChangedCounter += 1 } - property int dataChangedCounter: 0 - } - - Mesh { - id: meshName_test_mesh2 - meshName: "testName" - onDataChanged: { dataChangedCounter += 1 } - property int dataChangedCounter: 0 - } - - Mesh { - id: options_test_mesh - onOptionsChanged: { optionsChangedCounter += 1} - property int optionsChangedCounter: 0 - } - - TestCase { - name: "Mesh" - id: meshTest - - function test_url() { - compare(url_test_mesh.dataChangedCounter, 0, "pre-test counter validation") - compare(url_test_mesh.source, "", "null default source") - - - var testString = "test_data/teapot.bez"; - url_test_mesh.source = testString; - - // QUrl contains the absolute file path, so just compare the end - var substring = url_test_mesh.source.toString().substr(-testString.length,testString.length); - compare(substring, testString, "setSource() (relative file path)"); - compare(url_test_mesh.dataChangedCounter, 1, "dataChanged signal") - } - - function test_meshName() { - meshName_test_mesh.dataChangedCounter = 0; - compare(meshName_test_mesh.dataChangedCounter, 0, "pre-test counter validation") - - compare(meshName_test_mesh.meshName, "", "null default meshName"); - compare(meshName_test_mesh2.meshName, "testName", "qml assignment test"); - - meshName_test_mesh.meshName = "setMeshNameTestName"; - compare(meshName_test_mesh.meshName, "setMeshNameTestName", "setMeshNameTestName"); - compare(meshName_test_mesh.dataChangedCounter, 1, "dataChanged signal") - } - - function test_options() { - compare(options_test_mesh.optionsChangedCounter, 0, - "pretest validation") - compare(options_test_mesh.options, "", "null default options"); - - options_test_mesh.options="test options string"; - compare(options_test_mesh.options, "test options string", - "setOptionsString"); - - options_test_mesh.options="test options string"; - compare(options_test_mesh.options, "test options string", - "setOptions()"); - compare(options_test_mesh.optionsChangedCounter, 1, - "optionsChanged signal 1"); - - options_test_mesh.options=" \\ \ \$"; - compare(options_test_mesh.options, " \\ \ \$", - "potentially troublesome characters") - compare(options_test_mesh.optionsChangedCounter, 2, - "optionsChanged signal 2"); - } - } -} diff --git a/tests/auto/qml3d/modelview/textures/amethyst.jpg b/tests/auto/qml3d/modelview/textures/amethyst.jpg Binary files differdeleted file mode 100644 index 43a2c440..00000000 --- a/tests/auto/qml3d/modelview/textures/amethyst.jpg +++ /dev/null diff --git a/tests/auto/qml3d/modelview/textures/bigblue.jpg b/tests/auto/qml3d/modelview/textures/bigblue.jpg Binary files differdeleted file mode 100644 index 8a0bb653..00000000 --- a/tests/auto/qml3d/modelview/textures/bigblue.jpg +++ /dev/null diff --git a/tests/auto/qml3d/modelview/textures/blueweb.jpg b/tests/auto/qml3d/modelview/textures/blueweb.jpg Binary files differdeleted file mode 100644 index 68f3d350..00000000 --- a/tests/auto/qml3d/modelview/textures/blueweb.jpg +++ /dev/null diff --git a/tests/auto/qml3d/modelview/textures/pastelstuff.jpg b/tests/auto/qml3d/modelview/textures/pastelstuff.jpg Binary files differdeleted file mode 100644 index 82da86e0..00000000 --- a/tests/auto/qml3d/modelview/textures/pastelstuff.jpg +++ /dev/null diff --git a/tests/auto/qml3d/modelview/textures/qtlogo.png b/tests/auto/qml3d/modelview/textures/qtlogo.png Binary files differdeleted file mode 100644 index 7d3e97eb..00000000 --- a/tests/auto/qml3d/modelview/textures/qtlogo.png +++ /dev/null diff --git a/tests/auto/qml3d/modelview/textures/threedgreen.jpg b/tests/auto/qml3d/modelview/textures/threedgreen.jpg Binary files differdeleted file mode 100644 index 7624527f..00000000 --- a/tests/auto/qml3d/modelview/textures/threedgreen.jpg +++ /dev/null diff --git a/tests/auto/qml3d/modelview/tst_modelview.qml b/tests/auto/qml3d/modelview/tst_modelview.qml deleted file mode 100644 index 2b7fa0e1..00000000 --- a/tests/auto/qml3d/modelview/tst_modelview.qml +++ /dev/null @@ -1,270 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 -import QtQuickTest 1.0 - -Rectangle -{ - id: topLevel - width: 480; height: 480 - - Viewport { - id: viewport - picking: true - anchors.fill: parent - - camera: Camera { - id: main_camera - eye: Qt.vector3d(0, 4, 12) - center: Qt.vector3d(0, 0, -2.5) - } - - property variant emptyStringListModel:[] - - property variant stringListModelForViewport:[ - "textures/threedgreen.jpg", - "textures/amethyst.jpg", - "textures/bigblue.jpg", - "textures/pastelstuff.jpg", - "textures/blueweb.jpg", - "textures/qtlogo.png" - ] - - property variant stringListModelEmptyForItem: [] - - property variant stringListModelForItem:[ - "textures/amethyst.jpg", - "textures/pastelstuff.jpg", - "textures/bigblue.jpg", - "textures/qtlogo.png", - "textures/blueweb.jpg", - "textures/threedgreen.jpg" - ] - - ListModel { - id: listModelForViewport - ListElement { image:"textures/threedgreen.jpg"} - ListElement { image:"textures/amethyst.jpg"} - ListElement { image:"textures/bigblue.jpg"} - ListElement { image:"textures/pastelstuff.jpg"} - ListElement { image:"textures/blueweb.jpg"} - ListElement { image:"textures/qtlogo.png"} - } - - ListModel { - id: listModelForItem - ListElement { image:"textures/amethyst.jpg"} - ListElement { image:"textures/pastelstuff.jpg"} - ListElement { image:"textures/bigblue.jpg"} - ListElement { image:"textures/qtlogo.png"} - ListElement { image:"textures/blueweb.jpg"} - ListElement { image:"textures/threedgreen.jpg"} - } - - Component { - id: paneComponentstringList - Quad { - property real layer: index - property variant image : modelData - position: Qt.vector3d(0, 0, -layer) - effect: Effect { decal: true; texture: image } - transform: Rotation3D { axis: Qt.vector3d(1,0,0); angle: 90 } - } - } - - Component { - id: paneComponentListModel - Quad { - position: Qt.vector3d(index * 0.1, 0, -index) - enabled: index != -1 - effect: Effect { decal: true; - texture: model.image; - } - transform: Rotation3D { axis: Qt.vector3d(1,0,0); angle: 90 } - } - } - - Repeater { - id: stringListModelRepeaterInViewport - delegate: paneComponentstringList - model: parent.stringListModelEmpty - } - - Repeater { - id: listModelRepeaterInViewport - delegate: paneComponentListModel - model: listModelForViewport - } - - Item3D { - id: stringListModelParentItem - x: -2.1 - Repeater { - id: stringListModelRepeaterInItem - delegate: paneComponentstringList - model: viewport.stringListModelEmpty - } - } - - Item3D { - id: listModelParentItem - x: 2.1 - y: 0.5 - - Repeater { - id: listModelRepeaterInItem - delegate: paneComponentListModel - model: listModelForItem - } - } - - TestCase { - id: modelViewTestAddingCase -// when: false - name: "Quick3d ModelView Adding Data Test" - - function test_changing_stringList_model() { - var viewportEmptyModelChildCount = viewport.children.length; - var itemEmptyModelChildCount = - stringListModelParentItem.children.length; - var modelLength = viewport.stringListModelForViewport.length; - - stringListModelRepeaterInViewport.model = - viewport.stringListModelForViewport; - - verify(viewport.children.length > - viewportEmptyModelChildCount, - "Children not added to viewport with changed stringList model"); - compare(viewport.children.length, - viewportEmptyModelChildCount + - viewport.stringListModelForViewport.length, - "Viewport has unexpected number of new children"); - - stringListModelRepeaterInItem.model = - viewport.stringListModelForItem; - - verify(stringListModelParentItem.children.length > - itemEmptyModelChildCount, - "Children not added to Item3D with changed stringList model"); - compare(stringListModelParentItem.children.length, - itemEmptyModelChildCount + - viewport.stringListModelForItem.length, - "Item3D has unexpected number of new children"); - } - - function test_adding_to_listModel() { - var viewportChildCount = viewport.children.length; - var itemChildCount = listModelParentItem.children.length; - - listModelForViewport.append({"image":"textures/pastelstuff.jpg"}); - listModelForItem.append({"image":"textures/pastelstuff.jpg"}); - viewport.update3d(); - compare(viewport.children.length, viewportChildCount + 1, - "Viewport missing child after listModel.append()"); - compare(listModelParentItem.children.length, - itemChildCount + 1, - "Item3D missing child after listModel.append()"); - } - } - - // This timer is to avoid an issue where removing children is - // delayed during initialization. - Timer { - running: true - interval: 1 - onTriggered: modelViewRemovingItemsTestCase.when = true; - } - - TestCase { - id: modelViewRemovingItemsTestCase - // Wait for event loop before performing removal tests - when: false - name: "Quick3d ModelView Removing Data Test" - - function test_removing_from_listModel() { - var viewportChildCount = viewport.children.length; - var itemChildCount = listModelParentItem.children.length; - - listModelForViewport.remove(listModelForViewport.count - 1); - compare(viewport.children.length, viewportChildCount -1, - "Viewport has extra children after listModel.remove()") - - listModelForItem.remove(listModelForItem.count -1); - compare(listModelParentItem.children.length, - itemChildCount - 1, - "Item3D has extra children after listModel.remove()"); - } - - function test_clearing_stringList() { - stringListModelRepeaterInViewport.model = - viewport.stringListModelForViewport; - stringListModelRepeaterInItem.model = - viewport.stringListModelForItem; - - var viewportChildCount = viewport.children.length; - var itemChildCount = stringListModelParentItem.children.length; - - stringListModelRepeaterInViewport.model = - viewport.emptyStringListModel; - stringListModelRepeaterInItem.model = - viewport.emptyStringListModel; - - verify(viewport.children.length < viewportChildCount, - "Children not removed from viewport when clearing stringList model"); - compare(viewport.children.length, - viewportChildCount - - viewport.stringListModelForViewport.length, - "Unexpected number of children after setting empty model"); - - verify(stringListModelParentItem.children.length < - itemChildCount, - "Children not removed from Item3D when clearing stringList model"); - compare(stringListModelParentItem.children.length, - itemChildCount - - viewport.stringListModelForItem.length, - "Unexpected number of children after setting empty model"); - } - } - } -} diff --git a/tests/auto/qml3d/picking/tst_picking.qml b/tests/auto/qml3d/picking/tst_picking.qml deleted file mode 100644 index 94ee6553..00000000 --- a/tests/auto/qml3d/picking/tst_picking.qml +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 -import QtQuickTest 1.0 - -Rectangle -{ - id: topLevel - width: 480; height: 480 - - Viewport { - id: viewport - width: 480; height: 480 - picking: true - - // Result of manual click - property color clickedColor: "#000000" - - Quad { - id: fullScreenQuad - - transform: [ - Rotation3D { - axis: Qt.vector3d(1,0,0); - angle: 90 - }, - Scale3D { - // a scale 4 quad will fill a square viewport - scale: 4 - } - ] - position: Qt.vector3d(0, 0, 0) - property color color: "#ff0000" - - effect: Effect { - color: fullScreenQuad.color - } - - onClicked: { - viewport.clickedColor = fullScreenQuad.color - } - } - - Quad { - id: smallerQuad - - transform: [ - Rotation3D { - axis: Qt.vector3d(1,0,0); - angle: 90 - }, - // Bring quad forwards a little bit to ensure it's drawn - Translation3D { translate: Qt.vector3d(0,0,0.1)} - ] - - position: Qt.vector3d(0, 0, 0) - property color color: "#0000ff" - - effect: Effect { - color: smallerQuad.color - } - - onClicked: { - viewport.clickedColor = smallerQuad.color - } - } - - Component { - id: pickTestDelegate - Quad { - objectName: "foo" - transform: [ - Rotation3D { - axis: Qt.vector3d(1,0,0); - angle: 90 - }, - // Bring quad forwards a little bit to ensure it's drawn - Translation3D { translate: Qt.vector3d(0,0,0.1)} - ] - - // Ensure items are above smallerQuad - position: Qt.vector3d(0, 0, (index + 1) * 0.1) - property color color: model.color - } - } - - ListModel{ - id: pickTestModel - } - - Repeater { - delegate: pickTestDelegate - model: pickTestModel - } - - // picking fails until the first paint occurs. There's no - // straight-forward way to wait for the first paint, so we'll use a - // timer to allow the paint to happen. - - Timer { - id: paintedTest - running: true - interval: 1 - repeat: true - onTriggered: { - var x = viewport.width / 2; - var y = viewport.height / 2; - // Usually succeeds on the first run -// console.log("objectForPoint(" + x + "," + y + "): " + viewport.objectForPoint(x,y) ); - if (viewport.objectForPoint(x,y) != null) - pickingTestCase.when = true; - } - } - - // Time out and fail - Timer { - running: true - interval: 2000 - onTriggered: { - pickingTestCase.timedOut = true; - pickingTestCase.when = true; - } - } - - TestCase { - id: pickingTestCase - name: "Picking Test" - - // Delay test until after first paint - when: false - property bool timedOut : false - - property int midX : viewport.width / 2; - property int midY : viewport.height / 2; - function test_picking() { - verify(!timedOut, "timed out"); - verify(viewport.objectForPoint(0,0) == fullScreenQuad, - "Didn't find full screen quad in top left corner"); - verify(viewport.objectForPoint(midX,midY) == smallerQuad, - "Didn't find smaller quad at midpoint"); - verify(viewport.objectForPoint(-midX,-midY) == null, - "Incorrectly found object off viewport"); - pickTestModel.append({"color":"#00ff00"}); - verify(viewport.objectForPoint(midX,midY).color == "#00ff00", - "Didn't find modelview quad at midpoint"); - pickTestModel.append({"color":"#ff00ff"}); - verify(viewport.objectForPoint(midX,midY).color == "#ff00ff", - "Didn't find second modelview quad at midpoint"); - } - } - } -} diff --git a/tests/auto/qml3d/qml3d.pro b/tests/auto/qml3d/qml3d.pro deleted file mode 100644 index 4da6138c..00000000 --- a/tests/auto/qml3d/qml3d.pro +++ /dev/null @@ -1,23 +0,0 @@ -load(qttest_p4.prf) -TEMPLATE=app -CONFIG += unittest warn_on -QT += declarative opengl -SOURCES += tst_qml3d.cpp -DEFINES += QML3D_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" -win32:DEFINES+=_CRT_SECURE_NO_WARNINGS - -OTHER_FILES += \ - lookat/tst_lookat.qml \ - QtQuickTest/TestCase.qml \ - scale3d/tst_scale3d.qml \ - modelview/tst_modelview.qml \ - sphere/tst_sphere.qml \ - effect/tst_effect.qml \ - viewport/tst_viewport.qml \ - mesh/tst_mesh.qml \ - picking/tst_picking.qml \ - item3d/tst_item3d.qml \ - item3d/tst_missing_texture_coordinates.qml \ - item3d/tst_item3d_local_v_world.qml - - diff --git a/tests/auto/qml3d/scale3d/tst_scale3d.qml b/tests/auto/qml3d/scale3d/tst_scale3d.qml deleted file mode 100644 index 2759e578..00000000 --- a/tests/auto/qml3d/scale3d/tst_scale3d.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Scale3D { - id: scale1 - scale: 2.5 - } - - Scale3D { - id: scale2 - scale: Qt.vector3d(1.0, 0.5, -2.0) - } - - Scale3D { - id: scale3 - property int changed: 0 - onScaleChanged: ++changed - } - - Scale3D { - id: scale4 - property int changed: 0 - onOriginChanged: ++changed - } - - TestCase { - name: "Scale3D" - - function test_uniformScale() { - compare(scale1.scale, Qt.vector3d(2.5, 2.5, 2.5), "uniform1") - scale1.scale = 4.5 - compare(scale1.scale, Qt.vector3d(4.5, 4.5, 4.5), "uniform2") - scale1.scale = Qt.vector3d(3.0, -2.5, 1.5) - compare(scale1.scale, Qt.vector3d(3.0, -2.5, 1.5), "uniform3") - } - - function test_nonUniformScale() { - compare(scale2.scale, Qt.vector3d(1.0, 0.5, -2.0), "nonuniform1") - scale2.scale = Qt.vector3d(3.0, -2.5, 1.5) - compare(scale2.scale, Qt.vector3d(3.0, -2.5, 1.5), "nonuniform2") - scale2.scale = 4.5 - compare(scale2.scale, Qt.vector3d(4.5, 4.5, 4.5), "nonuniform3") - } - - function test_scaleChanged() { - compare(scale3.scale, Qt.vector3d(1.0, 1.0, 1.0), "changed1") - compare(scale3.changed, 0, "changed2") - scale3.scale = Qt.vector3d(3.0, -2.5, 1.5) - compare(scale3.scale, Qt.vector3d(3.0, -2.5, 1.5), "changed3") - compare(scale3.changed, 1, "changed3") - scale3.scale = 4.5 - compare(scale3.scale, Qt.vector3d(4.5, 4.5, 4.5), "changed4") - compare(scale3.changed, 2, "changed4") - } - - function test_originChanged() { - compare(scale4.origin, Qt.vector3d(0.0, 0.0, 0.0), "changed1") - compare(scale4.changed, 0, "changed2") - scale4.origin = Qt.vector3d(3.0, -2.5, 1.5) - compare(scale4.origin, Qt.vector3d(3.0, -2.5, 1.5), "changed3") - compare(scale4.changed, 1, "changed3") - } - } -} diff --git a/tests/auto/qml3d/shaders/test.png b/tests/auto/qml3d/shaders/test.png Binary files differdeleted file mode 100644 index 80a4868f..00000000 --- a/tests/auto/qml3d/shaders/test.png +++ /dev/null diff --git a/tests/auto/qml3d/shaders/tst_shaders.qml b/tests/auto/qml3d/shaders/tst_shaders.qml deleted file mode 100644 index 2a4258af..00000000 --- a/tests/auto/qml3d/shaders/tst_shaders.qml +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - width: 480 - height: 320 - - property string fragmentShader: "\ -\ - void main(void)\ - {\ - gl_FragColor = vec4(1,0,1,1);\ - }\ - " - - property string vertexShader: "\ - attribute highp vec4 qt_Vertex;\ - uniform mediump mat4 qt_ModelViewProjectionMatrix;\ -\ - void main(void)\ - {\ - gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;\ - }\ - " - - Effect { - id: testEffect - material: china - } - - Cube { - id: testItemWithNullFragmentShader - effect: testShaderProgramWithNullFragmentShader - x: -1.5; - } - - Cube { - id: testItem - effect: testShaderProgram - } - - Cube { - id: testItemWithNullVertexShader - effect: testShaderProgramWithNullVertexShader - x: 1.5 - } - - - // Simple - Timer { - running: true - interval: 1 - onTriggered: { - shadersTest.when = true; - viewport.update3d(); - } - } - - TestCase { - id: shadersTest - - // Delay test until after first paint - when: false - // - function test_null_fragment_shader() { - // a test failure is an assert during shader program linking - // so if execution reaches this point, the test has passed - verify(true, "shader program didn't crash with null shaders"); - } - } - - ShaderProgram { - id: testShaderProgram - fragmentShader: viewport.fragmentShader - vertexShader: viewport.vertexShader - } - - ShaderProgram { - id: testShaderProgramWithNullFragmentShader - - fragmentShader: "" - vertexShader: viewport.vertexShader - } - - ShaderProgram { - id: testShaderProgramWithNullVertexShader - fragmentShader: viewport.fragmentShader - vertexShader: "" - } - -} diff --git a/tests/auto/qml3d/sphere/tst_sphere.qml b/tests/auto/qml3d/sphere/tst_sphere.qml deleted file mode 100644 index 1d211a49..00000000 --- a/tests/auto/qml3d/sphere/tst_sphere.qml +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Sphere { - id: sphere1 - } - - Sphere { - id: sphere2 - radius: 3.5 - levelOfDetail: 2 - axis: Qt.YAxis - } - - Sphere { - id: sphere3 - radius: -3.5 - levelOfDetail: 23 // Valid, but clamped during drawing - axis: Qt.XAxis - } - - Sphere { - id: sphere4 - property int radChanged: 0 - property int lodChanged: 0 - property int axChanged: 0 - onRadiusChanged: ++radChanged - onLevelOfDetailChanged: ++lodChanged - onAxisChanged: ++axChanged - } - - TestCase { - name: "Sphere" - - function test_defaults() { - compare(sphere1.radius, 1, "radius"); - compare(sphere1.levelOfDetail, 5, "levelOfDetail"); - compare(sphere1.axis, Qt.ZAxis, "axis"); - } - - function test_properties() { - compare(sphere2.radius, 3.5, "radius"); - compare(sphere2.levelOfDetail, 2, "levelOfDetail"); - compare(sphere2.axis, Qt.YAxis, "axis"); - compare(sphere3.radius, -3.5, "radius (B)"); - compare(sphere3.levelOfDetail, 10, "levelOfDetail (B)"); - compare(sphere3.axis, Qt.XAxis, "axis (B)"); - } - - function test_radiusChanged() { - compare(sphere4.radius, 1, "radius"); - compare(sphere4.radChanged, 0, "changed 1"); - sphere4.radius = 3.5 - compare(sphere4.radChanged, 1, "changed 2"); - compare(sphere4.radius, 3.5, "radius modified"); - sphere4.radius = 3.5 - compare(sphere4.radChanged, 1, "changed 3"); - } - - function test_levelOfDetailChanged() { - compare(sphere4.levelOfDetail, 5, "levelOfDetail"); - compare(sphere4.lodChanged, 0, "changed 1"); - sphere4.levelOfDetail = 2 - compare(sphere4.lodChanged, 1, "changed 2"); - compare(sphere4.levelOfDetail, 2, "levelOfDetail modified"); - sphere4.levelOfDetail = 2 - compare(sphere4.lodChanged, 1, "changed 3"); - } - - function test_axisChanged() { - compare(sphere4.axis, Qt.ZAxis, "axis"); - compare(sphere4.axChanged, 0, "changed 1"); - sphere4.axis = Qt.YAxis - compare(sphere4.axChanged, 1, "changed 2"); - compare(sphere4.axis, Qt.YAxis, "axis modified"); - sphere4.axis = Qt.YAxis - compare(sphere4.axChanged, 1, "changed 3"); - } - } -} diff --git a/tests/auto/qml3d/tst_qml3d.cpp b/tests/auto/qml3d/tst_qml3d.cpp deleted file mode 100644 index d8757a39..00000000 --- a/tests/auto/qml3d/tst_qml3d.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/**************************************************************************** -** -** 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 <QApplication> -#include <QtDeclarative/qdeclarative.h> -#include <QtDeclarative/qdeclarativeview.h> -#include <QtDeclarative/qdeclarativeengine.h> -#include <QtDeclarative/qdeclarativecontext.h> -#include <QtOpenGL/qgl.h> -#include <QtCore/qurl.h> -#include <QtCore/qfileinfo.h> -#include <QtCore/qdir.h> -#include <QtCore/qdebug.h> -#include <QtCore/qeventloop.h> -#include <QtGui/qtextdocument.h> -#include <QtTest/qtestcase.h> -#include <stdio.h> - -class QuitObject : public QObject -{ - Q_OBJECT -public: - QuitObject(QObject *parent = 0) : QObject(parent), hasQuit(false) {} - - bool hasQuit; - -private Q_SLOTS: - void quit() { hasQuit = true; } -}; - -static bool xmlOutput = false; -static int passed = 0; -static int failed = 0; -static int skipped = 0; -static FILE *stream = 0; - -// A utility object to trigger the "clicked()" signal on a DeclarativeItem3d. -class Item3DClicker : public QObject -{ - Q_OBJECT -public: - Item3DClicker(QObject *parent = 0) : QObject(parent) {} - -public Q_SLOTS: - Q_INVOKABLE bool click(QObject *target); -}; - -QML_DECLARE_TYPE(Item3DClicker) - -bool Item3DClicker::click(QObject *target) -{ - if (target == 0) - return false; - const QMetaObject* metaTarget = target->metaObject(); - int clickedIndex = metaTarget->indexOfSignal("clicked()"); - if (clickedIndex == -1) - return false; - - metaTarget->activate(target, clickedIndex, 0); - return true; -} - -class TestReport : public QObject -{ - Q_OBJECT -public: - TestReport(QObject *parent = 0) : QObject(parent) {} - -public Q_SLOTS: - void report(int pass, int fail, int skip); - void log_fail(const QString &testCase, const QString &message); - void log_expect_fail - (const QString &testCase, const QString &message); - void log_expect_fail_pass(const QString &testCase); - void log_skip(const QString &testCase, const QString &message); - void log_pass(const QString &testCase); - void log_message(const QString &message); - -private: - void log_incident(const char *type, const QString &testCase, - const QString &message); -}; - -QML_DECLARE_TYPE(TestReport) - -void TestReport::report(int pass, int fail, int skip) -{ - passed += pass; - failed += fail; - skipped += skip; -} - -void TestReport::log_fail(const QString &testCase, const QString &message) -{ - if (xmlOutput) { - log_incident("fail", testCase, message); - } else if (!message.isEmpty()) { - fprintf(stream, "FAIL! : %s %s\n", - testCase.toLatin1().constData(), - message.toLatin1().constData()); - } else { - fprintf(stream, "FAIL! : %s\n", testCase.toLatin1().constData()); - } -} - -void TestReport::log_expect_fail - (const QString &testCase, const QString &message) -{ - if (xmlOutput) { - log_incident("xfail", testCase, message); - } else if (!message.isEmpty()) { - fprintf(stream, "XFAIL : %s %s\n", - testCase.toLatin1().constData(), - message.toLatin1().constData()); - } else { - fprintf(stream, "XFAIL : %s\n", testCase.toLatin1().constData()); - } -} - -void TestReport::log_expect_fail_pass(const QString &testCase) -{ - if (xmlOutput) - log_incident("xpass", testCase, QString()); - else - fprintf(stream, "XPASS : %s\n", testCase.toLatin1().constData()); -} - -void TestReport::log_skip(const QString &testCase, const QString &message) -{ - if (xmlOutput) { - log_incident("skip", testCase, message); - } else if (!message.isEmpty()) { - fprintf(stream, "SKIP : %s %s\n", - testCase.toLatin1().constData(), - message.toLatin1().constData()); - } else { - fprintf(stream, "SKIP : %s\n", testCase.toLatin1().constData()); - } -} - -void TestReport::log_pass(const QString &testCase) -{ - if (xmlOutput) - log_incident("pass", testCase, QString()); - else - fprintf(stream, "PASS : %s\n", testCase.toLatin1().constData()); -} - -void TestReport::log_message(const QString &message) -{ - if (!xmlOutput) - fprintf(stream, "%s\n", message.toLatin1().constData()); -} - -void TestReport::log_incident - (const char *type, const QString &testCase, const QString &message) -{ - QString name(testCase); - QString tag; - name.replace(QLatin1String("()"), QLatin1String("")); - name.replace(QLatin1String("::"), QLatin1String("__")); - int tagIndex = name.indexOf(QLatin1String(" [")); - if (tagIndex >= 0) { - tag = name.mid(tagIndex + 2); - if (tag.endsWith(QLatin1String("]"))) - tag = tag.left(tag.length() - 1); - name = name.left(tagIndex); - } - fprintf(stream, "<TestFunction name=\"%s\">\n", - Qt::escape(name).toLatin1().constData()); - if (message.isEmpty() && tag.isEmpty()) { - fprintf(stream, "<Incident type=\"%s\" file=\"\" line=\"0\" />\n", type); - } else { - fprintf(stream, "<Incident type=\"%s\" file=\"\" line=\"0\">\n", type); - if (!tag.isEmpty()) { - fprintf(stream, " <DataTag>%s</DataTag>\n", - Qt::escape(tag).toLatin1().constData()); - } - if (!message.isEmpty()) { - fprintf(stream, " <Description>%s</Description>\n", - Qt::escape(message).toLatin1().constData()); - } - fprintf(stream, "</Incident>\n"); - } - fprintf(stream, "</TestFunction>\n"); -} - -class tst_qml3d : public QObject -{ - Q_OBJECT -public: -private slots: - void initTestCase() - { - QSKIP("Disabling qml tests due to invalid GL context!", SkipSingle); - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - { - QGLWidget checkWidget; - if (!checkWidget.isValid()) - { - tst_qml3d xf; - return QTest::qExec(&xf, argc, argv); - } - } - - // Just display the functions available and then exit - bool displayFunctions = false; - - QStringList restrictFunctions; - - // Parse the command-line arguments. - const char *filename = 0; - for (int index = 1; index < argc; ++index) { - QString arg = QString::fromLocal8Bit(argv[index]); - if (arg == QLatin1String("-xml")) - xmlOutput = true; - else if (arg == QLatin1String("-o") && (index + 1) < argc) - filename = argv[++index]; - else if (arg == QLatin1String("-functions")) - displayFunctions = true; - else - { - // assume it is the names of test functions - run only those - restrictFunctions += arg; - } - } - - // Determine where to look for the test data. On a device it will - // typically be necessary to set QML3D_TEST_SOURCE_DIR. - QString testPath = QString::fromLocal8Bit(qgetenv("QML3D_TEST_SOURCE_DIR")); -#ifdef QML3D_TEST_SOURCE_DIR - if (testPath.isEmpty()) - testPath = QString::fromLocal8Bit(QML3D_TEST_SOURCE_DIR); -#endif - if (testPath.isEmpty()) - testPath = QLatin1String("."); - - // Find the subdirectories that look like they may contain test cases. - // The "QtQuickTest" directory contains the common QML and JS test logic. - QDir dir(testPath); - QStringList entries = dir.entryList(QDir::Dirs); - entries.removeAll(QLatin1String(".")); - entries.removeAll(QLatin1String("..")); - entries.removeAll(QLatin1String("QtQuickTest")); - - if (filename) { - stream = fopen(filename, "w"); - if (!stream) { - perror(filename); - return 1; - } - } else { - stream = stdout; - } - - if (xmlOutput) { - fprintf(stream, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" - "<TestCase name=\"tst_qml3d\">\n"); - fprintf(stream, "<Environment>\n" - " <QtVersion>%s</QtVersion>\n" - " <QTestVersion>%s</QTestVersion>\n" - "</Environment>\n", qVersion(), qVersion()); - } else { - if (!displayFunctions) - fprintf(stream, "********* Start testing of tst_qml3d *********\n"); - } - - qmlRegisterType<TestReport>("QtQuickTest", 1, 0, "TestReport"); - qmlRegisterType<Item3DClicker>("QtQuickTest", 1, 0, "Item3DClicker"); - - // Scan through all of the "*.qml" files in the subdirectories - // and run each of them in turn with a QDeclarativeView. - QStringList filters; - filters += QLatin1String("tst_*.qml"); - bool atLeastOne = false; - if (displayFunctions) - restrictFunctions.clear(); - foreach (QString name, entries) { - QDir subdir(testPath + QDir::separator() + name); - QStringList files = subdir.entryList(filters, QDir::Files); - foreach (QString file, files) { - QString source = subdir.path() + QDir::separator() + file; - QFileInfo fi(source); - if (fi.exists()) { - bool hasFunc = true; - if (restrictFunctions.size() > 0 || displayFunctions) - { - hasFunc = false; - QFile qmlFile(fi.absoluteFilePath()); - if (!qmlFile.open(QIODevice::ReadOnly)) - continue; - { - QTextStream is(&qmlFile); - while (!is.atEnd()) - { - QString line = is.readLine(); - for (int i = 0; i < restrictFunctions.size() && !hasFunc; ++i) - { - QString funcName("function "); - funcName += restrictFunctions.at(i); - if (line.contains(funcName)) - hasFunc = true; - } - if (displayFunctions) - { - int pos = line.indexOf(QLatin1String("function test_")); - if (pos >= 0) - { - QString fname = line.mid(pos + 9); // "function".length - pos = fname.indexOf("()"); - fname.truncate(pos + 2); - qWarning(" %s\n", qPrintable(fname)); - } - } - } - } - qmlFile.close(); - } - if (!hasFunc) - continue; - atLeastOne = true; - QDeclarativeView view; - QuitObject quitobj; - QEventLoop eventLoop; - QObject::connect(view.engine(), SIGNAL(quit()), - &quitobj, SLOT(quit())); - QObject::connect(view.engine(), SIGNAL(quit()), - &eventLoop, SLOT(quit())); - view.setViewport(new QGLWidget()); - view.engine()->addImportPath(testPath); - view.rootContext()->setContextProperty(QLatin1String("filterTestCases"), restrictFunctions); - view.setSource(QUrl::fromLocalFile(fi.absoluteFilePath())); - if (view.status() == QDeclarativeView::Error) { - // Error compiling the test - flag failure and continue. - ++failed; - continue; - } - if (!quitobj.hasQuit) { - // If the test already quit, then it was performed - // synchronously during setSource(). Otherwise it is - // an asynchronous test and we need to show the window - // and wait for the quit indication. - view.show(); - eventLoop.exec(); - } - } - } - } - - if (!atLeastOne && !xmlOutput && restrictFunctions.size() > 1) - fprintf(stream, "No test functions matched specified name: %s\n", qPrintable(restrictFunctions.at(0))); - - if (xmlOutput) { - fprintf(stream, "</TestCase>\n"); - } else { - if (!displayFunctions) - { - fprintf(stream, "Totals: %d passed, %d failed, %d skipped\n", - passed, failed, skipped); - fprintf(stream, "********* Finished testing of tst_qml3d *********\n"); - } - } - - if (filename) - fclose(stream); - - return failed != 0; -} - -#include "tst_qml3d.moc" diff --git a/tests/auto/qml3d/viewport/tst_viewport.qml b/tests/auto/qml3d/viewport/tst_viewport.qml deleted file mode 100644 index 29a7914b..00000000 --- a/tests/auto/qml3d/viewport/tst_viewport.qml +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt3D 1.0 -import QtQuickTest 1.0 - -Viewport { - id: viewport - - Camera { - id: newCamera - eye: Qt.vector3d(0, 1, 52) - } - - Light { - id: newLight - ambientColor: "#ff00ee" - } - - LightModel { - id: newLightModel - ambientSceneColor: "#ff00ee" - } - - TestCase { - name: "Viewport" - - function test_modes() { - verify(!viewport.picking, "picking") - verify(!viewport.showPicking, "showPicking") - verify(viewport.navigation, "navigation") - verify(!viewport.blending, "blending") - - viewport.picking = true - viewport.showPicking = true - viewport.navigation = false - viewport.blending = true - - verify(viewport.picking, "picking-modified") - verify(viewport.showPicking, "showPicking-modified") - verify(!viewport.navigation, "navigation-modified") - verify(viewport.blending, "blending-modified") - } - - function test_camera() { - verify(viewport.camera != null, "camera") - verify(viewport.camera != newCamera, "camera-obj") - compare(viewport.camera.projectionType, 0, "projectionType") - compare(viewport.camera.eye, Qt.vector3d(0, 0, 10), "eye") - compare(viewport.camera.center, Qt.vector3d(0, 0, 0), "center") - compare(viewport.camera.upVector, Qt.vector3d(0, 1, 0), "upVector") - compare(viewport.camera.fieldOfView, 0, "fieldOfView") - compare(viewport.camera.nearPlane, 5, "nearPlane") - compare(viewport.camera.farPlane, 1000, "farPlane") - compare(viewport.camera.eyeSeparation, 0, "eyeSeparation") - compare(viewport.camera.adjustForAspectRatio, true, "adjustForAspectRatio") - - var oldCamera = viewport.camera - - viewport.camera = newCamera - verify(viewport.camera == newCamera, "newCamera") - compare(viewport.camera.eye, Qt.vector3d(0, 1, 52), "eye-new") - - compare(oldCamera.eye, Qt.vector3d(0, 0, 10), "eye-old") - } - - function test_light() { - verify(viewport.light != null, "light") - verify(viewport.light != newLight, "light-obj") - compare(viewport.light.type, 0, "type-directional") - compare(viewport.light.direction, Qt.vector3d(0, 0, 1), "direction") - compare(viewport.light.ambientColor, "#000000", "ambientColor") - compare(viewport.light.diffuseColor, "#ffffff", "diffuseColor") - compare(viewport.light.specularColor, "#ffffff", "specularColor") - compare(viewport.light.spotDirection, Qt.vector3d(0, 0, -1), "spotDirection") - compare(viewport.light.spotExponent, 0, "spotExponent") - compare(viewport.light.spotAngle, 180, "spotAngle") - compare(viewport.light.constantAttenuation, 1, "constantAttenuation") - compare(viewport.light.linearAttenuation, 0, "linearAttenuation") - compare(viewport.light.quadraticAttenuation, 0, "quadraticAttenuation") - - var oldLight = viewport.light - - viewport.light = newLight - verify(viewport.light == newLight, "newLight") - compare(viewport.light.ambientColor, "#ff00ee", "ambientColor-new") - - compare(oldLight.ambientColor, "#000000", "ambientColor-old") - } - - function test_lightModel() { - verify(viewport.lightModel == null, "lightModel") - - viewport.lightModel = newLightModel - verify(viewport.lightModel == newLightModel, "newLightModel") - compare(viewport.lightModel.ambientSceneColor, "#ff00ee", "ambientSceneColor") - } - } -} |