summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-10-16 13:22:47 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-10-16 13:32:33 +0300
commita24d3628fceb70eb2cba2fa91883f5f3bfa55361 (patch)
treeb9f8885b03d5653b4856be1b4fd12427d18cdb73 /tests
parente69acebea5eae430dbf988f379cd26464930ee6b (diff)
Test for QML proxies
Also added missing default values to some docs. Task-number: QTRD-3368 Change-Id: I98940a80d6edfe60801c6b2606307b3ec3ab8c39 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/bars3d/tst_proxy.qml226
-rw-r--r--tests/auto/qmltest/qmltest.pro7
-rw-r--r--tests/auto/qmltest/scatter3d/tst_proxy.qml107
-rw-r--r--tests/auto/qmltest/surface3d/tst_heightproxy.qml101
-rw-r--r--tests/auto/qmltest/surface3d/tst_proxy.qml236
5 files changed, 671 insertions, 6 deletions
diff --git a/tests/auto/qmltest/bars3d/tst_proxy.qml b/tests/auto/qmltest/bars3d/tst_proxy.qml
index 7c117ce4..8d91c055 100644
--- a/tests/auto/qmltest/bars3d/tst_proxy.qml
+++ b/tests/auto/qmltest/bars3d/tst_proxy.qml
@@ -25,5 +25,229 @@ Item {
height: 150
width: 150
- // TODO: Add tests for ItemModelBarDataProxy
+ 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/qmltest.pro b/tests/auto/qmltest/qmltest.pro
index d70d7c88..cbb9b8b8 100644
--- a/tests/auto/qmltest/qmltest.pro
+++ b/tests/auto/qmltest/qmltest.pro
@@ -6,15 +6,16 @@ SOURCES += tst_qmltest.cpp
OTHER_FILES += bars3d\tst_basic.qml \
bars3d\tst_bars.qml \
bars3d\tst_barseries.qml \
- #bars3d\tst_proxy.qml \
+ bars3d\tst_proxy.qml \
scatter3d\tst_basic.qml \
scatter3d\tst_scatter.qml \
scatter3d\tst_scatterseries.qml \
- #scatter3d\tst_proxy.qml \
+ scatter3d\tst_proxy.qml \
surface3d\tst_basic.qml \
surface3d\tst_surface.qml \
surface3d\tst_surfaceseries.qml \
- #surface3d\tst_proxy.qml \
+ surface3d\tst_proxy.qml \
+ surface3d\tst_heightproxy.qml \
theme3d\tst_theme.qml \
theme3d\tst_colorgradient.qml \
theme3d\tst_themecolor.qml \
diff --git a/tests/auto/qmltest/scatter3d/tst_proxy.qml b/tests/auto/qmltest/scatter3d/tst_proxy.qml
index 4476bf68..e6478f15 100644
--- a/tests/auto/qmltest/scatter3d/tst_proxy.qml
+++ b/tests/auto/qmltest/scatter3d/tst_proxy.qml
@@ -25,5 +25,110 @@ Item {
height: 150
width: 150
- // TODO: Add tests for ItemModelScatterDataProxy
+ 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/surface3d/tst_heightproxy.qml b/tests/auto/qmltest/surface3d/tst_heightproxy.qml
new file mode 100644
index 00000000..dc6938f8
--- /dev/null
+++ b/tests/auto/qmltest/surface3d/tst_heightproxy.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** 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
+ }
+
+ 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)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/surface3d/tst_proxy.qml b/tests/auto/qmltest/surface3d/tst_proxy.qml
index 25753a3f..8f353153 100644
--- a/tests/auto/qmltest/surface3d/tst_proxy.qml
+++ b/tests/auto/qmltest/surface3d/tst_proxy.qml
@@ -25,5 +25,239 @@ Item {
height: 150
width: 150
- // TODO: Add tests for ItemModelSurfaceDataProxy and HeightMapSurfaceDataProxy
+ 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)
+ }
+ }
}