summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmltest')
-rw-r--r--tests/auto/qmltest/axis3d/tst_category.qml135
-rw-r--r--tests/auto/qmltest/axis3d/tst_logvalue.qml91
-rw-r--r--tests/auto/qmltest/axis3d/tst_value.qml154
-rw-r--r--tests/auto/qmltest/bars3d/tst_bars.qml147
-rw-r--r--tests/auto/qmltest/bars3d/tst_barseries.qml215
-rw-r--r--tests/auto/qmltest/bars3d/tst_basic.qml240
-rw-r--r--tests/auto/qmltest/bars3d/tst_proxy.qml253
-rw-r--r--tests/auto/qmltest/custom3d/tst_customitem.qml106
-rw-r--r--tests/auto/qmltest/custom3d/tst_customlabel.qml134
-rw-r--r--tests/auto/qmltest/custom3d/tst_customvolume.qml182
-rw-r--r--tests/auto/qmltest/customitem.obj54
-rw-r--r--tests/auto/qmltest/customtexture.jpgbin0 -> 516 bytes
-rw-r--r--tests/auto/qmltest/input3d/tst_input.qml83
-rw-r--r--tests/auto/qmltest/input3d/tst_touch.qml83
-rw-r--r--tests/auto/qmltest/qmltest.pro35
-rw-r--r--tests/auto/qmltest/qmltest.qrc6
-rw-r--r--tests/auto/qmltest/scatter3d/tst_basic.qml203
-rw-r--r--tests/auto/qmltest/scatter3d/tst_proxy.qml134
-rw-r--r--tests/auto/qmltest/scatter3d/tst_scatter.qml60
-rw-r--r--tests/auto/qmltest/scatter3d/tst_scatterseries.qml233
-rw-r--r--tests/auto/qmltest/scene3d/tst_camera.qml135
-rw-r--r--tests/auto/qmltest/scene3d/tst_light.qml65
-rw-r--r--tests/auto/qmltest/scene3d/tst_scene.qml125
-rw-r--r--tests/auto/qmltest/surface3d/tst_basic.qml211
-rw-r--r--tests/auto/qmltest/surface3d/tst_heightproxy.qml116
-rw-r--r--tests/auto/qmltest/surface3d/tst_proxy.qml263
-rw-r--r--tests/auto/qmltest/surface3d/tst_surface.qml60
-rw-r--r--tests/auto/qmltest/surface3d/tst_surfaceseries.qml229
-rw-r--r--tests/auto/qmltest/theme3d/tst_colorgradient.qml89
-rw-r--r--tests/auto/qmltest/theme3d/tst_theme.qml266
-rw-r--r--tests/auto/qmltest/theme3d/tst_themecolor.qml66
-rw-r--r--tests/auto/qmltest/tst_qmltest.cpp20
32 files changed, 4193 insertions, 0 deletions
diff --git a/tests/auto/qmltest/axis3d/tst_category.qml b/tests/auto/qmltest/axis3d/tst_category.qml
new file mode 100644
index 00000000..318fa011
--- /dev/null
+++ b/tests/auto/qmltest/axis3d/tst_category.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ CategoryAxis3D {
+ id: initial
+ }
+
+ CategoryAxis3D {
+ id: initialized
+ labels: ["first", "second"]
+
+ autoAdjustRange: false
+ labelAutoRotation: 10.0
+ max: 20
+ min: 10
+ title: "initialized"
+ titleFixed: false
+ titleVisible: true
+ }
+
+ CategoryAxis3D {
+ id: change
+ }
+
+ CategoryAxis3D {
+ id: invalid
+ }
+
+ TestCase {
+ name: "CategoryAxis3D Initial"
+
+ function test_initial() {
+ compare(initial.labels.length, 0)
+
+ compare(initial.autoAdjustRange, true)
+ compare(initial.labelAutoRotation, 0.0)
+ compare(initial.max, 10)
+ compare(initial.min, 0)
+ compare(initial.orientation, AbstractAxis3D.AxisOrientationNone)
+ compare(initial.title, "")
+ compare(initial.titleFixed, true)
+ compare(initial.titleVisible, false)
+ compare(initial.type, AbstractAxis3D.AxisTypeCategory)
+ }
+ }
+
+ TestCase {
+ name: "CategoryAxis3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.labels.length, 2)
+ compare(initialized.labels[0], "first")
+ compare(initialized.labels[1], "second")
+
+ compare(initialized.autoAdjustRange, false)
+ compare(initialized.labelAutoRotation, 10.0)
+ compare(initialized.max, 20)
+ compare(initialized.min, 10)
+ compare(initialized.title, "initialized")
+ compare(initialized.titleFixed, false)
+ compare(initialized.titleVisible, true)
+ }
+ }
+
+ TestCase {
+ name: "CategoryAxis3D Change"
+
+ function test_change() {
+ change.labels = ["first"]
+ compare(change.labels.length, 1)
+ compare(change.labels[0], "first")
+ change.labels = ["first", "second"]
+ compare(change.labels.length, 2)
+ compare(change.labels[0], "first")
+ compare(change.labels[1], "second")
+ change.labels[1] = "another"
+ compare(change.labels[1], "another")
+
+ change.autoAdjustRange = false
+ change.labelAutoRotation = 10.0
+ change.max = 20
+ change.min = 10
+ change.title = "initialized"
+ change.titleFixed = false
+ change.titleVisible = true
+
+ compare(change.autoAdjustRange, false)
+ compare(change.labelAutoRotation, 10.0)
+ compare(change.max, 20)
+ compare(change.min, 10)
+ compare(change.title, "initialized")
+ compare(change.titleFixed, false)
+ compare(change.titleVisible, true)
+ }
+ }
+
+ TestCase {
+ name: "CategoryAxis3D Invalid"
+
+ function test_invalid() {
+ invalid.labelAutoRotation = -10
+ compare(invalid.labelAutoRotation, 0.0)
+ invalid.labelAutoRotation = 100
+ compare(invalid.labelAutoRotation, 90.0)
+ invalid.max = -10
+ compare(invalid.min, 0)
+ invalid.min = 10
+ compare(invalid.max, 11)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/axis3d/tst_logvalue.qml b/tests/auto/qmltest/axis3d/tst_logvalue.qml
new file mode 100644
index 00000000..89228ad1
--- /dev/null
+++ b/tests/auto/qmltest/axis3d/tst_logvalue.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ LogValueAxis3DFormatter {
+ id: initial
+ }
+
+ LogValueAxis3DFormatter {
+ id: initialized
+ autoSubGrid: false
+ base: 0.1
+ showEdgeLabels: false
+ }
+
+ LogValueAxis3DFormatter {
+ id: change
+ }
+
+ LogValueAxis3DFormatter {
+ id: invalid
+ }
+
+ TestCase {
+ name: "LogValueAxis3DFormatter Initial"
+
+ function test_initial() {
+ compare(initial.autoSubGrid, true)
+ compare(initial.base, 10)
+ compare(initial.showEdgeLabels, true)
+ }
+ }
+
+ TestCase {
+ name: "LogValueAxis3DFormatter Initialized"
+
+ function test_initialized() {
+ compare(initialized.autoSubGrid, false)
+ compare(initialized.base, 0.1)
+ compare(initialized.showEdgeLabels, false)
+ }
+ }
+
+ TestCase {
+ name: "LogValueAxis3DFormatter Change"
+
+ function test_change() {
+ change.autoSubGrid = false
+ change.base = 0.1
+ change.showEdgeLabels = false
+
+ compare(change.autoSubGrid, false)
+ compare(change.base, 0.1)
+ compare(change.showEdgeLabels, false)
+ }
+ }
+
+ TestCase {
+ name: "LogValueAxis3DFormatter Invalid"
+
+ function test_invalid() {
+ invalid.base = 1
+ compare(invalid.base, 10)
+ invalid.base = -1
+ compare(invalid.base, 10)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/axis3d/tst_value.qml b/tests/auto/qmltest/axis3d/tst_value.qml
new file mode 100644
index 00000000..54189c8b
--- /dev/null
+++ b/tests/auto/qmltest/axis3d/tst_value.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ ValueAxis3D {
+ id: initial
+ }
+
+ ValueAxis3D {
+ id: initialized
+ formatter: ValueAxis3DFormatter { objectName: "formatter1" }
+ labelFormat: "%f"
+ reversed: true
+ segmentCount: 10
+ subSegmentCount: 5
+
+ autoAdjustRange: false
+ labelAutoRotation: 10.0
+ max: 20
+ min: -10
+ title: "initialized"
+ titleFixed: false
+ titleVisible: true
+ }
+
+ ValueAxis3D {
+ id: change
+ }
+
+ ValueAxis3D {
+ id: invalid
+ }
+
+ TestCase {
+ name: "ValueAxis3D Initial"
+
+ function test_initial() {
+ verify(initial.formatter)
+ compare(initial.labelFormat, "%.2f")
+ compare(initial.reversed, false)
+ compare(initial.segmentCount, 5)
+ compare(initial.subSegmentCount, 1)
+
+ compare(initial.autoAdjustRange, true)
+ compare(initial.labelAutoRotation, 0.0)
+ compare(initial.max, 10)
+ compare(initial.min, 0)
+ compare(initial.orientation, AbstractAxis3D.AxisOrientationNone)
+ compare(initial.title, "")
+ compare(initial.titleFixed, true)
+ compare(initial.titleVisible, false)
+ compare(initial.type, AbstractAxis3D.AxisTypeValue)
+ }
+ }
+
+ TestCase {
+ name: "ValueAxis3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.formatter.objectName, "formatter1")
+ compare(initialized.labelFormat, "%f")
+ compare(initialized.reversed, true)
+ compare(initialized.segmentCount, 10)
+ compare(initialized.subSegmentCount, 5)
+
+ compare(initialized.autoAdjustRange, false)
+ compare(initialized.labelAutoRotation, 10.0)
+ compare(initialized.max, 20)
+ compare(initialized.min, -10)
+ compare(initialized.title, "initialized")
+ compare(initialized.titleFixed, false)
+ compare(initialized.titleVisible, true)
+ }
+ }
+
+ TestCase {
+ name: "ValueAxis3D Change"
+
+ ValueAxis3DFormatter { id: formatter1 }
+
+ function test_change() {
+ change.formatter = formatter1
+ change.labelFormat = "%f"
+ change.reversed = true
+ change.segmentCount = 10
+ change.subSegmentCount = 5
+
+ compare(change.formatter, formatter1)
+ compare(change.labelFormat, "%f")
+ compare(change.reversed, true)
+ compare(change.segmentCount, 10)
+ compare(change.subSegmentCount, 5)
+
+ change.autoAdjustRange = false
+ change.labelAutoRotation = 10.0
+ change.max = 20
+ change.min = -10
+ change.title = "initialized"
+ change.titleFixed = false
+ change.titleVisible = true
+
+ compare(change.autoAdjustRange, false)
+ compare(change.labelAutoRotation, 10.0)
+ compare(change.max, 20)
+ compare(change.min, -10)
+ compare(change.title, "initialized")
+ compare(change.titleFixed, false)
+ compare(change.titleVisible, true)
+ }
+ }
+
+ TestCase {
+ name: "ValueAxis3D Invalid"
+
+ function test_invalid() {
+ invalid.segmentCount = -1
+ compare(invalid.segmentCount, 1)
+ invalid.subSegmentCount = -1
+ compare(invalid.subSegmentCount, 1)
+
+ invalid.labelAutoRotation = -10
+ compare(invalid.labelAutoRotation, 0.0)
+ invalid.labelAutoRotation = 100
+ compare(invalid.labelAutoRotation, 90.0)
+ invalid.max = -10
+ compare(invalid.min, -11)
+ invalid.min = 10
+ compare(invalid.max, 11)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/bars3d/tst_bars.qml b/tests/auto/qmltest/bars3d/tst_bars.qml
new file mode 100644
index 00000000..a64aaf1a
--- /dev/null
+++ b/tests/auto/qmltest/bars3d/tst_bars.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Bars3D {
+ id: series
+ anchors.fill: parent
+ }
+
+ TestCase {
+ name: "Bars3D Series"
+
+ Bar3DSeries { id: series1 }
+ Bar3DSeries { id: series2 }
+
+ function test_1_add_series() {
+ series.seriesList = [series1, series2]
+ compare(series.seriesList.length, 2)
+ }
+
+ function test_2_remove_series() {
+ series.seriesList = [series1]
+ compare(series.seriesList.length, 1)
+ }
+
+ function test_3_remove_series() {
+ series.seriesList = []
+ compare(series.seriesList.length, 0)
+ }
+
+ function test_4_primary_series() {
+ series.seriesList = [series1, series2]
+ compare(series.primarySeries, series1)
+ series.primarySeries = series2
+ compare(series.primarySeries, series2)
+ }
+
+ function test_5_selected_series() {
+ series.seriesList[0].selectedBar = Qt.point(0, 0)
+ compare(series.selectedSeries, series1)
+ }
+ }
+
+ // The following tests are not required for scatter or surface, as they are handled identically
+ Bars3D {
+ id: theme
+ anchors.fill: parent
+ }
+
+ Bars3D {
+ id: input
+ anchors.fill: parent
+ }
+
+ Custom3DItem { id: item1; meshFile: ":/customitem.obj" }
+ Custom3DItem { id: item2; meshFile: ":/customitem.obj" }
+ Custom3DItem { id: item3; meshFile: ":/customitem.obj" }
+ Custom3DItem { id: item4; meshFile: ":/customitem.obj"; position: Qt.vector3d(0.0, 1.0, 0.0) }
+
+ Bars3D {
+ id: custom
+ anchors.fill: parent
+ customItemList: [item1, item2]
+ }
+
+ TestCase {
+ name: "Bars3D Theme"
+ when: windowShown
+
+ Theme3D { id: newTheme }
+
+ function test_1_add_theme() {
+ theme.theme = newTheme
+ compare(theme.theme, newTheme)
+ }
+
+ function test_2_change_theme() {
+ newTheme.type = Theme3D.ThemePrimaryColors
+ compare(theme.theme.type, Theme3D.ThemePrimaryColors)
+ }
+ }
+
+ TestCase {
+ name: "Bars3D Input"
+ when: windowShown
+
+ function test_1_remove_input() {
+ input.inputHandler = null
+ compare(input.inputHandler, null)
+ }
+ }
+
+ TestCase {
+ name: "Bars3D Custom"
+ when: windowShown
+
+ function test_1_custom_items() {
+ compare(custom.customItemList.length, 2)
+ }
+
+ function test_2_add_custom_items() {
+ custom.addCustomItem(item3)
+ compare(custom.customItemList.length, 3)
+ custom.addCustomItem(item4)
+ compare(custom.customItemList.length, 4)
+ }
+
+ function test_3_change_custom_items() {
+ item1.position = Qt.vector3d(1.0, 1.0, 1.0)
+ compare(custom.customItemList[0].position, Qt.vector3d(1.0, 1.0, 1.0))
+ }
+
+ function test_4_remove_custom_items() {
+ custom.removeCustomItemAt(Qt.vector3d(0.0, 1.0, 0.0))
+ compare(custom.customItemList.length, 3)
+ custom.releaseCustomItem(item1)
+ compare(custom.customItemList[0], item2)
+ custom.releaseCustomItem(item2)
+ compare(custom.customItemList.length, 1)
+ custom.removeCustomItems()
+ compare(custom.customItemList.length, 0)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/bars3d/tst_barseries.qml b/tests/auto/qmltest/bars3d/tst_barseries.qml
new file mode 100644
index 00000000..7e303ab0
--- /dev/null
+++ b/tests/auto/qmltest/bars3d/tst_barseries.qml
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Bar3DSeries {
+ id: initial
+ }
+
+ ColorGradient {
+ id: gradient1;
+ stops: [
+ ColorGradientStop { color: "red"; position: 0 },
+ ColorGradientStop { color: "blue"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient2;
+ stops: [
+ ColorGradientStop { color: "green"; position: 0 },
+ ColorGradientStop { color: "red"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient3;
+ stops: [
+ ColorGradientStop { color: "gray"; position: 0 },
+ ColorGradientStop { color: "darkgray"; position: 1 }
+ ]
+ }
+
+ Bar3DSeries {
+ id: initialized
+ dataProxy: ItemModelBarDataProxy {
+ itemModel: ListModel {
+ ListElement{ year: "2012"; city: "Oulu"; expenses: "4200"; }
+ ListElement{ year: "2012"; city: "Rauma"; expenses: "2100"; }
+ }
+ rowRole: "city"
+ columnRole: "year"
+ valueRole: "expenses"
+ }
+ meshAngle: 15.0
+ selectedBar: Qt.point(0, 0)
+
+ baseColor: "blue"
+ baseGradient: gradient1
+ colorStyle: Theme3D.ColorStyleObjectGradient
+ itemLabelFormat: "%f"
+ itemLabelVisible: false
+ mesh: Abstract3DSeries.MeshCone
+ meshSmooth: true
+ multiHighlightColor: "green"
+ multiHighlightGradient: gradient2
+ name: "series1"
+ singleHighlightColor: "red"
+ singleHighlightGradient: gradient3
+ userDefinedMesh: ":/customitem.obj"
+ visible: false
+ }
+
+ ItemModelBarDataProxy {
+ id: proxy1
+ itemModel: ListModel {
+ ListElement{ year: "2012"; city: "Oulu"; expenses: "4200"; }
+ ListElement{ year: "2012"; city: "Rauma"; expenses: "2100"; }
+ ListElement{ year: "2012"; city: "Helsinki"; expenses: "7040"; }
+ }
+ rowRole: "city"
+ columnRole: "year"
+ valueRole: "expenses"
+ }
+
+ Bar3DSeries {
+ id: change
+ }
+
+ TestCase {
+ name: "Bar3DSeries Initial"
+
+ function test_1_initial() {
+ compare(initial.dataProxy.rowCount, 0)
+ compare(initial.invalidSelectionPosition, Qt.point(-1, -1))
+ compare(initial.meshAngle, 0)
+ compare(initial.selectedBar, Qt.point(-1, -1))
+ }
+
+ function test_2_initial_common() {
+ // Common properties
+ compare(initial.baseColor, "#000000")
+ compare(initial.baseGradient, null)
+ compare(initial.colorStyle, Theme3D.ColorStyleUniform)
+ compare(initial.itemLabel, "")
+ compare(initial.itemLabelFormat, "@valueLabel")
+ compare(initial.itemLabelVisible, true)
+ compare(initial.mesh, Abstract3DSeries.MeshBevelBar)
+ compare(initial.meshRotation, Qt.quaternion(1, 0, 0, 0))
+ compare(initial.meshSmooth, false)
+ compare(initial.multiHighlightColor, "#000000")
+ compare(initial.multiHighlightGradient, null)
+ compare(initial.name, "")
+ compare(initial.singleHighlightColor, "#000000")
+ compare(initial.singleHighlightGradient, null)
+ compare(initial.type, Abstract3DSeries.SeriesTypeBar)
+ compare(initial.userDefinedMesh, "")
+ compare(initial.visible, true)
+ }
+ }
+
+ TestCase {
+ name: "Bar3DSeries Initialized"
+
+ function test_1_initialized() {
+ compare(initialized.dataProxy.rowCount, 2)
+ fuzzyCompare(initialized.meshAngle, 15.0, 0.01)
+ compare(initialized.selectedBar, Qt.point(0, 0))
+ }
+
+ function test_2_initialized_common() {
+ // Common properties
+ compare(initialized.baseColor, "#0000ff")
+ compare(initialized.baseGradient, gradient1)
+ compare(initialized.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(initialized.itemLabelFormat, "%f")
+ compare(initialized.itemLabelVisible, false)
+ compare(initialized.mesh, Abstract3DSeries.MeshCone)
+ compare(initialized.meshSmooth, true)
+ compare(initialized.multiHighlightColor, "#008000")
+ compare(initialized.multiHighlightGradient, gradient2)
+ compare(initialized.name, "series1")
+ compare(initialized.singleHighlightColor, "#ff0000")
+ compare(initialized.singleHighlightGradient, gradient3)
+ compare(initialized.userDefinedMesh, ":/customitem.obj")
+ compare(initialized.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Bar3DSeries Change"
+
+ function test_1_change() {
+ change.dataProxy = proxy1
+ change.meshAngle = 15.0
+ change.selectedBar = Qt.point(0, 0)
+ }
+
+ function test_2_test_change() {
+ // This test has a dependency to the previous one due to asynchronous item model resolving
+ compare(change.dataProxy.rowCount, 3)
+ fuzzyCompare(change.meshAngle, 15.0, 0.01)
+ compare(change.selectedBar, Qt.point(0, 0))
+ }
+
+ function test_3_change_common() {
+ change.baseColor = "blue"
+ change.baseGradient = gradient1
+ change.colorStyle = Theme3D.ColorStyleObjectGradient
+ change.itemLabelFormat = "%f"
+ change.itemLabelVisible = false
+ change.mesh = Abstract3DSeries.MeshCone
+ change.meshSmooth = true
+ change.multiHighlightColor = "green"
+ change.multiHighlightGradient = gradient2
+ change.name = "series1"
+ change.singleHighlightColor = "red"
+ change.singleHighlightGradient = gradient3
+ change.userDefinedMesh = ":/customitem.obj"
+ change.visible = false
+
+ compare(change.baseColor, "#0000ff")
+ compare(change.baseGradient, gradient1)
+ compare(change.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(change.itemLabelFormat, "%f")
+ compare(change.itemLabelVisible, false)
+ compare(change.mesh, Abstract3DSeries.MeshCone)
+ compare(change.meshSmooth, true)
+ compare(change.multiHighlightColor, "#008000")
+ compare(change.multiHighlightGradient, gradient2)
+ compare(change.name, "series1")
+ compare(change.singleHighlightColor, "#ff0000")
+ compare(change.singleHighlightGradient, gradient3)
+ compare(change.userDefinedMesh, ":/customitem.obj")
+ compare(change.visible, false)
+ }
+
+ function test_4_change_gradient_stop() {
+ gradient1.stops[0].color = "yellow"
+ compare(change.baseGradient.stops[0].color, "#ffff00")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/bars3d/tst_basic.qml b/tests/auto/qmltest/bars3d/tst_basic.qml
new file mode 100644
index 00000000..bf27ae8c
--- /dev/null
+++ b/tests/auto/qmltest/bars3d/tst_basic.qml
@@ -0,0 +1,240 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Bars3D {
+ id: empty
+ }
+
+ Bars3D {
+ id: basic
+ anchors.fill: parent
+ multiSeriesUniform: true
+ barThickness: 0.1
+ barSpacing.width: 0.1
+ barSpacing.height: 0.1
+ barSpacingRelative: false
+ floorLevel: 1.0
+ }
+
+ Bars3D {
+ id: common
+ anchors.fill: parent
+ }
+
+ Bars3D {
+ 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
+ }
+
+ TestCase {
+ name: "Bars3D Empty"
+
+ function test_empty() {
+ compare(empty.width, 0, "width")
+ compare(empty.height, 0, "height")
+ compare(empty.multiSeriesUniform, false, "multiSeriesUniform")
+ compare(empty.barThickness, 1.0, "barThickness")
+ compare(empty.barSpacing, Qt.size(0.2, 0.2), "barSpacing")
+ compare(empty.barSpacingRelative, true, "barSpacingRelative")
+ compare(empty.seriesList.length, 0, "seriesList")
+ compare(empty.selectedSeries, null, "selectedSeries")
+ compare(empty.primarySeries, null, "primarySeries")
+ compare(empty.floorLevel, 0.0, "floorLevel")
+ compare(empty.columnAxis.orientation, AbstractAxis3D.AxisOrientationX)
+ compare(empty.rowAxis.orientation, AbstractAxis3D.AxisOrientationZ)
+ compare(empty.valueAxis.orientation, AbstractAxis3D.AxisOrientationY)
+ compare(empty.columnAxis.type, AbstractAxis3D.AxisTypeCategory)
+ compare(empty.rowAxis.type, AbstractAxis3D.AxisTypeCategory)
+ compare(empty.valueAxis.type, AbstractAxis3D.AxisTypeValue)
+ }
+ }
+
+ TestCase {
+ name: "Bars3D Basic"
+ when: windowShown
+
+ function test_basic() {
+ compare(basic.width, 150, "width")
+ compare(basic.height, 150, "height")
+ compare(basic.multiSeriesUniform, true, "multiSeriesUniform")
+ compare(basic.barThickness, 0.1, "barThickness")
+ compare(basic.barSpacing, Qt.size(0.1, 0.1), "barSpacing")
+ compare(basic.barSpacingRelative, false, "barSpacingRelative")
+ compare(basic.floorLevel, 1.0, "floorLevel")
+ }
+
+ function test_change_basic() {
+ basic.multiSeriesUniform = false
+ basic.barThickness = 0.5
+ basic.barSpacing = Qt.size(1.0, 0.0)
+ basic.barSpacingRelative = true
+ basic.floorLevel = 0.2
+ compare(basic.multiSeriesUniform, false, "multiSeriesUniform")
+ compare(basic.barThickness, 0.5, "barThickness")
+ compare(basic.barSpacing, Qt.size(1.0, 0.0), "barSpacing")
+ compare(basic.barSpacingRelative, true, "barSpacingRelative")
+ compare(basic.floorLevel, 0.2, "floorLevel")
+ }
+
+ function test_change_invalid_basic() {
+ basic.barThickness = -1
+ basic.barSpacing = Qt.size(-1.0, -1.0)
+ compare(basic.barThickness, -1/*0.5*/, "barThickness") // TODO: Fix once QTRD-3367 is done
+ compare(basic.barSpacing, Qt.size(1.0, 0.0), "barSpacing")
+ }
+ }
+
+ TestCase {
+ name: "Bars3D Common"
+ when: windowShown
+
+ function test_1_common() {
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality")
+ if (common.shadowsSupported === true)
+ compare(common.msaaSamples, 4, "msaaSamples")
+ else
+ compare(common.msaaSamples, 0, "msaaSamples")
+ compare(common.theme.type, Theme3D.ThemeQt, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
+ compare(common.measureFps, false, "measureFps")
+ compare(common.customItemList.length, 0, "customItemList")
+ compare(common.orthoProjection, false, "orthoProjection")
+ compare(common.selectedElement, AbstractGraph3D.ElementNone, "selectedElement")
+ compare(common.aspectRatio, 2.0, "aspectRatio")
+ compare(common.optimizationHints, AbstractGraph3D.OptimizationDefault, "optimizationHints")
+ compare(common.polar, false, "polar")
+ compare(common.radialLabelOffset, 1, "radialLabelOffset")
+ compare(common.horizontalAspectRatio, 0, "horizontalAspectRatio")
+ compare(common.reflection, false, "reflection")
+ compare(common.reflectivity, 0.5, "reflectivity")
+ compare(common.locale, Qt.locale("C"), "locale")
+ compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition")
+ compare(common.margin, -1, "margin")
+ }
+
+ function test_2_change_common() {
+ common.selectionMode = AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice
+ common.shadowQuality = AbstractGraph3D.ShadowQualitySoftHigh
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality")
+ common.msaaSamples = 8
+ if (common.shadowsSupported === true)
+ compare(common.msaaSamples, 8, "msaaSamples")
+ else
+ compare(common.msaaSamples, 0, "msaaSamples")
+ common.theme.type = Theme3D.ThemeRetro
+ common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear
+ common.measureFps = true
+ common.orthoProjection = true
+ common.aspectRatio = 1.0
+ common.optimizationHints = AbstractGraph3D.OptimizationStatic
+ common.polar = true
+ common.radialLabelOffset = 2
+ common.horizontalAspectRatio = 1
+ common.reflection = true
+ common.reflectivity = 1.0
+ common.locale = Qt.locale("FI")
+ common.margin = 1.0
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice, "selectionMode")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality") // Ortho disables shadows
+ compare(common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
+ compare(common.theme.type, Theme3D.ThemeRetro, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode")
+ compare(common.measureFps, true, "measureFps")
+ compare(common.orthoProjection, true, "orthoProjection")
+ compare(common.aspectRatio, 1.0, "aspectRatio")
+ compare(common.optimizationHints, AbstractGraph3D.OptimizationStatic, "optimizationHints")
+ compare(common.polar, true, "polar")
+ compare(common.radialLabelOffset, 2, "radialLabelOffset")
+ compare(common.horizontalAspectRatio, 1, "horizontalAspectRatio")
+ compare(common.reflection, true, "reflection")
+ compare(common.reflectivity, 1.0, "reflectivity")
+ compare(common.locale, Qt.locale("FI"), "locale")
+ compare(common.margin, 1.0, "margin")
+ }
+
+ function test_3_change_invalid_common() {
+ common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice
+ common.theme.type = -2
+ common.renderingMode = -1
+ common.measureFps = false
+ common.orthoProjection = false
+ common.aspectRatio = -1.0
+ common.polar = false
+ common.horizontalAspectRatio = -2
+ common.reflection = false
+ common.reflectivity = -1.0
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice, "selectionMode")
+ compare(common.theme.type, -2/*Theme3D.ThemeRetro*/, "theme") // TODO: Fix once QTRD-3367 is done
+ compare(common.renderingMode, -1/*AbstractGraph3D.RenderDirectToBackground_NoClear*/, "renderingMode") // TODO: Fix once QTRD-3367 is done
+ 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
+ }
+
+ function test_4_common_initialized() {
+ compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
+ if (common_init.shadowsSupported === true) {
+ compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality")
+ compare(common_init.msaaSamples, 2, "msaaSamples")
+ } else {
+ compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality")
+ compare(common_init.msaaSamples, 0, "msaaSamples")
+ }
+ compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
+ compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
+ compare(common_init.measureFps, true, "measureFps")
+ compare(common_init.customItemList.length, 0, "customItemList")
+ compare(common_init.orthoProjection, false, "orthoProjection")
+ compare(common_init.aspectRatio, 3.0, "aspectRatio")
+ compare(common_init.optimizationHints, AbstractGraph3D.OptimizationStatic, "optimizationHints")
+ compare(common_init.polar, false, "polar")
+ compare(common_init.radialLabelOffset, 2, "radialLabelOffset")
+ compare(common_init.horizontalAspectRatio, 0.2, "horizontalAspectRatio")
+ compare(common_init.reflection, true, "reflection")
+ compare(common_init.reflectivity, 0.1, "reflectivity")
+ compare(common_init.locale, Qt.locale("UK"), "locale")
+ compare(common_init.margin, 0.2, "margin")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/bars3d/tst_proxy.qml b/tests/auto/qmltest/bars3d/tst_proxy.qml
new file mode 100644
index 00000000..8d91c055
--- /dev/null
+++ b/tests/auto/qmltest/bars3d/tst_proxy.qml
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ ItemModelBarDataProxy {
+ id: initial
+ }
+
+ ItemModelBarDataProxy {
+ id: initialized
+
+ autoColumnCategories: false
+ autoRowCategories: false
+ columnCategories: ["colcat1", "colcat2"]
+ columnRole: "col"
+ columnRolePattern: /^.*-(\d\d)$/
+ columnRoleReplace: "\\1"
+ itemModel: ListModel { objectName: "model1" }
+ multiMatchBehavior: ItemModelBarDataProxy.MMBAverage
+ rotationRole: "rot"
+ rotationRolePattern: /-/
+ rotationRoleReplace: "\\1"
+ rowCategories: ["rowcat1", "rowcat2"]
+ rowRole: "row"
+ rowRolePattern: /^(\d\d\d\d).*$/
+ rowRoleReplace: "\\1"
+ valueRole: "val"
+ valueRolePattern: /-/
+ valueRoleReplace: "\\1"
+
+ columnLabels: ["col1", "col2"]
+ rowLabels: ["row1", "row2"]
+ }
+
+ ItemModelBarDataProxy {
+ id: change
+ }
+
+ TestCase {
+ name: "ItemModelBarDataProxy Initial"
+
+ function test_initial() {
+ compare(initial.autoColumnCategories, true)
+ compare(initial.autoRowCategories, true)
+ compare(initial.columnCategories, [])
+ compare(initial.columnRole, "")
+ verify(initial.columnRolePattern)
+ compare(initial.columnRoleReplace, "")
+ verify(!initial.itemModel)
+ compare(initial.multiMatchBehavior, ItemModelBarDataProxy.MMBLast)
+ compare(initial.rotationRole, "")
+ verify(initial.rotationRolePattern)
+ compare(initial.rotationRoleReplace, "")
+ compare(initial.rowCategories, [])
+ compare(initial.rowRole, "")
+ verify(initial.rowRolePattern)
+ compare(initial.rowRoleReplace, "")
+ compare(initial.useModelCategories, false)
+ compare(initial.valueRole, "")
+ verify(initial.valueRolePattern)
+ compare(initial.valueRoleReplace, "")
+
+ compare(initial.columnLabels.length, 0)
+ compare(initial.rowCount, 0)
+ compare(initial.rowLabels.length, 0)
+ verify(!initial.series)
+
+ compare(initial.type, AbstractDataProxy.DataTypeBar)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelBarDataProxy Initialized"
+
+ function test_initialized() {
+ compare(initialized.autoColumnCategories, false)
+ compare(initialized.autoRowCategories, false)
+ compare(initialized.columnCategories.length, 2)
+ compare(initialized.columnCategories[0], "colcat1")
+ compare(initialized.columnCategories[1], "colcat2")
+ compare(initialized.columnRole, "col")
+ compare(initialized.columnRolePattern, /^.*-(\d\d)$/)
+ compare(initialized.columnRoleReplace, "\\1")
+ compare(initialized.itemModel.objectName, "model1")
+ compare(initialized.multiMatchBehavior, ItemModelBarDataProxy.MMBAverage)
+ compare(initialized.rotationRole, "rot")
+ compare(initialized.rotationRolePattern, /-/)
+ compare(initialized.rotationRoleReplace, "\\1")
+ compare(initialized.rowCategories.length, 2)
+ compare(initialized.rowCategories[0], "rowcat1")
+ compare(initialized.rowCategories[1], "rowcat2")
+ compare(initialized.rowRole, "row")
+ compare(initialized.rowRolePattern, /^(\d\d\d\d).*$/)
+ compare(initialized.rowRoleReplace, "\\1")
+ compare(initialized.valueRole, "val")
+ compare(initialized.valueRolePattern, /-/)
+ compare(initialized.valueRoleReplace, "\\1")
+
+ compare(initialized.columnLabels.length, 2)
+ compare(initialized.rowCount, 2)
+ compare(initialized.rowLabels.length, 2)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelBarDataProxy Change"
+
+ ListModel { id: model1; objectName: "model1" }
+
+ function test_1_change() {
+ change.autoColumnCategories = false
+ change.autoRowCategories = false
+ change.columnCategories = ["colcat1", "colcat2"]
+ change.columnRole = "col"
+ change.columnRolePattern = /^.*-(\d\d)$/
+ change.columnRoleReplace = "\\1"
+ change.itemModel = model1
+ change.multiMatchBehavior = ItemModelBarDataProxy.MMBAverage
+ change.rotationRole = "rot"
+ change.rotationRolePattern = /-/
+ change.rotationRoleReplace = "\\1"
+ change.rowCategories = ["rowcat1", "rowcat2"]
+ change.rowRole = "row"
+ change.rowRolePattern = /^(\d\d\d\d).*$/
+ change.rowRoleReplace = "\\1"
+ change.useModelCategories = true // Overwrites columnLabels and rowLabels
+ change.valueRole = "val"
+ change.valueRolePattern = /-/
+ change.valueRoleReplace = "\\1"
+
+ change.columnLabels = ["col1", "col2"]
+ change.rowLabels = ["row1", "row2"]
+ }
+
+ function test_2_test_change() {
+ // This test has a dependency to the previous one due to asynchronous item model resolving
+ compare(change.autoColumnCategories, false)
+ compare(change.autoRowCategories, false)
+ compare(change.columnCategories.length, 2)
+ compare(change.columnCategories[0], "colcat1")
+ compare(change.columnCategories[1], "colcat2")
+ compare(change.columnRole, "col")
+ compare(change.columnRolePattern, /^.*-(\d\d)$/)
+ compare(change.columnRoleReplace, "\\1")
+ compare(change.itemModel.objectName, "model1")
+ compare(change.multiMatchBehavior, ItemModelBarDataProxy.MMBAverage)
+ compare(change.rotationRole, "rot")
+ compare(change.rotationRolePattern, /-/)
+ compare(change.rotationRoleReplace, "\\1")
+ compare(change.rowCategories.length, 2)
+ compare(change.rowCategories[0], "rowcat1")
+ compare(change.rowCategories[1], "rowcat2")
+ compare(change.rowRole, "row")
+ compare(change.rowRolePattern, /^(\d\d\d\d).*$/)
+ compare(change.rowRoleReplace, "\\1")
+ compare(change.useModelCategories, true)
+ compare(change.valueRole, "val")
+ compare(change.valueRolePattern, /-/)
+ compare(change.valueRoleReplace, "\\1")
+
+ compare(change.columnLabels.length, 1)
+ compare(change.rowCount, 0)
+ compare(change.rowLabels.length, 0)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelBarDataProxy MultiMatchBehaviour"
+
+ Bars3D {
+ id: bars1
+
+ Bar3DSeries {
+ ItemModelBarDataProxy {
+ id: barProxy
+ itemModel: ListModel {
+ ListElement{ coords: "0,0"; data: "5"; }
+ ListElement{ coords: "0,0"; data: "15"; }
+ }
+ rowRole: "coords"
+ columnRole: "coords"
+ valueRole: "data"
+ rowRolePattern: /(\d),\d/
+ columnRolePattern: /(\d),(\d)/
+ rowRoleReplace: "\\1"
+ columnRoleReplace: "\\2"
+ }
+ }
+ }
+
+ function test_0_async_dummy() {
+ }
+
+ function test_1_test_multimatch() {
+ compare(bars1.valueAxis.max, 15)
+ }
+
+ function test_2_multimatch() {
+ barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBFirst
+ }
+
+ function test_3_test_multimatch() {
+ compare(bars1.valueAxis.max, 5)
+ }
+
+ function test_4_multimatch() {
+ barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBLast
+ }
+
+ function test_5_test_multimatch() {
+ compare(bars1.valueAxis.max, 15)
+ }
+
+ function test_6_multimatch() {
+ barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBAverage
+ }
+
+ function test_7_test_multimatch() {
+ compare(bars1.valueAxis.max, 10)
+ }
+
+ function test_8_multimatch() {
+ barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBCumulative
+ }
+
+ function test_9_test_multimatch() {
+ compare(bars1.valueAxis.max, 20)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/custom3d/tst_customitem.qml b/tests/auto/qmltest/custom3d/tst_customitem.qml
new file mode 100644
index 00000000..ee3d10fc
--- /dev/null
+++ b/tests/auto/qmltest/custom3d/tst_customitem.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ Custom3DItem {
+ id: initial
+ }
+
+ Custom3DItem {
+ id: initialized
+ meshFile: ":\customitem.obj"
+ position: Qt.vector3d(1.0, 0.5, 1.0)
+ positionAbsolute: true
+ rotation: Qt.quaternion(1, 0.5, 0, 0)
+ scaling: Qt.vector3d(0.2, 0.2, 0.2)
+ scalingAbsolute: false
+ shadowCasting: false
+ textureFile: ":\customtexture.jpg"
+ visible: false
+ }
+
+ Custom3DItem {
+ id: change
+ }
+
+ TestCase {
+ name: "Custom3DItem Initial"
+
+ function test_initial() {
+ compare(initial.meshFile, "")
+ compare(initial.position, Qt.vector3d(0.0, 0.0, 0.0))
+ compare(initial.positionAbsolute, false)
+ compare(initial.rotation, Qt.quaternion(0, 0, 0, 0))
+ compare(initial.scaling, Qt.vector3d(0.1, 0.1, 0.1))
+ compare(initial.scalingAbsolute, true)
+ compare(initial.shadowCasting, true)
+ compare(initial.textureFile, "")
+ compare(initial.visible, true)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DItem Initialized"
+
+ function test_initialized() {
+ compare(initialized.meshFile, ":\customitem.obj")
+ compare(initialized.position, Qt.vector3d(1.0, 0.5, 1.0))
+ compare(initialized.positionAbsolute, true)
+ compare(initialized.rotation, Qt.quaternion(1, 0.5, 0, 0))
+ compare(initialized.scaling, Qt.vector3d(0.2, 0.2, 0.2))
+ compare(initialized.scalingAbsolute, false)
+ compare(initialized.shadowCasting, false)
+ compare(initialized.textureFile, ":\customtexture.jpg")
+ compare(initialized.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DItem Change"
+
+ function test_change() {
+ change.meshFile = ":\customitem.obj"
+ change.position = Qt.vector3d(1.0, 0.5, 1.0)
+ change.positionAbsolute = true
+ change.rotation = Qt.quaternion(1, 0.5, 0, 0)
+ change.scaling = Qt.vector3d(0.2, 0.2, 0.2)
+ change.scalingAbsolute = false
+ change.shadowCasting = false
+ change.textureFile = ":\customtexture.jpg"
+ change.visible = false
+
+ compare(change.meshFile, ":\customitem.obj")
+ compare(change.position, Qt.vector3d(1.0, 0.5, 1.0))
+ compare(change.positionAbsolute, true)
+ compare(change.rotation, Qt.quaternion(1, 0.5, 0, 0))
+ compare(change.scaling, Qt.vector3d(0.2, 0.2, 0.2))
+ compare(change.scalingAbsolute, false)
+ compare(change.shadowCasting, false)
+ compare(change.textureFile, ":\customtexture.jpg")
+ compare(change.visible, false)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/custom3d/tst_customlabel.qml b/tests/auto/qmltest/custom3d/tst_customlabel.qml
new file mode 100644
index 00000000..acac1b63
--- /dev/null
+++ b/tests/auto/qmltest/custom3d/tst_customlabel.qml
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ Custom3DLabel {
+ id: initial
+ }
+
+ Custom3DLabel {
+ id: initialized
+ backgroundColor: "red"
+ backgroundEnabled: false
+ borderEnabled: false
+ facingCamera: true
+ font.family: "Times New Roman"
+ text: "test label"
+ textColor: "blue"
+
+ position: Qt.vector3d(1.0, 0.5, 1.0)
+ positionAbsolute: true
+ rotation: Qt.quaternion(1, 0.5, 0, 0)
+ scaling: Qt.vector3d(0.2, 0.2, 0.2)
+ shadowCasting: true
+ visible: false
+ }
+
+ Custom3DLabel {
+ id: change
+ }
+
+ TestCase {
+ name: "Custom3DLabel Initial"
+
+ function test_initial() {
+ compare(initial.backgroundColor, "#a0a0a4")
+ compare(initial.backgroundEnabled, true)
+ compare(initial.borderEnabled, true)
+ compare(initial.facingCamera, false)
+ compare(initial.font.family, "Arial")
+ compare(initial.text, "")
+ compare(initial.textColor, "#ffffff")
+
+ compare(initial.meshFile, ":/defaultMeshes/plane")
+ compare(initial.position, Qt.vector3d(0.0, 0.0, 0.0))
+ compare(initial.positionAbsolute, false)
+ compare(initial.rotation, Qt.quaternion(0, 0, 0, 0))
+ compare(initial.scaling, Qt.vector3d(0.1, 0.1, 0.1))
+ compare(initial.scalingAbsolute, true)
+ compare(initial.shadowCasting, false)
+ compare(initial.textureFile, "")
+ compare(initial.visible, true)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DLabel Initialized"
+
+ function test_initialized() {
+ compare(initialized.backgroundColor, "#ff0000")
+ compare(initialized.backgroundEnabled, false)
+ compare(initialized.borderEnabled, false)
+ compare(initialized.facingCamera, true)
+ compare(initialized.font.family, "Times New Roman")
+ compare(initialized.text, "test label")
+ compare(initialized.textColor, "#0000ff")
+
+ compare(initialized.position, Qt.vector3d(1.0, 0.5, 1.0))
+ compare(initialized.positionAbsolute, true)
+ compare(initialized.rotation, Qt.quaternion(1, 0.5, 0, 0))
+ compare(initialized.scaling, Qt.vector3d(0.2, 0.2, 0.2))
+ compare(initialized.shadowCasting, true)
+ compare(initialized.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DLabel Change"
+
+ function test_change() {
+ change.backgroundColor = "red"
+ change.backgroundEnabled = false
+ change.borderEnabled = false
+ change.facingCamera = true
+ change.font.family = "Times New Roman"
+ change.text = "test label"
+ change.textColor = "blue"
+
+ change.position = Qt.vector3d(1.0, 0.5, 1.0)
+ change.positionAbsolute = true
+ change.rotation = Qt.quaternion(1, 0.5, 0, 0)
+ change.scaling = Qt.vector3d(0.2, 0.2, 0.2)
+ change.shadowCasting = true
+ change.visible = false
+
+ compare(change.backgroundColor, "#ff0000")
+ compare(change.backgroundEnabled, false)
+ compare(change.borderEnabled, false)
+ compare(change.facingCamera, true)
+ compare(change.font.family, "Times New Roman")
+ compare(change.text, "test label")
+ compare(change.textColor, "#0000ff")
+
+ compare(change.position, Qt.vector3d(1.0, 0.5, 1.0))
+ compare(change.positionAbsolute, true)
+ compare(change.rotation, Qt.quaternion(1, 0.5, 0, 0))
+ compare(change.scaling, Qt.vector3d(0.2, 0.2, 0.2))
+ compare(change.shadowCasting, true)
+ compare(change.visible, false)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/custom3d/tst_customvolume.qml b/tests/auto/qmltest/custom3d/tst_customvolume.qml
new file mode 100644
index 00000000..08c15013
--- /dev/null
+++ b/tests/auto/qmltest/custom3d/tst_customvolume.qml
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ Custom3DVolume {
+ id: initial
+ }
+
+ Custom3DVolume {
+ id: initialized
+ alphaMultiplier: 0.1
+ drawSliceFrames: true
+ drawSlices: true
+ preserveOpacity: false
+ sliceFrameColor: "red"
+ sliceFrameGaps: Qt.vector3d(2.0, 2.0, 2.0)
+ sliceFrameThicknesses: Qt.vector3d(2.0, 2.0, 2.0)
+ sliceFrameWidths: Qt.vector3d(2.0, 2.0, 2.0)
+ sliceIndexX: 0
+ sliceIndexY: 0
+ sliceIndexZ: 0
+ useHighDefShader: false
+
+ position: Qt.vector3d(1.0, 0.5, 1.0)
+ positionAbsolute: true
+ rotation: Qt.quaternion(1, 0.5, 0, 0)
+ scaling: Qt.vector3d(0.2, 0.2, 0.2)
+ scalingAbsolute: false
+ shadowCasting: false
+ visible: false
+ }
+
+ Custom3DVolume {
+ id: change
+ }
+
+ Custom3DVolume {
+ id: invalid
+ }
+
+ TestCase {
+ name: "Custom3DVolume Initial"
+
+ function test_initial() {
+ compare(initial.alphaMultiplier, 1.0)
+ compare(initial.drawSliceFrames, false)
+ compare(initial.drawSlices, false)
+ compare(initial.preserveOpacity, true)
+ compare(initial.sliceFrameColor, "#000000")
+ compare(initial.sliceFrameGaps, Qt.vector3d(0.01, 0.01, 0.01))
+ compare(initial.sliceFrameThicknesses, Qt.vector3d(0.01, 0.01, 0.01))
+ compare(initial.sliceFrameWidths, Qt.vector3d(0.01, 0.01, 0.01))
+ compare(initial.sliceIndexX, -1)
+ compare(initial.sliceIndexY, -1)
+ compare(initial.sliceIndexZ, -1)
+ compare(initial.useHighDefShader, true)
+
+ compare(initial.meshFile, ":/defaultMeshes/barFull")
+ compare(initial.position, Qt.vector3d(0.0, 0.0, 0.0))
+ compare(initial.positionAbsolute, false)
+ compare(initial.rotation, Qt.quaternion(0, 0, 0, 0))
+ compare(initial.scaling, Qt.vector3d(0.1, 0.1, 0.1))
+ compare(initial.scalingAbsolute, true)
+ compare(initial.shadowCasting, true)
+ compare(initial.textureFile, "")
+ compare(initial.visible, true)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DVolume Initialized"
+
+ function test_initialized() {
+ compare(initialized.alphaMultiplier, 0.1)
+ compare(initialized.drawSliceFrames, true)
+ compare(initialized.drawSlices, true)
+ compare(initialized.preserveOpacity, false)
+ compare(initialized.sliceFrameColor, "#ff0000")
+ compare(initialized.sliceFrameGaps, Qt.vector3d(2.0, 2.0, 2.0))
+ compare(initialized.sliceFrameThicknesses, Qt.vector3d(2.0, 2.0, 2.0))
+ compare(initialized.sliceFrameWidths, Qt.vector3d(2.0, 2.0, 2.0))
+ compare(initialized.sliceIndexX, 0)
+ compare(initialized.sliceIndexY, 0)
+ compare(initialized.sliceIndexZ, 0)
+ compare(initialized.useHighDefShader, false)
+
+ compare(initialized.position, Qt.vector3d(1.0, 0.5, 1.0))
+ compare(initialized.positionAbsolute, true)
+ compare(initialized.rotation, Qt.quaternion(1, 0.5, 0, 0))
+ compare(initialized.scaling, Qt.vector3d(0.2, 0.2, 0.2))
+ compare(initialized.scalingAbsolute, false)
+ compare(initialized.shadowCasting, false)
+ compare(initialized.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DVolume Change"
+
+ function test_change() {
+ change.alphaMultiplier = 0.1
+ change.drawSliceFrames = true
+ change.drawSlices = true
+ change.preserveOpacity = false
+ change.sliceFrameColor = "red"
+ change.sliceFrameGaps = Qt.vector3d(2.0, 2.0, 2.0)
+ change.sliceFrameThicknesses = Qt.vector3d(2.0, 2.0, 2.0)
+ change.sliceFrameWidths = Qt.vector3d(2.0, 2.0, 2.0)
+ change.sliceIndexX = 0
+ change.sliceIndexY = 0
+ change.sliceIndexZ = 0
+ change.useHighDefShader = false
+
+ change.position = Qt.vector3d(1.0, 0.5, 1.0)
+ change.positionAbsolute = true
+ change.rotation = Qt.quaternion(1, 0.5, 0, 0)
+ change.scaling = Qt.vector3d(0.2, 0.2, 0.2)
+ change.scalingAbsolute = false
+ change.shadowCasting = false
+ change.visible = false
+
+ compare(change.alphaMultiplier, 0.1)
+ compare(change.drawSliceFrames, true)
+ compare(change.drawSlices, true)
+ compare(change.preserveOpacity, false)
+ compare(change.sliceFrameColor, "#ff0000")
+ compare(change.sliceFrameGaps, Qt.vector3d(2.0, 2.0, 2.0))
+ compare(change.sliceFrameThicknesses, Qt.vector3d(2.0, 2.0, 2.0))
+ compare(change.sliceFrameWidths, Qt.vector3d(2.0, 2.0, 2.0))
+ compare(change.sliceIndexX, 0)
+ compare(change.sliceIndexY, 0)
+ compare(change.sliceIndexZ, 0)
+ compare(change.useHighDefShader, false)
+
+ compare(change.position, Qt.vector3d(1.0, 0.5, 1.0))
+ compare(change.positionAbsolute, true)
+ compare(change.rotation, Qt.quaternion(1, 0.5, 0, 0))
+ compare(change.scaling, Qt.vector3d(0.2, 0.2, 0.2))
+ compare(change.scalingAbsolute, false)
+ compare(change.shadowCasting, false)
+ compare(change.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Custom3DVolume Invalid"
+
+ function test_invalid() {
+ invalid.alphaMultiplier = -1.0
+ compare(invalid.alphaMultiplier, 1.0)
+ invalid.sliceFrameGaps = Qt.vector3d(-0.1, -0.1, -0.1)
+ compare(invalid.sliceFrameGaps, Qt.vector3d(0.01, 0.01, 0.01))
+ invalid.sliceFrameThicknesses = Qt.vector3d(-0.1, -0.1, -0.1)
+ compare(invalid.sliceFrameThicknesses, Qt.vector3d(0.01, 0.01, 0.01))
+ invalid.sliceFrameWidths = Qt.vector3d(-0.1, -0.1, -0.1)
+ compare(invalid.sliceFrameWidths, Qt.vector3d(0.01, 0.01, 0.01))
+ }
+ }
+}
diff --git a/tests/auto/qmltest/customitem.obj b/tests/auto/qmltest/customitem.obj
new file mode 100644
index 00000000..108cf7ac
--- /dev/null
+++ b/tests/auto/qmltest/customitem.obj
@@ -0,0 +1,54 @@
+# Blender v2.66 (sub 0) OBJ File: 'cube_filled.blend'
+# www.blender.org
+o Cube
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 1.000000 -1.000000
+v 1.000000 1.000000 1.000000
+vt 0.666667 0.332314
+vt 0.334353 0.333333
+vt 0.665647 0.000000
+vt 0.001020 0.333333
+vt 0.000000 0.001020
+vt 0.333333 0.332314
+vt 0.333333 0.665647
+vt 0.001019 0.666667
+vt 0.000000 0.334353
+vt 0.334353 0.666667
+vt 0.333333 0.334353
+vt 0.665647 0.333333
+vt 0.333333 0.667686
+vt 0.665647 0.666667
+vt 0.666667 0.998980
+vt 0.667686 0.333333
+vt 0.666667 0.001019
+vt 0.998980 0.000000
+vt 0.333333 0.001019
+vt 0.332314 0.000000
+vt 0.332314 0.333333
+vt 0.666667 0.665647
+vt 0.334353 1.000000
+vt 1.000000 0.332314
+vn -1.000000 0.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 1.000000 0.000000
+vn -0.000000 -1.000000 -0.000000
+s off
+f 5/1/1 6/2/1 1/3/1
+f 6/4/2 7/5/2 2/6/2
+f 7/7/3 8/8/3 4/9/3
+f 8/10/4 5/11/4 1/12/4
+f 8/13/5 7/14/5 6/15/5
+f 2/16/6 3/17/6 4/18/6
+f 6/2/1 2/19/1 1/3/1
+f 7/5/2 3/20/2 2/6/2
+f 3/21/3 7/7/3 4/9/3
+f 4/22/4 8/10/4 1/12/4
+f 5/23/5 8/13/5 6/15/5
+f 1/24/6 2/16/6 4/18/6
diff --git a/tests/auto/qmltest/customtexture.jpg b/tests/auto/qmltest/customtexture.jpg
new file mode 100644
index 00000000..2580f5bd
--- /dev/null
+++ b/tests/auto/qmltest/customtexture.jpg
Binary files differ
diff --git a/tests/auto/qmltest/input3d/tst_input.qml b/tests/auto/qmltest/input3d/tst_input.qml
new file mode 100644
index 00000000..fefb585e
--- /dev/null
+++ b/tests/auto/qmltest/input3d/tst_input.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ InputHandler3D {
+ id: initial
+ }
+
+ InputHandler3D {
+ id: initialized
+ rotationEnabled: false
+ selectionEnabled: false
+ zoomAtTargetEnabled: false
+ zoomEnabled: false
+ }
+
+ InputHandler3D {
+ id: change
+ }
+
+ TestCase {
+ name: "InputHandler3D Initial"
+
+ function test_initial() {
+ compare(initial.rotationEnabled, true)
+ compare(initial.selectionEnabled, true)
+ compare(initial.zoomAtTargetEnabled, true)
+ compare(initial.zoomEnabled, true)
+ }
+ }
+
+ TestCase {
+ name: "InputHandler3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.rotationEnabled, false)
+ compare(initialized.selectionEnabled, false)
+ compare(initialized.zoomAtTargetEnabled, false)
+ compare(initialized.zoomEnabled, false)
+ }
+ }
+
+ TestCase {
+ name: "InputHandler3D Change"
+
+ function test_change() {
+ change.rotationEnabled = false
+ change.selectionEnabled = false
+ change.zoomAtTargetEnabled = false
+ change.zoomEnabled = false
+
+ compare(change.rotationEnabled, false)
+ compare(change.selectionEnabled, false)
+ compare(change.zoomAtTargetEnabled, false)
+ compare(change.zoomEnabled, false)
+ }
+
+ // TODO: QTRD-3380 (mouse events)
+ }
+}
diff --git a/tests/auto/qmltest/input3d/tst_touch.qml b/tests/auto/qmltest/input3d/tst_touch.qml
new file mode 100644
index 00000000..626da68f
--- /dev/null
+++ b/tests/auto/qmltest/input3d/tst_touch.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ TouchInputHandler3D {
+ id: initial
+ }
+
+ TouchInputHandler3D {
+ id: initialized
+ rotationEnabled: false
+ selectionEnabled: false
+ zoomAtTargetEnabled: false
+ zoomEnabled: false
+ }
+
+ TouchInputHandler3D {
+ id: change
+ }
+
+ TestCase {
+ name: "TouchInputHandler3D Initial"
+
+ function test_initial() {
+ compare(initial.rotationEnabled, true)
+ compare(initial.selectionEnabled, true)
+ compare(initial.zoomAtTargetEnabled, true)
+ compare(initial.zoomEnabled, true)
+ }
+ }
+
+ TestCase {
+ name: "TouchInputHandler3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.rotationEnabled, false)
+ compare(initialized.selectionEnabled, false)
+ compare(initialized.zoomAtTargetEnabled, false)
+ compare(initialized.zoomEnabled, false)
+ }
+ }
+
+ TestCase {
+ name: "TouchInputHandler3D Change"
+
+ function test_change() {
+ change.rotationEnabled = false
+ change.selectionEnabled = false
+ change.zoomAtTargetEnabled = false
+ change.zoomEnabled = false
+
+ compare(change.rotationEnabled, false)
+ compare(change.selectionEnabled, false)
+ compare(change.zoomAtTargetEnabled, false)
+ compare(change.zoomEnabled, false)
+
+ // TODO: QTRD-3380 (mouse events)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro
new file mode 100644
index 00000000..cbb9b8b8
--- /dev/null
+++ b/tests/auto/qmltest/qmltest.pro
@@ -0,0 +1,35 @@
+TEMPLATE = app
+TARGET = tst_qmltest
+CONFIG += qmltestcase
+CONFIG += console
+SOURCES += tst_qmltest.cpp
+OTHER_FILES += bars3d\tst_basic.qml \
+ bars3d\tst_bars.qml \
+ bars3d\tst_barseries.qml \
+ bars3d\tst_proxy.qml \
+ scatter3d\tst_basic.qml \
+ scatter3d\tst_scatter.qml \
+ scatter3d\tst_scatterseries.qml \
+ scatter3d\tst_proxy.qml \
+ surface3d\tst_basic.qml \
+ surface3d\tst_surface.qml \
+ surface3d\tst_surfaceseries.qml \
+ surface3d\tst_proxy.qml \
+ surface3d\tst_heightproxy.qml \
+ theme3d\tst_theme.qml \
+ theme3d\tst_colorgradient.qml \
+ theme3d\tst_themecolor.qml \
+ custom3d\tst_customitem.qml \
+ custom3d\tst_customlabel.qml \
+ custom3d\tst_customvolume.qml \
+ scene3d\tst_scene.qml \
+ scene3d\tst_camera.qml \
+ scene3d\tst_light.qml \
+ input3d\tst_input.qml \
+ input3d\tst_touch.qml \
+ axis3d\tst_category.qml \
+ axis3d\tst_value.qml \
+ axis3d\tst_logvalue.qml \
+
+RESOURCES += \
+ qmltest.qrc
diff --git a/tests/auto/qmltest/qmltest.qrc b/tests/auto/qmltest/qmltest.qrc
new file mode 100644
index 00000000..61f19086
--- /dev/null
+++ b/tests/auto/qmltest/qmltest.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>customitem.obj</file>
+ <file>customtexture.jpg</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qmltest/scatter3d/tst_basic.qml b/tests/auto/qmltest/scatter3d/tst_basic.qml
new file mode 100644
index 00000000..b7221701
--- /dev/null
+++ b/tests/auto/qmltest/scatter3d/tst_basic.qml
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Scatter3D {
+ id: empty
+ }
+
+ Scatter3D {
+ id: basic
+ anchors.fill: parent
+ }
+
+ Scatter3D {
+ id: common
+ anchors.fill: parent
+ }
+
+ 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
+ }
+
+ TestCase {
+ name: "Scatter3D Empty"
+
+ function test_empty() {
+ compare(empty.width, 0, "width")
+ compare(empty.height, 0, "height")
+ compare(empty.seriesList.length, 0, "seriesList")
+ compare(empty.selectedSeries, null, "selectedSeries")
+ compare(empty.axisX.orientation, AbstractAxis3D.AxisOrientationX)
+ compare(empty.axisZ.orientation, AbstractAxis3D.AxisOrientationZ)
+ compare(empty.axisY.orientation, AbstractAxis3D.AxisOrientationY)
+ compare(empty.axisX.type, AbstractAxis3D.AxisTypeValue)
+ compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue)
+ compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue)
+ }
+ }
+
+ TestCase {
+ name: "Scatter3D Basic"
+ when: windowShown
+
+ function test_basic() {
+ compare(basic.width, 150, "width")
+ compare(basic.height, 150, "height")
+ }
+ }
+
+ TestCase {
+ name: "Scatter3D Common"
+ when: windowShown
+
+ function test_1_common() {
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality")
+ if (common.shadowsSupported === true)
+ compare(common.msaaSamples, 4, "msaaSamples")
+ else
+ compare(common.msaaSamples, 0, "msaaSamples")
+ compare(common.theme.type, Theme3D.ThemeQt, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
+ compare(common.measureFps, false, "measureFps")
+ compare(common.customItemList.length, 0, "customItemList")
+ compare(common.orthoProjection, false, "orthoProjection")
+ compare(common.selectedElement, AbstractGraph3D.ElementNone, "selectedElement")
+ compare(common.aspectRatio, 2.0, "aspectRatio")
+ compare(common.optimizationHints, AbstractGraph3D.OptimizationDefault, "optimizationHints")
+ compare(common.polar, false, "polar")
+ compare(common.radialLabelOffset, 1, "radialLabelOffset")
+ compare(common.horizontalAspectRatio, 0, "horizontalAspectRatio")
+ compare(common.reflection, false, "reflection")
+ compare(common.reflectivity, 0.5, "reflectivity")
+ compare(common.locale, Qt.locale("C"), "locale")
+ compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition")
+ compare(common.margin, -1, "margin")
+ }
+
+ function test_2_change_common() {
+ common.selectionMode = AbstractGraph3D.SelectionNone
+ common.shadowQuality = AbstractGraph3D.ShadowQualitySoftHigh
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality")
+ common.msaaSamples = 8
+ if (common.shadowsSupported === true)
+ compare(common.msaaSamples, 8, "msaaSamples")
+ else
+ compare(common.msaaSamples, 0, "msaaSamples")
+ common.theme.type = Theme3D.ThemeRetro
+ common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear
+ common.measureFps = true
+ common.orthoProjection = true
+ common.aspectRatio = 1.0
+ common.optimizationHints = AbstractGraph3D.OptimizationStatic
+ common.polar = true
+ common.radialLabelOffset = 2
+ common.horizontalAspectRatio = 1
+ common.reflection = true
+ common.reflectivity = 1.0
+ common.locale = Qt.locale("FI")
+ common.margin = 1.0
+ compare(common.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality") // Ortho disables shadows
+ compare(common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
+ compare(common.theme.type, Theme3D.ThemeRetro, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode")
+ compare(common.measureFps, true, "measureFps")
+ compare(common.orthoProjection, true, "orthoProjection")
+ compare(common.aspectRatio, 1.0, "aspectRatio")
+ compare(common.optimizationHints, AbstractGraph3D.OptimizationStatic, "optimizationHints")
+ compare(common.polar, true, "polar")
+ compare(common.radialLabelOffset, 2, "radialLabelOffset")
+ compare(common.horizontalAspectRatio, 1, "horizontalAspectRatio")
+ compare(common.reflection, true, "reflection")
+ compare(common.reflectivity, 1.0, "reflectivity")
+ compare(common.locale, Qt.locale("FI"), "locale")
+ compare(common.margin, 1.0, "margin")
+ }
+
+ function test_3_change_invalid_common() {
+ common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice
+ common.theme.type = -2
+ common.renderingMode = -1
+ common.measureFps = false
+ common.orthoProjection = false
+ common.aspectRatio = -1.0
+ common.polar = false
+ common.horizontalAspectRatio = -2
+ common.reflection = false
+ common.reflectivity = -1.0
+ compare(common.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
+ compare(common.theme.type, -2/*Theme3D.ThemeRetro*/, "theme") // TODO: Fix once QTRD-3367 is done
+ compare(common.renderingMode, -1/*AbstractGraph3D.RenderDirectToBackground_NoClear*/, "renderingMode") // TODO: Fix once QTRD-3367 is done
+ 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
+ }
+
+ function test_4_common_initialized() {
+ compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
+ if (common_init.shadowsSupported === true) {
+ compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality")
+ compare(common_init.msaaSamples, 2, "msaaSamples")
+ } else {
+ compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality")
+ compare(common_init.msaaSamples, 0, "msaaSamples")
+ }
+ compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
+ compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
+ compare(common_init.measureFps, true, "measureFps")
+ compare(common_init.customItemList.length, 0, "customItemList")
+ compare(common_init.orthoProjection, false, "orthoProjection")
+ compare(common_init.aspectRatio, 3.0, "aspectRatio")
+ compare(common_init.optimizationHints, AbstractGraph3D.OptimizationStatic, "optimizationHints")
+ compare(common_init.polar, false, "polar")
+ compare(common_init.radialLabelOffset, 2, "radialLabelOffset")
+ compare(common_init.horizontalAspectRatio, 0.2, "horizontalAspectRatio")
+ compare(common_init.reflection, true, "reflection")
+ compare(common_init.reflectivity, 0.1, "reflectivity")
+ compare(common_init.locale, Qt.locale("UK"), "locale")
+ compare(common_init.margin, 0.2, "margin")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/scatter3d/tst_proxy.qml b/tests/auto/qmltest/scatter3d/tst_proxy.qml
new file mode 100644
index 00000000..e6478f15
--- /dev/null
+++ b/tests/auto/qmltest/scatter3d/tst_proxy.qml
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ ItemModelScatterDataProxy {
+ id: initial
+ }
+
+ ItemModelScatterDataProxy {
+ id: initialized
+
+ itemModel: ListModel { objectName: "model1" }
+ rotationRole: "rot"
+ rotationRolePattern: /-/
+ rotationRoleReplace: "\\1"
+ xPosRole: "x"
+ xPosRolePattern: /^.*-(\d\d)$/
+ xPosRoleReplace: "\\1"
+ yPosRole: "y"
+ yPosRolePattern: /^(\d\d\d\d).*$/
+ yPosRoleReplace: "\\1"
+ zPosRole: "z"
+ zPosRolePattern: /-/
+ zPosRoleReplace: "\\1"
+ }
+
+ ItemModelScatterDataProxy {
+ id: change
+ }
+
+ TestCase {
+ name: "ItemModelScatterDataProxy Initial"
+
+ function test_initial() {
+ verify(!initial.itemModel)
+ compare(initial.rotationRole, "")
+ verify(initial.rotationRolePattern)
+ compare(initial.rotationRoleReplace, "")
+ compare(initial.xPosRole, "")
+ verify(initial.xPosRolePattern)
+ compare(initial.xPosRoleReplace, "")
+ compare(initial.yPosRole, "")
+ verify(initial.yPosRolePattern)
+ compare(initial.yPosRoleReplace, "")
+ compare(initial.zPosRole, "")
+ verify(initial.zPosRolePattern)
+ compare(initial.zPosRoleReplace, "")
+
+ compare(initial.itemCount, 0)
+ verify(!initial.series)
+
+ compare(initial.type, AbstractDataProxy.DataTypeScatter)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelScatterDataProxy Initialized"
+
+ function test_initialized() {
+ compare(initialized.itemModel.objectName, "model1")
+ compare(initialized.rotationRole, "rot")
+ compare(initialized.rotationRolePattern, /-/)
+ compare(initialized.rotationRoleReplace, "\\1")
+ compare(initialized.xPosRole, "x")
+ compare(initialized.xPosRolePattern, /^.*-(\d\d)$/)
+ compare(initialized.xPosRoleReplace, "\\1")
+ compare(initialized.yPosRole, "y")
+ compare(initialized.yPosRolePattern, /^(\d\d\d\d).*$/)
+ compare(initialized.yPosRoleReplace, "\\1")
+ compare(initialized.zPosRole, "z")
+ compare(initialized.zPosRolePattern, /-/)
+ compare(initialized.zPosRoleReplace, "\\1")
+ }
+ }
+
+ TestCase {
+ name: "ItemModelScatterDataProxy Change"
+
+ ListModel { id: model1; objectName: "model1" }
+
+ function test_change() {
+ change.itemModel = model1
+ change.rotationRole = "rot"
+ change.rotationRolePattern = /-/
+ change.rotationRoleReplace = "\\1"
+ change.xPosRole = "x"
+ change.xPosRolePattern = /^.*-(\d\d)$/
+ change.xPosRoleReplace = "\\1"
+ change.yPosRole = "y"
+ change.yPosRolePattern = /^(\d\d\d\d).*$/
+ change.yPosRoleReplace = "\\1"
+ change.zPosRole = "z"
+ change.zPosRolePattern = /-/
+ change.zPosRoleReplace = "\\1"
+
+ compare(change.itemModel.objectName, "model1")
+ compare(change.rotationRole, "rot")
+ compare(change.rotationRolePattern, /-/)
+ compare(change.rotationRoleReplace, "\\1")
+ compare(change.xPosRole, "x")
+ compare(change.xPosRolePattern, /^.*-(\d\d)$/)
+ compare(change.xPosRoleReplace, "\\1")
+ compare(change.yPosRole, "y")
+ compare(change.yPosRolePattern, /^(\d\d\d\d).*$/)
+ compare(change.yPosRoleReplace, "\\1")
+ compare(change.zPosRole, "z")
+ compare(change.zPosRolePattern, /-/)
+ compare(change.zPosRoleReplace, "\\1")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/scatter3d/tst_scatter.qml b/tests/auto/qmltest/scatter3d/tst_scatter.qml
new file mode 100644
index 00000000..b070b5f0
--- /dev/null
+++ b/tests/auto/qmltest/scatter3d/tst_scatter.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Scatter3D {
+ id: series
+ anchors.fill: parent
+ }
+
+ TestCase {
+ name: "Scatter3D Series"
+
+ Scatter3DSeries { id: series1 }
+ Scatter3DSeries { id: series2 }
+
+ function test_1_add_series() {
+ series.seriesList = [series1, series2]
+ compare(series.seriesList.length, 2)
+ }
+
+ function test_2_remove_series() {
+ series.seriesList = [series1]
+ compare(series.seriesList.length, 1)
+ }
+
+ function test_3_remove_series() {
+ series.seriesList = []
+ compare(series.seriesList.length, 0)
+ }
+
+ function test_4_selected_series() {
+ series.seriesList = [series1, series2]
+ series.seriesList[0].selectedItem = 0
+ compare(series.selectedSeries, series1)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/scatter3d/tst_scatterseries.qml b/tests/auto/qmltest/scatter3d/tst_scatterseries.qml
new file mode 100644
index 00000000..4df58303
--- /dev/null
+++ b/tests/auto/qmltest/scatter3d/tst_scatterseries.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Scatter3DSeries {
+ id: initial
+ }
+
+ ColorGradient {
+ id: gradient1;
+ stops: [
+ ColorGradientStop { color: "red"; position: 0 },
+ ColorGradientStop { color: "blue"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient2;
+ stops: [
+ ColorGradientStop { color: "green"; position: 0 },
+ ColorGradientStop { color: "red"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient3;
+ stops: [
+ ColorGradientStop { color: "gray"; position: 0 },
+ ColorGradientStop { color: "darkgray"; position: 1 }
+ ]
+ }
+
+ Scatter3DSeries {
+ id: initialized
+ dataProxy: ItemModelScatterDataProxy {
+ itemModel: ListModel {
+ ListElement{ xPos: "2.754"; yPos: "1.455"; zPos: "3.362"; }
+ ListElement{ xPos: "3.164"; yPos: "2.022"; zPos: "4.348"; }
+ }
+ xPosRole: "xPos"
+ yPosRole: "yPos"
+ zPosRole: "zPos"
+ }
+ itemSize: 0.5
+ selectedItem: 0
+
+ baseColor: "blue"
+ baseGradient: gradient1
+ colorStyle: Theme3D.ColorStyleObjectGradient
+ itemLabelFormat: "%f"
+ itemLabelVisible: false
+ mesh: Abstract3DSeries.MeshMinimal
+ meshRotation: Qt.quaternion(1, 1, 1, 1)
+ meshSmooth: true
+ multiHighlightColor: "green"
+ multiHighlightGradient: gradient2
+ name: "series1"
+ singleHighlightColor: "red"
+ singleHighlightGradient: gradient3
+ userDefinedMesh: ":/customitem.obj"
+ visible: false
+ }
+
+ ItemModelScatterDataProxy {
+ id: proxy1
+ itemModel: ListModel {
+ ListElement{ xPos: "2.754"; yPos: "1.455"; zPos: "3.362"; }
+ ListElement{ xPos: "3.164"; yPos: "2.022"; zPos: "4.348"; }
+ ListElement{ xPos: "4.564"; yPos: "1.865"; zPos: "1.346"; }
+ }
+ xPosRole: "xPos"
+ yPosRole: "yPos"
+ zPosRole: "zPos"
+ }
+
+ Scatter3DSeries {
+ id: change
+ }
+
+ Scatter3DSeries {
+ id: invalid
+ }
+
+ TestCase {
+ name: "Scatter3DSeries Initial"
+
+ function test_1_initial() {
+ compare(initial.dataProxy.itemCount, 0)
+ compare(initial.invalidSelectionIndex, -1)
+ compare(initial.itemSize, 0.0)
+ compare(initial.selectedItem, -1)
+ }
+
+ function test_2_initial_common() {
+ // Common properties
+ compare(initial.baseColor, "#000000")
+ compare(initial.baseGradient, null)
+ compare(initial.colorStyle, Theme3D.ColorStyleUniform)
+ compare(initial.itemLabel, "")
+ compare(initial.itemLabelFormat, "@xLabel, @yLabel, @zLabel")
+ compare(initial.itemLabelVisible, true)
+ compare(initial.mesh, Abstract3DSeries.MeshSphere)
+ compare(initial.meshRotation, Qt.quaternion(1, 0, 0, 0))
+ compare(initial.meshSmooth, false)
+ compare(initial.multiHighlightColor, "#000000")
+ compare(initial.multiHighlightGradient, null)
+ compare(initial.name, "")
+ compare(initial.singleHighlightColor, "#000000")
+ compare(initial.singleHighlightGradient, null)
+ compare(initial.type, Abstract3DSeries.SeriesTypeScatter)
+ compare(initial.userDefinedMesh, "")
+ compare(initial.visible, true)
+ }
+ }
+
+ TestCase {
+ name: "Scatter3DSeries Initialized"
+
+ function test_1_initialized() {
+ compare(initialized.dataProxy.itemCount, 2)
+ compare(initialized.itemSize, 0.5)
+ compare(initialized.selectedItem, 0)
+ }
+
+ function test_2_initialized_common() {
+ // Common properties
+ compare(initialized.baseColor, "#0000ff")
+ compare(initialized.baseGradient, gradient1)
+ compare(initialized.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(initialized.itemLabelFormat, "%f")
+ compare(initialized.itemLabelVisible, false)
+ compare(initialized.mesh, Abstract3DSeries.MeshMinimal)
+ compare(initialized.meshRotation, Qt.quaternion(1, 1, 1, 1))
+ compare(initialized.meshSmooth, true)
+ compare(initialized.multiHighlightColor, "#008000")
+ compare(initialized.multiHighlightGradient, gradient2)
+ compare(initialized.name, "series1")
+ compare(initialized.singleHighlightColor, "#ff0000")
+ compare(initialized.singleHighlightGradient, gradient3)
+ compare(initialized.userDefinedMesh, ":/customitem.obj")
+ compare(initialized.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Scatter3DSeries Change"
+
+ function test_1_change() {
+ change.dataProxy = proxy1
+ change.itemSize = 0.5
+ change.selectedItem = 0
+ }
+
+ function test_2_test_change() {
+ // This test has a dependency to the previous one due to asynchronous item model resolving
+ compare(change.dataProxy.itemCount, 3)
+ compare(change.itemSize, 0.5)
+ compare(change.selectedItem, 0)
+ }
+
+ function test_3_change_common() {
+ change.baseColor = "blue"
+ change.baseGradient = gradient1
+ change.colorStyle = Theme3D.ColorStyleObjectGradient
+ change.itemLabelFormat = "%f"
+ change.itemLabelVisible = false
+ change.mesh = Abstract3DSeries.MeshMinimal
+ change.meshRotation = Qt.quaternion(1, 1, 1, 1)
+ change.meshSmooth = true
+ change.multiHighlightColor = "green"
+ change.multiHighlightGradient = gradient2
+ change.name = "series1"
+ change.singleHighlightColor = "red"
+ change.singleHighlightGradient = gradient3
+ change.userDefinedMesh = ":/customitem.obj"
+ change.visible = false
+
+ compare(change.baseColor, "#0000ff")
+ compare(change.baseGradient, gradient1)
+ compare(change.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(change.itemLabelFormat, "%f")
+ compare(change.itemLabelVisible, false)
+ compare(change.mesh, Abstract3DSeries.MeshMinimal)
+ compare(change.meshRotation, Qt.quaternion(1, 1, 1, 1))
+ compare(change.meshSmooth, true)
+ compare(change.multiHighlightColor, "#008000")
+ compare(change.multiHighlightGradient, gradient2)
+ compare(change.name, "series1")
+ compare(change.singleHighlightColor, "#ff0000")
+ compare(change.singleHighlightGradient, gradient3)
+ compare(change.userDefinedMesh, ":/customitem.obj")
+ compare(change.visible, false)
+ }
+
+ function test_4_change_gradient_stop() {
+ gradient1.stops[0].color = "yellow"
+ compare(change.baseGradient.stops[0].color, "#ffff00")
+ }
+ }
+ TestCase {
+ name: "Scatter3DSeries Invalid"
+
+ function test_invalid() {
+ invalid.itemSize = -1.0
+ compare(invalid.itemSize, 0.0)
+ invalid.itemSize = 1.1
+ compare(invalid.itemSize, 0.0)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/scene3d/tst_camera.qml b/tests/auto/qmltest/scene3d/tst_camera.qml
new file mode 100644
index 00000000..07adf633
--- /dev/null
+++ b/tests/auto/qmltest/scene3d/tst_camera.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ Camera3D {
+ id: initial
+ }
+
+ Camera3D {
+ id: initialized
+ maxZoomLevel: 1000.0
+ minZoomLevel: 100.0
+ target: Qt.vector3d(1.0, -1.0, 1.0)
+ wrapXRotation: false
+ wrapYRotation: true
+ xRotation: 30.0
+ yRotation: 30.0
+ zoomLevel: 500.0
+ }
+
+ Camera3D {
+ id: change
+ }
+
+ Camera3D {
+ id: invalid
+ }
+
+ TestCase {
+ name: "Camera3D Initial"
+
+ function test_initial() {
+ compare(initial.cameraPreset, Camera3D.CameraPresetNone)
+ compare(initial.maxZoomLevel, 500.0)
+ compare(initial.minZoomLevel, 10.0)
+ compare(initial.target, Qt.vector3d(0.0, 0.0, 0.0))
+ compare(initial.wrapXRotation, true)
+ compare(initial.wrapYRotation, false)
+ compare(initial.xRotation, 0.0)
+ compare(initial.yRotation, 0.0)
+ compare(initial.zoomLevel, 100.0)
+ }
+ }
+
+ TestCase {
+ name: "Camera3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.maxZoomLevel, 1000.0)
+ compare(initialized.minZoomLevel, 100.0)
+ compare(initialized.target, Qt.vector3d(1.0, -1.0, 1.0))
+ compare(initialized.wrapXRotation, false)
+ compare(initialized.wrapYRotation, true)
+ compare(initialized.xRotation, 30.0)
+ compare(initialized.yRotation, 30.0)
+ compare(initialized.zoomLevel, 500.0)
+ }
+ }
+
+ TestCase {
+ name: "Camera3D Change"
+
+ function test_1_change() {
+ change.cameraPreset = Camera3D.CameraPresetBehind // Will be overridden by the the following sets
+ change.maxZoomLevel = 1000.0
+ change.minZoomLevel = 100.0
+ change.target = Qt.vector3d(1.0, -1.0, 1.0)
+ change.wrapXRotation = false
+ change.wrapYRotation = true
+ change.xRotation = 30.0
+ change.yRotation = 30.0
+ change.zoomLevel = 500.0
+
+ compare(change.cameraPreset, Camera3D.CameraPresetNone)
+ compare(change.maxZoomLevel, 1000.0)
+ compare(change.minZoomLevel, 100.0)
+ compare(change.target, Qt.vector3d(1.0, -1.0, 1.0))
+ compare(change.wrapXRotation, false)
+ compare(change.wrapYRotation, true)
+ compare(change.xRotation, 30.0)
+ compare(change.yRotation, 30.0)
+ compare(change.zoomLevel, 500.0)
+ }
+
+ function test_2_change_preset() {
+ change.cameraPreset = Camera3D.CameraPresetBehind // Sets target and rotations
+
+ compare(change.cameraPreset, Camera3D.CameraPresetBehind)
+ compare(change.maxZoomLevel, 1000.0)
+ compare(change.minZoomLevel, 100.0)
+ compare(change.target, Qt.vector3d(0.0, 0.0, 0.0))
+ compare(change.wrapXRotation, false)
+ compare(change.wrapYRotation, true)
+ compare(change.xRotation, 180.0)
+ compare(change.yRotation, 22.5)
+ compare(change.zoomLevel, 500.0)
+ }
+ }
+
+ TestCase {
+ name: "Camera3D Invalid"
+
+ function test_invalid() {
+ invalid.target = Qt.vector3d(-1.5, -1.5, -1.5)
+ compare(invalid.target, Qt.vector3d(-1.0, -1.0, -1.0))
+ invalid.target = Qt.vector3d(1.5, 1.5, 1.5)
+ compare(invalid.target, Qt.vector3d(1.0, 1.0, 1.0))
+ invalid.minZoomLevel = 0.1
+ compare(invalid.minZoomLevel, 1.0)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/scene3d/tst_light.qml b/tests/auto/qmltest/scene3d/tst_light.qml
new file mode 100644
index 00000000..d9fa282b
--- /dev/null
+++ b/tests/auto/qmltest/scene3d/tst_light.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ // TODO: Has no adjustable properties yet.
+ // Keeping this as a placeholder for future implementations (QTRD-2406)
+ /*
+ Light3D {
+ id: initial
+ }
+
+ Light3D {
+ id: initialized
+ }
+
+
+ Light3D {
+ id: change
+ }
+
+ TestCase {
+ name: "Light3D Initial"
+
+ function test_initial() {
+ }
+ }
+
+ TestCase {
+ name: "Light3D Initialized"
+
+ function test_initialized() {
+ }
+ }
+
+ TestCase {
+ name: "Light3D Change"
+
+ function test_change() {
+ }
+ }
+ */
+}
diff --git a/tests/auto/qmltest/scene3d/tst_scene.qml b/tests/auto/qmltest/scene3d/tst_scene.qml
new file mode 100644
index 00000000..d53042ca
--- /dev/null
+++ b/tests/auto/qmltest/scene3d/tst_scene.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ // Scene3D is uncreatable, so it needs to be accessed via a graph
+ Bars3D {
+ id: initial
+ }
+
+ Bars3D {
+ id: initialized
+ scene.activeCamera: Camera3D { zoomLevel: 200 }
+ scene.devicePixelRatio: 2.0
+ //scene.graphPositionQuery: Qt.point(0, 0) // TODO: Unusable until QTBUG-40043 is fixed
+ scene.primarySubViewport: Qt.rect(0, 0, 50, 50)
+ scene.secondarySubViewport: Qt.rect(50, 50, 100, 100)
+ scene.secondarySubviewOnTop: false
+ scene.selectionQueryPosition: Qt.point(0, 0)
+ scene.slicingActive: true
+ }
+
+ Bars3D {
+ id: change
+ }
+
+ Bars3D {
+ id: invalid
+ }
+
+ TestCase {
+ name: "Scene3D Initial"
+
+ function test_initial() {
+ verify(initial.scene.activeCamera)
+ verify(initial.scene.activeLight)
+ compare(initial.scene.devicePixelRatio, 1.0)
+ compare(initial.scene.graphPositionQuery, Qt.point(-1, -1))
+ compare(initial.scene.invalidSelectionPoint, Qt.point(-1, -1))
+ compare(initial.scene.primarySubViewport, Qt.rect(0, 0, 0, 0))
+ compare(initial.scene.secondarySubViewport, Qt.rect(0, 0, 0, 0))
+ compare(initial.scene.secondarySubviewOnTop, true)
+ compare(initial.scene.selectionQueryPosition, Qt.point(-1, -1))
+ compare(initial.scene.slicingActive, false)
+ compare(initial.scene.viewport, Qt.rect(0, 0, 0, 0))
+ }
+ }
+
+ TestCase {
+ name: "Scene3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.scene.activeCamera.zoomLevel, 200)
+ compare(initialized.scene.devicePixelRatio, 2.0)
+ //compare(initialized.scene.graphPositionQuery, Qt.point(0, 0)) // TODO: Unusable until QTBUG-40043 is fixed
+ compare(initialized.scene.primarySubViewport, Qt.rect(0, 0, 50, 50))
+ compare(initialized.scene.secondarySubViewport, Qt.rect(50, 50, 100, 100))
+ compare(initialized.scene.secondarySubviewOnTop, false)
+ compare(initialized.scene.selectionQueryPosition, Qt.point(0, 0))
+ compare(initialized.scene.slicingActive, true)
+ compare(initialized.scene.viewport, Qt.rect(0, 0, 100, 100))
+ }
+ }
+
+ TestCase {
+ name: "Scene3D Change"
+
+ Camera3D {
+ id: camera1
+ zoomLevel: 200
+ }
+
+ function test_change() {
+ change.scene.activeCamera = camera1
+ change.scene.devicePixelRatio = 2.0
+ change.scene.graphPositionQuery = Qt.point(0, 0)
+ change.scene.primarySubViewport = Qt.rect(0, 0, 50, 50)
+ change.scene.secondarySubViewport = Qt.rect(50, 50, 100, 100)
+ change.scene.secondarySubviewOnTop = false
+ change.scene.selectionQueryPosition = Qt.point(0, 0) // TODO: When doing signal checks, add tests to check that queries return something (asynchronously)
+ change.scene.slicingActive = true
+
+ compare(change.scene.activeCamera.zoomLevel, 200)
+ compare(change.scene.devicePixelRatio, 2.0)
+ compare(change.scene.graphPositionQuery, Qt.point(0, 0))
+ compare(change.scene.primarySubViewport, Qt.rect(0, 0, 50, 50))
+ compare(change.scene.secondarySubViewport, Qt.rect(50, 50, 100, 100))
+ compare(change.scene.secondarySubviewOnTop, false)
+ compare(change.scene.selectionQueryPosition, Qt.point(0, 0))
+ compare(change.scene.slicingActive, true)
+ compare(change.scene.viewport, Qt.rect(0, 0, 100, 100))
+ }
+ }
+
+ TestCase {
+ name: "Scene3D Invalid"
+
+ function test_invalid() {
+ invalid.scene.primarySubViewport = Qt.rect(0, 0, -50, -50)
+ compare(invalid.scene.primarySubViewport, Qt.rect(0, 0, 0, 0))
+ }
+ }
+}
diff --git a/tests/auto/qmltest/surface3d/tst_basic.qml b/tests/auto/qmltest/surface3d/tst_basic.qml
new file mode 100644
index 00000000..dfcc4542
--- /dev/null
+++ b/tests/auto/qmltest/surface3d/tst_basic.qml
@@ -0,0 +1,211 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Surface3D {
+ id: empty
+ }
+
+ Surface3D {
+ id: basic
+ anchors.fill: parent
+ flipHorizontalGrid: true
+ }
+
+ Surface3D {
+ id: common
+ anchors.fill: parent
+ }
+
+ Surface3D {
+ 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
+ }
+
+ TestCase {
+ name: "Surface3D Empty"
+
+ function test_empty() {
+ compare(empty.width, 0, "width")
+ compare(empty.height, 0, "height")
+ compare(empty.seriesList.length, 0, "seriesList")
+ compare(empty.selectedSeries, null, "selectedSeries")
+ compare(empty.flipHorizontalGrid, false, "flipHorizontalGrid")
+ compare(empty.axisX.orientation, AbstractAxis3D.AxisOrientationX)
+ compare(empty.axisZ.orientation, AbstractAxis3D.AxisOrientationZ)
+ compare(empty.axisY.orientation, AbstractAxis3D.AxisOrientationY)
+ compare(empty.axisX.type, AbstractAxis3D.AxisTypeValue)
+ compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue)
+ compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue)
+ }
+ }
+
+ TestCase {
+ name: "Surface3D Basic"
+ when: windowShown
+
+ function test_basic() {
+ compare(basic.width, 150, "width")
+ compare(basic.height, 150, "height")
+ compare(basic.flipHorizontalGrid, true, "flipHorizontalGrid")
+ }
+
+ function test_change_basic() {
+ basic.flipHorizontalGrid = false
+ compare(basic.flipHorizontalGrid, false, "flipHorizontalGrid")
+ }
+ }
+
+ TestCase {
+ name: "Surface3D Common"
+ when: windowShown
+
+ function test_1_common() {
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality")
+ if (common.shadowsSupported === true)
+ compare(common.msaaSamples, 4, "msaaSamples")
+ else
+ compare(common.msaaSamples, 0, "msaaSamples")
+ compare(common.theme.type, Theme3D.ThemeQt, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
+ compare(common.measureFps, false, "measureFps")
+ compare(common.customItemList.length, 0, "customItemList")
+ compare(common.orthoProjection, false, "orthoProjection")
+ compare(common.selectedElement, AbstractGraph3D.ElementNone, "selectedElement")
+ compare(common.aspectRatio, 2.0, "aspectRatio")
+ compare(common.optimizationHints, AbstractGraph3D.OptimizationDefault, "optimizationHints")
+ compare(common.polar, false, "polar")
+ compare(common.radialLabelOffset, 1, "radialLabelOffset")
+ compare(common.horizontalAspectRatio, 0, "horizontalAspectRatio")
+ compare(common.reflection, false, "reflection")
+ compare(common.reflectivity, 0.5, "reflectivity")
+ compare(common.locale, Qt.locale("C"), "locale")
+ compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition")
+ compare(common.margin, -1, "margin")
+ }
+
+ function test_2_change_common() {
+ common.selectionMode = AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice
+ common.shadowQuality = AbstractGraph3D.ShadowQualitySoftHigh
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality")
+ common.msaaSamples = 8
+ if (common.shadowsSupported === true)
+ compare(common.msaaSamples, 8, "msaaSamples")
+ else
+ compare(common.msaaSamples, 0, "msaaSamples")
+ common.theme.type = Theme3D.ThemeRetro
+ common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear
+ common.measureFps = true
+ common.orthoProjection = true
+ common.aspectRatio = 1.0
+ common.optimizationHints = AbstractGraph3D.OptimizationStatic
+ common.polar = true
+ common.radialLabelOffset = 2
+ common.horizontalAspectRatio = 1
+ common.reflection = true
+ common.reflectivity = 1.0
+ common.locale = Qt.locale("FI")
+ common.margin = 1.0
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice, "selectionMode")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality") // Ortho disables shadows
+ compare(common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
+ compare(common.theme.type, Theme3D.ThemeRetro, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode")
+ compare(common.measureFps, true, "measureFps")
+ compare(common.orthoProjection, true, "orthoProjection")
+ compare(common.aspectRatio, 1.0, "aspectRatio")
+ compare(common.optimizationHints, AbstractGraph3D.OptimizationStatic, "optimizationHints")
+ compare(common.polar, true, "polar")
+ compare(common.radialLabelOffset, 2, "radialLabelOffset")
+ compare(common.horizontalAspectRatio, 1, "horizontalAspectRatio")
+ compare(common.reflection, true, "reflection")
+ compare(common.reflectivity, 1.0, "reflectivity")
+ compare(common.locale, Qt.locale("FI"), "locale")
+ compare(common.margin, 1.0, "margin")
+ }
+
+ function test_3_change_invalid_common() {
+ common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice
+ common.theme.type = -2
+ common.renderingMode = -1
+ common.measureFps = false
+ common.orthoProjection = false
+ common.aspectRatio = -1.0
+ common.polar = false
+ common.horizontalAspectRatio = -2
+ common.reflection = false
+ common.reflectivity = -1.0
+ compare(common.selectionMode, AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice, "selectionMode")
+ compare(common.theme.type, -2/*Theme3D.ThemeRetro*/, "theme") // TODO: Fix once QTRD-3367 is done
+ compare(common.renderingMode, -1/*AbstractGraph3D.RenderDirectToBackground_NoClear*/, "renderingMode") // TODO: Fix once QTRD-3367 is done
+ 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
+ }
+
+ function test_4_common_initialized() {
+ compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
+ if (common_init.shadowsSupported === true) {
+ compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality")
+ compare(common_init.msaaSamples, 2, "msaaSamples")
+ } else {
+ compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality")
+ compare(common_init.msaaSamples, 0, "msaaSamples")
+ }
+ compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
+ compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
+ compare(common_init.measureFps, true, "measureFps")
+ compare(common_init.customItemList.length, 0, "customItemList")
+ compare(common_init.orthoProjection, false, "orthoProjection")
+ compare(common_init.aspectRatio, 3.0, "aspectRatio")
+ compare(common_init.optimizationHints, AbstractGraph3D.OptimizationStatic, "optimizationHints")
+ compare(common_init.polar, false, "polar")
+ compare(common_init.radialLabelOffset, 2, "radialLabelOffset")
+ compare(common_init.horizontalAspectRatio, 0.2, "horizontalAspectRatio")
+ compare(common_init.reflection, true, "reflection")
+ compare(common_init.reflectivity, 0.1, "reflectivity")
+ compare(common_init.locale, Qt.locale("UK"), "locale")
+ compare(common_init.margin, 0.2, "margin")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/surface3d/tst_heightproxy.qml b/tests/auto/qmltest/surface3d/tst_heightproxy.qml
new file mode 100644
index 00000000..29772451
--- /dev/null
+++ b/tests/auto/qmltest/surface3d/tst_heightproxy.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ HeightMapSurfaceDataProxy {
+ id: initial
+ }
+
+ HeightMapSurfaceDataProxy {
+ id: initialized
+ heightMapFile: ":/customtexture.jpg"
+ maxXValue: 10.0
+ maxZValue: 10.0
+ minXValue: -10.0
+ minZValue: -10.0
+ }
+
+ HeightMapSurfaceDataProxy {
+ id: change
+ }
+
+ HeightMapSurfaceDataProxy {
+ id: invalid
+ }
+
+ TestCase {
+ name: "HeightMapSurfaceDataProxy Initial"
+
+ function test_initial() {
+ compare(initial.heightMapFile, "")
+ compare(initial.maxXValue, 10.0)
+ compare(initial.maxZValue, 10.0)
+ compare(initial.minXValue, 0)
+ compare(initial.minZValue, 0)
+
+ compare(initial.columnCount, 0)
+ compare(initial.rowCount, 0)
+ verify(!initial.series)
+
+ compare(initial.type, AbstractDataProxy.DataTypeSurface)
+ }
+ }
+
+ TestCase {
+ name: "HeightMapSurfaceDataProxy Initialized"
+
+ function test_initialized() {
+ compare(initialized.heightMapFile, ":/customtexture.jpg")
+ compare(initialized.maxXValue, 10.0)
+ compare(initialized.maxZValue, 10.0)
+ compare(initialized.minXValue, -10.0)
+ compare(initialized.minZValue, -10.0)
+
+ compare(initialized.columnCount, 24)
+ compare(initialized.rowCount, 24)
+ }
+ }
+
+ TestCase {
+ name: "HeightMapSurfaceDataProxy Change"
+
+ function test_1_change() {
+ change.heightMapFile = ":/customtexture.jpg"
+ change.maxXValue = 10.0
+ change.maxZValue = 10.0
+ change.minXValue = -10.0
+ change.minZValue = -10.0
+ }
+
+ function test_2_test_change() {
+ // This test has a dependency to the previous one due to asynchronous item model resolving
+ compare(change.heightMapFile, ":/customtexture.jpg")
+ compare(change.maxXValue, 10.0)
+ compare(change.maxZValue, 10.0)
+ compare(change.minXValue, -10.0)
+ compare(change.minZValue, -10.0)
+
+ compare(change.columnCount, 24)
+ compare(change.rowCount, 24)
+ }
+ }
+
+ TestCase {
+ name: "HeightMapSurfaceDataProxy Invalid"
+
+ function test_invalid() {
+ invalid.maxXValue = -10
+ compare(invalid.minXValue, -11)
+ invalid.minZValue = 20
+ compare(invalid.maxZValue, 21)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/surface3d/tst_proxy.qml b/tests/auto/qmltest/surface3d/tst_proxy.qml
new file mode 100644
index 00000000..8f353153
--- /dev/null
+++ b/tests/auto/qmltest/surface3d/tst_proxy.qml
@@ -0,0 +1,263 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ ItemModelSurfaceDataProxy {
+ id: initial
+ }
+
+ ItemModelSurfaceDataProxy {
+ id: initialized
+
+ autoColumnCategories: false
+ autoRowCategories: false
+ columnCategories: ["colcat1", "colcat2"]
+ columnRole: "col"
+ columnRolePattern: /^.*-(\d\d)$/
+ columnRoleReplace: "\\1"
+ itemModel: ListModel { objectName: "model1" }
+ multiMatchBehavior: ItemModelSurfaceDataProxy.MMBAverage
+ rowCategories: ["rowcat1", "rowcat2"]
+ rowRole: "row"
+ rowRolePattern: /^(\d\d\d\d).*$/
+ rowRoleReplace: "\\1"
+ xPosRole: "x"
+ xPosRolePattern: /^.*-(\d\d)$/
+ xPosRoleReplace: "\\1"
+ yPosRole: "y"
+ yPosRolePattern: /^(\d\d\d\d).*$/
+ yPosRoleReplace: "\\1"
+ zPosRole: "z"
+ zPosRolePattern: /-/
+ zPosRoleReplace: "\\1"
+ }
+
+ ItemModelSurfaceDataProxy {
+ id: change
+ }
+
+ TestCase {
+ name: "ItemModelSurfaceDataProxy Initial"
+
+ function test_initial() {
+ compare(initial.autoColumnCategories, true)
+ compare(initial.autoRowCategories, true)
+ compare(initial.columnCategories, [])
+ compare(initial.columnRole, "")
+ verify(initial.columnRolePattern)
+ compare(initial.columnRoleReplace, "")
+ verify(!initial.itemModel)
+ compare(initial.multiMatchBehavior, ItemModelSurfaceDataProxy.MMBLast)
+ compare(initial.rowCategories, [])
+ compare(initial.rowRole, "")
+ verify(initial.rowRolePattern)
+ compare(initial.rowRoleReplace, "")
+ compare(initial.useModelCategories, false)
+ compare(initial.xPosRole, "")
+ verify(initial.xPosRolePattern)
+ compare(initial.xPosRoleReplace, "")
+ compare(initial.yPosRole, "")
+ verify(initial.yPosRolePattern)
+ compare(initial.yPosRoleReplace, "")
+ compare(initial.zPosRole, "")
+ verify(initial.zPosRolePattern)
+ compare(initial.zPosRoleReplace, "")
+
+ compare(initial.columnCount, 0)
+ compare(initial.rowCount, 0)
+ verify(!initial.series)
+
+ compare(initial.type, AbstractDataProxy.DataTypeSurface)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelSurfaceDataProxy Initialized"
+
+ function test_initialized() {
+ compare(initialized.autoColumnCategories, false)
+ compare(initialized.autoRowCategories, false)
+ compare(initialized.columnCategories.length, 2)
+ compare(initialized.columnCategories[0], "colcat1")
+ compare(initialized.columnCategories[1], "colcat2")
+ compare(initialized.columnRole, "col")
+ compare(initialized.columnRolePattern, /^.*-(\d\d)$/)
+ compare(initialized.columnRoleReplace, "\\1")
+ compare(initialized.itemModel.objectName, "model1")
+ compare(initialized.multiMatchBehavior, ItemModelSurfaceDataProxy.MMBAverage)
+ compare(initialized.rowCategories.length, 2)
+ compare(initialized.rowCategories[0], "rowcat1")
+ compare(initialized.rowCategories[1], "rowcat2")
+ compare(initialized.rowRole, "row")
+ compare(initialized.rowRolePattern, /^(\d\d\d\d).*$/)
+ compare(initialized.rowRoleReplace, "\\1")
+ compare(initialized.xPosRole, "x")
+ compare(initialized.xPosRolePattern, /^.*-(\d\d)$/)
+ compare(initialized.xPosRoleReplace, "\\1")
+ compare(initialized.yPosRole, "y")
+ compare(initialized.yPosRolePattern, /^(\d\d\d\d).*$/)
+ compare(initialized.yPosRoleReplace, "\\1")
+ compare(initialized.zPosRole, "z")
+ compare(initialized.zPosRolePattern, /-/)
+ compare(initialized.zPosRoleReplace, "\\1")
+
+ compare(initialized.columnCount, 2)
+ compare(initialized.rowCount, 2)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelSurfaceDataProxy Change"
+
+ ListModel { id: model1; objectName: "model1" }
+
+ function test_1_change() {
+ change.autoColumnCategories = false
+ change.autoRowCategories = false
+ change.columnCategories = ["colcat1", "colcat2"]
+ change.columnRole = "col"
+ change.columnRolePattern = /^.*-(\d\d)$/
+ change.columnRoleReplace = "\\1"
+ change.itemModel = model1
+ change.multiMatchBehavior = ItemModelSurfaceDataProxy.MMBAverage
+ change.rowCategories = ["rowcat1", "rowcat2"]
+ change.rowRole = "row"
+ change.rowRolePattern = /^(\d\d\d\d).*$/
+ change.rowRoleReplace = "\\1"
+ change.useModelCategories = true // Overwrites columnLabels and rowLabels
+ change.xPosRole = "x"
+ change.xPosRolePattern = /^.*-(\d\d)$/
+ change.xPosRoleReplace = "\\1"
+ change.yPosRole = "y"
+ change.yPosRolePattern = /^(\d\d\d\d).*$/
+ change.yPosRoleReplace = "\\1"
+ change.zPosRole = "z"
+ change.zPosRolePattern = /-/
+ change.zPosRoleReplace = "\\1"
+ }
+
+ function test_2_test_change() {
+ // This test has a dependency to the previous one due to asynchronous item model resolving
+ compare(change.autoColumnCategories, false)
+ compare(change.autoRowCategories, false)
+ compare(change.columnCategories.length, 2)
+ compare(change.columnCategories[0], "colcat1")
+ compare(change.columnCategories[1], "colcat2")
+ compare(change.columnRole, "col")
+ compare(change.columnRolePattern, /^.*-(\d\d)$/)
+ compare(change.columnRoleReplace, "\\1")
+ compare(change.itemModel.objectName, "model1")
+ compare(change.multiMatchBehavior, ItemModelSurfaceDataProxy.MMBAverage)
+ compare(change.rowCategories.length, 2)
+ compare(change.rowCategories[0], "rowcat1")
+ compare(change.rowCategories[1], "rowcat2")
+ compare(change.rowRole, "row")
+ compare(change.rowRolePattern, /^(\d\d\d\d).*$/)
+ compare(change.rowRoleReplace, "\\1")
+ compare(change.useModelCategories, true)
+ compare(change.xPosRole, "x")
+ compare(change.xPosRolePattern, /^.*-(\d\d)$/)
+ compare(change.xPosRoleReplace, "\\1")
+ compare(change.yPosRole, "y")
+ compare(change.yPosRolePattern, /^(\d\d\d\d).*$/)
+ compare(change.yPosRoleReplace, "\\1")
+ compare(change.zPosRole, "z")
+ compare(change.zPosRolePattern, /-/)
+ compare(change.zPosRoleReplace, "\\1")
+
+ compare(change.columnCount, 0)
+ compare(change.rowCount, 0)
+ }
+ }
+
+ TestCase {
+ name: "ItemModelSurfaceDataProxy MultiMatchBehaviour"
+
+ Surface3D {
+ id: surface1
+ Surface3DSeries {
+ ItemModelSurfaceDataProxy {
+ id: surfaceProxy
+ itemModel: ListModel {
+ ListElement{ coords: "0,0"; data: "5"; }
+ ListElement{ coords: "0,0"; data: "15"; }
+ ListElement{ coords: "0,1"; data: "5"; }
+ ListElement{ coords: "0,1"; data: "15"; }
+ ListElement{ coords: "1,0"; data: "5"; }
+ ListElement{ coords: "1,0"; data: "15"; }
+ ListElement{ coords: "1,1"; data: "0"; }
+ }
+ rowRole: "coords"
+ columnRole: "coords"
+ yPosRole: "data"
+ rowRolePattern: /(\d),\d/
+ columnRolePattern: /(\d),(\d)/
+ rowRoleReplace: "\\1"
+ columnRoleReplace: "\\2"
+ }
+ }
+ }
+
+ function test_0_async_dummy() {
+ }
+
+ function test_1_test_multimatch() {
+ compare(surface1.axisY.max, 15)
+ }
+
+ function test_2_multimatch() {
+ surfaceProxy.multiMatchBehavior = ItemModelSurfaceDataProxy.MMBFirst
+ }
+
+ function test_3_test_multimatch() {
+ compare(surface1.axisY.max, 5)
+ }
+
+ function test_4_multimatch() {
+ surfaceProxy.multiMatchBehavior = ItemModelSurfaceDataProxy.MMBLast
+ }
+
+ function test_5_test_multimatch() {
+ compare(surface1.axisY.max, 15)
+ }
+
+ function test_6_multimatch() {
+ surfaceProxy.multiMatchBehavior = ItemModelSurfaceDataProxy.MMBAverage
+ }
+
+ function test_7_test_multimatch() {
+ compare(surface1.axisY.max, 10)
+ }
+
+ function test_8_multimatch() {
+ surfaceProxy.multiMatchBehavior = ItemModelSurfaceDataProxy.MMBCumulativeY
+ }
+
+ function test_9_test_multimatch() {
+ compare(surface1.axisY.max, 20)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/surface3d/tst_surface.qml b/tests/auto/qmltest/surface3d/tst_surface.qml
new file mode 100644
index 00000000..31c86da2
--- /dev/null
+++ b/tests/auto/qmltest/surface3d/tst_surface.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Surface3D {
+ id: series
+ anchors.fill: parent
+ }
+
+ TestCase {
+ name: "Surface3D Series"
+
+ Surface3DSeries { id: series1 }
+ Surface3DSeries { id: series2 }
+
+ function test_1_add_series() {
+ series.seriesList = [series1, series2]
+ compare(series.seriesList.length, 2)
+ }
+
+ function test_2_remove_series() {
+ series.seriesList = [series1]
+ compare(series.seriesList.length, 1)
+ }
+
+ function test_3_remove_series() {
+ series.seriesList = []
+ compare(series.seriesList.length, 0)
+ }
+
+ function test_4_selected_series() {
+ series.seriesList = [series1, series2]
+ series.seriesList[0].selectedPoint = Qt.point(0, 0)
+ compare(series.selectedSeries, series1)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/surface3d/tst_surfaceseries.qml b/tests/auto/qmltest/surface3d/tst_surfaceseries.qml
new file mode 100644
index 00000000..dff2e4a8
--- /dev/null
+++ b/tests/auto/qmltest/surface3d/tst_surfaceseries.qml
@@ -0,0 +1,229 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ height: 150
+ width: 150
+
+ Surface3DSeries {
+ id: initial
+ }
+
+ ColorGradient {
+ id: gradient1;
+ stops: [
+ ColorGradientStop { color: "red"; position: 0 },
+ ColorGradientStop { color: "blue"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient2;
+ stops: [
+ ColorGradientStop { color: "green"; position: 0 },
+ ColorGradientStop { color: "red"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient3;
+ stops: [
+ ColorGradientStop { color: "gray"; position: 0 },
+ ColorGradientStop { color: "darkgray"; position: 1 }
+ ]
+ }
+
+ Surface3DSeries {
+ id: initialized
+ dataProxy: ItemModelSurfaceDataProxy {
+ itemModel: ListModel {
+ ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; }
+ ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; }
+ }
+ rowRole: "longitude"
+ columnRole: "latitude"
+ yPosRole: "pop_density"
+ }
+ drawMode: Surface3DSeries.DrawSurface
+ flatShadingEnabled: false
+ selectedPoint: Qt.point(0, 0)
+ textureFile: ":\customtexture.jpg"
+
+ baseColor: "blue"
+ baseGradient: gradient1
+ colorStyle: Theme3D.ColorStyleObjectGradient
+ itemLabelFormat: "%f"
+ itemLabelVisible: false
+ mesh: Abstract3DSeries.MeshCube
+ meshRotation: Qt.quaternion(1, 1, 1, 1)
+ meshSmooth: true
+ multiHighlightColor: "green"
+ multiHighlightGradient: gradient2
+ name: "series1"
+ singleHighlightColor: "red"
+ singleHighlightGradient: gradient3
+ userDefinedMesh: ":/customitem.obj"
+ visible: false
+ }
+
+ ItemModelSurfaceDataProxy {
+ id: proxy1
+ itemModel: ListModel {
+ ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; }
+ ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; }
+ ListElement{ longitude: "22"; latitude: "10"; pop_density: "1.24"; }
+ }
+ rowRole: "longitude"
+ columnRole: "latitude"
+ yPosRole: "pop_density"
+ }
+
+ Surface3DSeries {
+ id: change
+ }
+
+ TestCase {
+ name: "Surface3DSeries Initial"
+
+ function test_1_initial() {
+ compare(initial.dataProxy.rowCount, 0)
+ compare(initial.invalidSelectionPosition, Qt.point(-1, -1))
+ compare(initial.drawMode, Surface3DSeries.DrawSurfaceAndWireframe)
+ compare(initial.flatShadingEnabled, true)
+ compare(initial.flatShadingSupported, true)
+ compare(initial.selectedPoint, Qt.point(-1, -1))
+ }
+
+ function test_2_initial_common() {
+ // Common properties
+ compare(initial.baseColor, "#000000")
+ compare(initial.baseGradient, null)
+ compare(initial.colorStyle, Theme3D.ColorStyleUniform)
+ compare(initial.itemLabel, "")
+ compare(initial.itemLabelFormat, "@xLabel, @yLabel, @zLabel")
+ compare(initial.itemLabelVisible, true)
+ compare(initial.mesh, Abstract3DSeries.MeshSphere)
+ compare(initial.meshRotation, Qt.quaternion(1, 0, 0, 0))
+ compare(initial.meshSmooth, false)
+ compare(initial.multiHighlightColor, "#000000")
+ compare(initial.multiHighlightGradient, null)
+ compare(initial.name, "")
+ compare(initial.singleHighlightColor, "#000000")
+ compare(initial.singleHighlightGradient, null)
+ compare(initial.type, Abstract3DSeries.SeriesTypeSurface)
+ compare(initial.userDefinedMesh, "")
+ compare(initial.visible, true)
+ }
+ }
+
+ TestCase {
+ name: "Surface3DSeries Initialized"
+
+ function test_1_initialized() {
+ compare(initialized.dataProxy.rowCount, 2)
+ compare(initialized.drawMode, Surface3DSeries.DrawSurface)
+ compare(initialized.flatShadingEnabled, false)
+ compare(initialized.selectedPoint, Qt.point(0, 0))
+ compare(initialized.textureFile, ":\customtexture.jpg")
+ }
+
+ function test_2_initialized_common() {
+ // Common properties
+ compare(initialized.baseColor, "#0000ff")
+ compare(initialized.baseGradient, gradient1)
+ compare(initialized.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(initialized.itemLabelFormat, "%f")
+ compare(initialized.itemLabelVisible, false)
+ compare(initialized.mesh, Abstract3DSeries.MeshCube)
+ compare(initialized.meshRotation, Qt.quaternion(1, 1, 1, 1))
+ compare(initialized.meshSmooth, true)
+ compare(initialized.multiHighlightColor, "#008000")
+ compare(initialized.multiHighlightGradient, gradient2)
+ compare(initialized.name, "series1")
+ compare(initialized.singleHighlightColor, "#ff0000")
+ compare(initialized.singleHighlightGradient, gradient3)
+ compare(initialized.userDefinedMesh, ":/customitem.obj")
+ compare(initialized.visible, false)
+ }
+ }
+
+ TestCase {
+ name: "Surface3DSeries Change"
+
+ function test_1_change() {
+ change.dataProxy = proxy1
+ change.drawMode = Surface3DSeries.DrawSurface
+ change.flatShadingEnabled = false
+ change.selectedPoint = Qt.point(0, 0)
+ change.textureFile = ":\customtexture.jpg"
+ }
+
+ function test_2_test_change() {
+ // This test has a dependency to the previous one due to asynchronous item model resolving
+ compare(change.dataProxy.rowCount, 3)
+ compare(change.drawMode, Surface3DSeries.DrawSurface)
+ compare(change.flatShadingEnabled, false)
+ compare(change.selectedPoint, Qt.point(0, 0))
+ compare(change.textureFile, ":\customtexture.jpg")
+ }
+
+ function test_3_change_common() {
+ change.baseColor = "blue"
+ change.baseGradient = gradient1
+ change.colorStyle = Theme3D.ColorStyleObjectGradient
+ change.itemLabelFormat = "%f"
+ change.itemLabelVisible = false
+ change.mesh = Abstract3DSeries.MeshCube
+ change.meshRotation = Qt.quaternion(1, 1, 1, 1)
+ change.meshSmooth = true
+ change.multiHighlightColor = "green"
+ change.multiHighlightGradient = gradient2
+ change.name = "series1"
+ change.singleHighlightColor = "red"
+ change.singleHighlightGradient = gradient3
+ change.userDefinedMesh = ":/customitem.obj"
+ change.visible = false
+
+ compare(change.baseColor, "#0000ff")
+ compare(change.baseGradient, gradient1)
+ compare(change.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(change.itemLabelFormat, "%f")
+ compare(change.itemLabelVisible, false)
+ compare(change.mesh, Abstract3DSeries.MeshCube)
+ compare(change.meshRotation, Qt.quaternion(1, 1, 1, 1))
+ compare(change.meshSmooth, true)
+ compare(change.multiHighlightColor, "#008000")
+ compare(change.multiHighlightGradient, gradient2)
+ compare(change.name, "series1")
+ compare(change.singleHighlightColor, "#ff0000")
+ compare(change.singleHighlightGradient, gradient3)
+ compare(change.userDefinedMesh, ":/customitem.obj")
+ compare(change.visible, false)
+ }
+
+ function test_4_change_gradient_stop() {
+ gradient1.stops[0].color = "yellow"
+ compare(change.baseGradient.stops[0].color, "#ffff00")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/theme3d/tst_colorgradient.qml b/tests/auto/qmltest/theme3d/tst_colorgradient.qml
new file mode 100644
index 00000000..395b6672
--- /dev/null
+++ b/tests/auto/qmltest/theme3d/tst_colorgradient.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ ColorGradient {
+ id: initial
+ }
+
+ ColorGradient {
+ id: initialized
+ stops: [
+ ColorGradientStop { color: "blue"; position: 0 },
+ ColorGradientStop { color: "white"; position: 0.5 },
+ ColorGradientStop { color: "red"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: change
+ }
+
+ TestCase {
+ name: "ColorGradient Initial"
+
+ function test_initial() {
+ compare(initial.stops.length, 0)
+ }
+ }
+
+ TestCase {
+ name: "ColorGradient Initialized"
+
+ function test_initialized() {
+ compare(initialized.stops.length, 3)
+ compare(initialized.stops[0].color, "#0000ff")
+ compare(initialized.stops[1].color, "#ffffff")
+ compare(initialized.stops[2].color, "#ff0000")
+ }
+ }
+
+ TestCase {
+ name: "ColorGradient Change"
+
+ ColorGradientStop { id: stop1; color: "blue"; position: 0 }
+ ColorGradientStop { id: stop2; color: "red"; position: 1.0 }
+ ColorGradientStop { id: stop3; color: "white"; position: 0.5 }
+
+ function test_change() {
+ change.stops = [stop1]
+ compare(change.stops.length, 1)
+ change.stops = [stop1, stop2]
+ compare(change.stops.length, 2)
+ compare(change.stops[0].color, "#0000ff")
+ change.stops[0].color = "red"
+ compare(change.stops[0].color, "#ff0000")
+ compare(change.stops[1].color, "#ff0000")
+ change.stops = [stop1, stop2, stop3]
+ compare(change.stops[2].color, "#ffffff")
+ compare(change.stops.length, 3)
+ stop2.position = 0.25
+ stop3.position = 1.0
+ compare(change.stops[1].position, 0.25)
+ compare(change.stops[2].position, 1.0)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/theme3d/tst_theme.qml b/tests/auto/qmltest/theme3d/tst_theme.qml
new file mode 100644
index 00000000..3e42b300
--- /dev/null
+++ b/tests/auto/qmltest/theme3d/tst_theme.qml
@@ -0,0 +1,266 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ Theme3D {
+ id: initial
+ }
+
+ ColorGradient {
+ id: gradient1
+ stops: [
+ ColorGradientStop { color: "red"; position: 0 },
+ ColorGradientStop { color: "blue"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient2
+ stops: [
+ ColorGradientStop { color: "green"; position: 0 },
+ ColorGradientStop { color: "red"; position: 1 }
+ ]
+ }
+
+ ColorGradient {
+ id: gradient3
+ stops: [
+ ColorGradientStop { color: "gray"; position: 0 },
+ ColorGradientStop { color: "darkgray"; position: 1 }
+ ]
+ }
+
+ ThemeColor {
+ id: color1
+ color: "red"
+ }
+
+ ThemeColor {
+ id: color2
+ color: "blue"
+ }
+
+ Theme3D {
+ id: initialized
+ ambientLightStrength: 0.3
+ backgroundColor: "#ff0000"
+ backgroundEnabled: false
+ baseColors: [color1, color2]
+ baseGradients: [gradient1, gradient2]
+ colorStyle: Theme3D.ColorStyleRangeGradient
+ font.family: "Arial"
+ gridEnabled: false
+ gridLineColor: "#00ff00"
+ highlightLightStrength: 5.0
+ labelBackgroundColor: "#ff00ff"
+ labelBackgroundEnabled: false
+ labelBorderEnabled: false
+ labelTextColor: "#00ffff"
+ lightColor: "#ffff00"
+ lightStrength: 2.5
+ multiHighlightColor: "#ff00ff"
+ multiHighlightGradient: gradient3
+ singleHighlightColor: "#ff0000"
+ singleHighlightGradient: gradient3
+ type: Theme3D.ThemeQt // Default values will be overwritten by initialized values
+ windowColor: "#fff00f"
+ }
+
+ Theme3D {
+ id: change
+ }
+
+ Theme3D {
+ id: invalid
+ }
+
+ TestCase {
+ name: "Theme3D Initial"
+
+ Text { id: dummy }
+
+ function test_initial() {
+ compare(initial.ambientLightStrength, 0.25)
+ compare(initial.backgroundColor, "#000000")
+ compare(initial.backgroundEnabled, true)
+ compare(initial.baseColors.length, 1)
+ compare(initial.baseColors[0].color, "#000000")
+ compare(initial.baseGradients.length, 1)
+ compare(initial.baseGradients[0].stops[0].color, "#000000")
+ compare(initial.baseGradients[0].stops[1].color, "#ffffff")
+ compare(initial.colorStyle, Theme3D.ColorStyleUniform)
+ // Initial font needs to be tested like this, as different platforms have different default font (QFont())
+ compare(initial.font.family, dummy.font.family)
+ compare(initial.gridEnabled, true)
+ compare(initial.gridLineColor, "#ffffff")
+ compare(initial.highlightLightStrength, 7.5)
+ compare(initial.labelBackgroundColor, "#a0a0a4")
+ compare(initial.labelBackgroundEnabled, true)
+ compare(initial.labelBorderEnabled, true)
+ compare(initial.labelTextColor, "#ffffff")
+ compare(initial.lightColor, "#ffffff")
+ compare(initial.lightStrength, 5)
+ compare(initial.multiHighlightColor, "#0000ff")
+ compare(initial.multiHighlightGradient, null)
+ compare(initial.singleHighlightColor, "#ff0000")
+ compare(initial.singleHighlightGradient, null)
+ compare(initial.type, Theme3D.ThemeUserDefined)
+ compare(initial.windowColor, "#000000")
+ }
+ }
+
+ TestCase {
+ name: "Theme3D Initialized"
+
+ function test_initialized() {
+ compare(initialized.ambientLightStrength, 0.3)
+ compare(initialized.backgroundColor, "#ff0000")
+ compare(initialized.backgroundEnabled, false)
+ compare(initialized.baseColors.length, 2)
+ compare(initialized.baseColors[0].color, "#ff0000")
+ compare(initialized.baseColors[1].color, "#0000ff")
+ compare(initialized.baseGradients.length, 2)
+ compare(initialized.baseGradients[0], gradient1)
+ compare(initialized.baseGradients[1], gradient2)
+ compare(initialized.colorStyle, Theme3D.ColorStyleRangeGradient)
+ compare(initialized.font.family, "Arial")
+ compare(initialized.gridEnabled, false)
+ compare(initialized.gridLineColor, "#00ff00")
+ compare(initialized.highlightLightStrength, 5.0)
+ compare(initialized.labelBackgroundColor, "#ff00ff")
+ compare(initialized.labelBackgroundEnabled, false)
+ compare(initialized.labelBorderEnabled, false)
+ compare(initialized.labelTextColor, "#00ffff")
+ compare(initialized.lightColor, "#ffff00")
+ compare(initialized.lightStrength, 2.5)
+ compare(initialized.multiHighlightColor, "#ff00ff")
+ compare(initialized.multiHighlightGradient, gradient3)
+ compare(initialized.singleHighlightColor, "#ff0000")
+ compare(initialized.singleHighlightGradient, gradient3)
+ compare(initialized.type, Theme3D.ThemeQt)
+ compare(initialized.windowColor, "#fff00f")
+ }
+ }
+
+ TestCase {
+ name: "Theme3D Change"
+
+ ThemeColor {
+ id: color3
+ color: "red"
+ }
+
+ ColorGradient {
+ id: gradient4
+ stops: [
+ ColorGradientStop { color: "red"; position: 0 },
+ ColorGradientStop { color: "blue"; position: 1 }
+ ]
+ }
+
+ function test_1_change() {
+ change.type = Theme3D.ThemeStoneMoss // Default values will be overwritten by the following sets
+ change.ambientLightStrength = 0.3
+ change.backgroundColor = "#ff0000"
+ change.backgroundEnabled = false
+ change.baseColors = [color3, color2]
+ change.baseGradients = [gradient4, gradient2]
+ change.colorStyle = Theme3D.ColorStyleObjectGradient
+ change.font.family = "Arial"
+ change.gridEnabled = false
+ change.gridLineColor = "#00ff00"
+ change.highlightLightStrength = 5.0
+ change.labelBackgroundColor = "#ff00ff"
+ change.labelBackgroundEnabled = false
+ change.labelBorderEnabled = false
+ change.labelTextColor = "#00ffff"
+ change.lightColor = "#ffff00"
+ change.lightStrength = 2.5
+ change.multiHighlightColor = "#ff00ff"
+ change.multiHighlightGradient = gradient3
+ change.singleHighlightColor = "#ff0000"
+ change.singleHighlightGradient = gradient3
+ change.windowColor = "#fff00f"
+
+ compare(change.ambientLightStrength, 0.3)
+ compare(change.backgroundColor, "#ff0000")
+ compare(change.backgroundEnabled, false)
+ compare(change.baseColors.length, 2)
+ compare(change.baseColors[0].color, "#ff0000")
+ compare(change.baseColors[1].color, "#0000ff")
+ compare(change.baseGradients.length, 2)
+ compare(change.baseGradients[0], gradient4)
+ compare(change.baseGradients[1], gradient2)
+ compare(change.colorStyle, Theme3D.ColorStyleObjectGradient)
+ compare(change.font.family, "Arial")
+ compare(change.gridEnabled, false)
+ compare(change.gridLineColor, "#00ff00")
+ compare(change.highlightLightStrength, 5.0)
+ compare(change.labelBackgroundColor, "#ff00ff")
+ compare(change.labelBackgroundEnabled, false)
+ compare(change.labelBorderEnabled, false)
+ compare(change.labelTextColor, "#00ffff")
+ compare(change.lightColor, "#ffff00")
+ compare(change.lightStrength, 2.5)
+ compare(change.multiHighlightColor, "#ff00ff")
+ compare(change.multiHighlightGradient, gradient3)
+ compare(change.singleHighlightColor, "#ff0000")
+ compare(change.singleHighlightGradient, gradient3)
+ compare(change.type, Theme3D.ThemeStoneMoss)
+ compare(change.windowColor, "#fff00f")
+ }
+
+ function test_2_change_color() {
+ color3.color = "white"
+ compare(change.baseColors[0].color, "#ffffff")
+ }
+
+ function test_3_change_gradient() {
+ gradient4.stops[0].color = "black"
+ compare(change.baseGradients[0].stops[0].color, "#000000")
+ }
+ }
+
+
+ TestCase {
+ name: "Theme3D Invalid"
+
+ function test_invalid() {
+ invalid.ambientLightStrength = -1.0
+ compare(invalid.ambientLightStrength, 0.25)
+ invalid.ambientLightStrength = 1.1
+ compare(invalid.ambientLightStrength, 0.25)
+ invalid.highlightLightStrength = -1.0
+ compare(invalid.highlightLightStrength, 7.5)
+ invalid.highlightLightStrength = 10.1
+ compare(invalid.highlightLightStrength, 7.5)
+ invalid.lightStrength = -1.0
+ compare(invalid.lightStrength, 5.0)
+ invalid.lightStrength = 10.1
+ compare(invalid.lightStrength, 5.0)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/theme3d/tst_themecolor.qml b/tests/auto/qmltest/theme3d/tst_themecolor.qml
new file mode 100644
index 00000000..421a5775
--- /dev/null
+++ b/tests/auto/qmltest/theme3d/tst_themecolor.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtDataVisualization 1.2
+import QtTest 1.0
+
+Item {
+ id: top
+ width: 150
+ height: 150
+
+ ThemeColor {
+ id: initial
+ }
+
+ ThemeColor {
+ id: initialized
+ color: "red"
+ }
+
+ ThemeColor {
+ id: change
+ }
+
+ TestCase {
+ name: "ThemeColor Initial"
+
+ function test_initial() {
+ compare(initial.color, "#000000")
+ }
+ }
+
+ TestCase {
+ name: "ThemeColor Initialized"
+
+ function test_initialized() {
+ compare(initialized.color, "#ff0000")
+ }
+ }
+
+ TestCase {
+ name: "ThemeColor Change"
+
+ function test_change() {
+ change.color = "blue"
+
+ compare(change.color, "#0000ff")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/tst_qmltest.cpp b/tests/auto/qmltest/tst_qmltest.cpp
new file mode 100644
index 00000000..569d9150
--- /dev/null
+++ b/tests/auto/qmltest/tst_qmltest.cpp
@@ -0,0 +1,20 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(qmltest)