diff options
Diffstat (limited to 'tests/auto/qmltest/scatter3d/tst_basic.qml')
-rw-r--r-- | tests/auto/qmltest/scatter3d/tst_basic.qml | 129 |
1 files changed, 89 insertions, 40 deletions
diff --git a/tests/auto/qmltest/scatter3d/tst_basic.qml b/tests/auto/qmltest/scatter3d/tst_basic.qml index a5afb878..5cbcfe0d 100644 --- a/tests/auto/qmltest/scatter3d/tst_basic.qml +++ b/tests/auto/qmltest/scatter3d/tst_basic.qml @@ -1,20 +1,23 @@ -/**************************************************************************** +/****************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://qt.io +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Data Visualization module. ** -** Licensees holding valid commercial license for Qt may use this file in -** accordance with the Qt License Agreement provided with the Software -** or, alternatively, in accordance with the terms contained in a written -** agreement between you and The Qt Company. +** $QT_BEGIN_LICENSE:COMM$ ** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.io +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** -****************************************************************************/ +** $QT_END_LICENSE$ +** +******************************************************************************/ import QtQuick 2.0 import QtDataVisualization 1.2 @@ -25,45 +28,71 @@ Item { height: 150 width: 150 - Scatter3D { - id: empty + property var empty: null + property var basic: null + property var common: null + property var common_init: null + + function constructEmpty() { + empty = Qt.createQmlObject(" + import QtQuick 2.2 + import QtDataVisualization 1.2 + Scatter3D { + }", top) } - Scatter3D { - id: basic - anchors.fill: parent + function constructBasic() { + basic = Qt.createQmlObject(" + import QtQuick 2.2 + import QtDataVisualization 1.2 + Scatter3D { + anchors.fill: parent + }", top) + basic.anchors.fill = top } - Scatter3D { - id: common - anchors.fill: parent + function constructCommon() { + common = Qt.createQmlObject(" + import QtQuick 2.2 + import QtDataVisualization 1.2 + Scatter3D { + anchors.fill: parent + }", top) + common.anchors.fill = top } - Scatter3D { - id: common_init - anchors.fill: parent - selectionMode: AbstractGraph3D.SelectionNone - shadowQuality: AbstractGraph3D.ShadowQualityLow - msaaSamples: 2 - theme: Theme3D { } - renderingMode: AbstractGraph3D.RenderIndirect - measureFps: true - orthoProjection: false - aspectRatio: 3.0 - optimizationHints: AbstractGraph3D.OptimizationStatic - polar: false - radialLabelOffset: 2 - horizontalAspectRatio: 0.2 - reflection: true - reflectivity: 0.1 - locale: Qt.locale("UK") - margin: 0.2 + function constructCommonInit() { + common_init = Qt.createQmlObject(" + import QtQuick 2.2 + import QtDataVisualization 1.2 + Scatter3D { + anchors.fill: parent + selectionMode: AbstractGraph3D.SelectionNone + shadowQuality: AbstractGraph3D.ShadowQualityLow + msaaSamples: 2 + theme: Theme3D { } + renderingMode: AbstractGraph3D.RenderIndirect + measureFps: true + orthoProjection: false + aspectRatio: 3.0 + optimizationHints: AbstractGraph3D.OptimizationStatic + polar: false + radialLabelOffset: 2 + horizontalAspectRatio: 0.2 + reflection: true + reflectivity: 0.1 + locale: Qt.locale(\"UK\") + margin: 0.2 + }", top) + common_init.anchors.fill = top } TestCase { name: "Scatter3D Empty" + when: windowShown function test_empty() { + constructEmpty() compare(empty.width, 0, "width") compare(empty.height, 0, "height") compare(empty.seriesList.length, 0, "seriesList") @@ -74,6 +103,9 @@ Item { compare(empty.axisX.type, AbstractAxis3D.AxisTypeValue) compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue) compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue) + waitForRendering(top) + empty.destroy() + waitForRendering(top) } } @@ -82,8 +114,12 @@ Item { when: windowShown function test_basic() { + constructBasic() compare(basic.width, 150, "width") compare(basic.height, 150, "height") + waitForRendering(top) + basic.destroy() + waitForRendering(top) } } @@ -92,6 +128,7 @@ Item { when: windowShown function test_1_common() { + constructCommon() compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode") compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality") if (common.shadowsSupported === true) @@ -114,6 +151,7 @@ Item { compare(common.locale, Qt.locale("C"), "locale") compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition") compare(common.margin, -1, "margin") + waitForRendering(top) } function test_2_change_common() { @@ -154,6 +192,7 @@ Item { compare(common.reflectivity, 1.0, "reflectivity") compare(common.locale, Qt.locale("FI"), "locale") compare(common.margin, 1.0, "margin") + waitForRendering(top) } function test_3_change_invalid_common() { @@ -173,15 +212,21 @@ Item { compare(common.aspectRatio, -1.0/*1.0*/, "aspectRatio") // TODO: Fix once QTRD-3367 is done compare(common.horizontalAspectRatio, -2/*1*/, "horizontalAspectRatio") // TODO: Fix once QTRD-3367 is done compare(common.reflectivity, -1.0/*1.0*/, "reflectivity") // TODO: Fix once QTRD-3367 is done + + waitForRendering(top) + common.destroy() + waitForRendering(top) } function test_4_common_initialized() { + constructCommonInit() + compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode") if (common_init.shadowsSupported === true) { - compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality") + tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) compare(common_init.msaaSamples, 2, "msaaSamples") } else { - compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality") + tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone) compare(common_init.msaaSamples, 0, "msaaSamples") } compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme") @@ -198,6 +243,10 @@ Item { compare(common_init.reflectivity, 0.1, "reflectivity") compare(common_init.locale, Qt.locale("UK"), "locale") compare(common_init.margin, 0.2, "margin") + + waitForRendering(top) + common_init.destroy(); + waitForRendering(top) } } } |