summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-10-14 07:32:49 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-10-14 09:37:57 +0300
commit961600f6549756754ae155ef9cf63bb990e00f2c (patch)
tree0a1a0890bb4227a32b1839e11de8119fe3b452aa
parent4f70d3777e036f131cf8d39e1072b276132e32a1 (diff)
Bars3D, Surface3D and Scatter3D tests
Task-number: QTRD-3368 + Removed erroneous property from docs Change-Id: I675e16b58e7b190b2b33d29029654039a60b5bfc Change-Id: I675e16b58e7b190b2b33d29029654039a60b5bfc Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc5
-rw-r--r--tests/auto/qmltest/bars3d/tst_bars.qml147
-rw-r--r--tests/auto/qmltest/customitem.obj54
-rw-r--r--tests/auto/qmltest/qmltest.pro8
-rw-r--r--tests/auto/qmltest/qmltest.qrc5
-rw-r--r--tests/auto/qmltest/scatter3d/tst_scatter.qml60
-rw-r--r--tests/auto/qmltest/surface3d/tst_surface.qml60
7 files changed, 333 insertions, 6 deletions
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
index 2e343d38..2b83b807 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
@@ -73,11 +73,6 @@
*/
/*!
- \qmlproperty ColorGradient Surface3D::gradient
- The current surface gradient. Setting this property replaces the previous gradient.
- */
-
-/*!
* \qmlproperty list<Surface3DSeries> Surface3D::seriesList
* \default
* This property holds the series of the graph.
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/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/qmltest.pro b/tests/auto/qmltest/qmltest.pro
index b2f977eb..e1901817 100644
--- a/tests/auto/qmltest/qmltest.pro
+++ b/tests/auto/qmltest/qmltest.pro
@@ -4,5 +4,11 @@ CONFIG += qmltestcase
CONFIG += console
SOURCES += tst_qmltest.cpp
OTHER_FILES += bars3d\tst_basic.qml \
+ bars3d\tst_bars.qml \
scatter3d\tst_basic.qml \
- surface3d\tst_basic.qml
+ scatter3d\tst_scatter.qml \
+ surface3d\tst_basic.qml \
+ surface3d\tst_surface.qml
+
+RESOURCES += \
+ qmltest.qrc
diff --git a/tests/auto/qmltest/qmltest.qrc b/tests/auto/qmltest/qmltest.qrc
new file mode 100644
index 00000000..69def7f8
--- /dev/null
+++ b/tests/auto/qmltest/qmltest.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>customitem.obj</file>
+ </qresource>
+</RCC>
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/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)
+ }
+ }
+}