summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest/bars3d
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmltest/bars3d')
-rw-r--r--tests/auto/qmltest/bars3d/tst_bars.qml48
-rw-r--r--tests/auto/qmltest/bars3d/tst_barseries.qml55
-rw-r--r--tests/auto/qmltest/bars3d/tst_basic.qml121
-rw-r--r--tests/auto/qmltest/bars3d/tst_proxy.qml32
4 files changed, 96 insertions, 160 deletions
diff --git a/tests/auto/qmltest/bars3d/tst_bars.qml b/tests/auto/qmltest/bars3d/tst_bars.qml
index 75cf10a2..03638501 100644
--- a/tests/auto/qmltest/bars3d/tst_bars.qml
+++ b/tests/auto/qmltest/bars3d/tst_bars.qml
@@ -1,34 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -40,8 +14,8 @@ Item {
function constructBars() {
bars3d = Qt.createQmlObject("
- import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtQuick
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
}", top)
@@ -89,6 +63,14 @@ Item {
compare(bars3d.selectedSeries, series1)
waitForRendering(top)
+ }
+
+ function test_6_has_series() {
+ bars3d.seriesList = [series1]
+ compare(bars3d.hasSeries(series1), true)
+ compare(bars3d.hasSeries(series2), false)
+
+ waitForRendering(top)
bars3d.destroy()
waitForRendering(top)
}
@@ -103,8 +85,8 @@ Item {
function constructBarsWithCustomItemList() {
bars3d = Qt.createQmlObject("
- import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtQuick
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
customItemList: [item1, item2]
diff --git a/tests/auto/qmltest/bars3d/tst_barseries.qml b/tests/auto/qmltest/bars3d/tst_barseries.qml
index 3db19615..7ee38d29 100644
--- a/tests/auto/qmltest/bars3d/tst_barseries.qml
+++ b/tests/auto/qmltest/bars3d/tst_barseries.qml
@@ -1,34 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -64,6 +38,20 @@ Item {
]
}
+ ThemeColor {
+ id: rowColor1
+ color: "green"
+ }
+
+ ThemeColor {
+ id: rowColor2
+ color: "blue"
+ }
+ ThemeColor {
+ id: rowColor3
+ color: "red"
+ }
+
Bar3DSeries {
id: initialized
dataProxy: ItemModelBarDataProxy {
@@ -92,6 +80,7 @@ Item {
singleHighlightGradient: gradient3
userDefinedMesh: ":/customitem.obj"
visible: false
+ rowColors: [ rowColor1, rowColor2, rowColor3 ]
}
ItemModelBarDataProxy {
@@ -118,6 +107,7 @@ Item {
compare(initial.invalidSelectionPosition, Qt.point(-1, -1))
compare(initial.meshAngle, 0)
compare(initial.selectedBar, Qt.point(-1, -1))
+ compare(initial.rowColors.length, 0)
}
function test_2_initial_common() {
@@ -149,6 +139,7 @@ Item {
compare(initialized.dataProxy.rowCount, 2)
fuzzyCompare(initialized.meshAngle, 15.0, 0.01)
compare(initialized.selectedBar, Qt.point(0, 0))
+ compare(initialized.rowColors.length, 3)
}
function test_2_initialized_common() {
@@ -177,6 +168,7 @@ Item {
change.dataProxy = proxy1
change.meshAngle = 15.0
change.selectedBar = Qt.point(0, 0)
+ change.rowColors = [rowColor1, rowColor2, rowColor3]
}
function test_2_test_change() {
@@ -222,5 +214,10 @@ Item {
gradient1.stops[0].color = "yellow"
compare(change.baseGradient.stops[0].color, "#ffff00")
}
+
+ function test_5_change_rowColors() {
+ rowColor2.color = "purple"
+ compare(change.rowColors[1].color, "#800080")
+ }
}
}
diff --git a/tests/auto/qmltest/bars3d/tst_basic.qml b/tests/auto/qmltest/bars3d/tst_basic.qml
index 3ef7101d..881d629e 100644
--- a/tests/auto/qmltest/bars3d/tst_basic.qml
+++ b/tests/auto/qmltest/bars3d/tst_basic.qml
@@ -1,34 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -43,22 +17,24 @@ Item {
function constructEmpty() {
empty = Qt.createQmlObject("
- import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtQuick
+ import QtDataVisualization
Bars3D {
}", top)
}
function constructBasic() {
basic = Qt.createQmlObject("
- import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtQuick
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
multiSeriesUniform: true
barThickness: 0.1
barSpacing.width: 0.1
barSpacing.height: 0.1
+ barSeriesMargin.width: 0.3
+ barSeriesMargin.height: 0.3
barSpacingRelative: false
floorLevel: 1.0
}", top)
@@ -67,8 +43,8 @@ Item {
function constructCommon() {
common = Qt.createQmlObject("
- import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtQuick
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
}", top)
@@ -77,8 +53,8 @@ Item {
function constructCommonInit() {
common_init = Qt.createQmlObject("
- import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtQuick
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
@@ -112,6 +88,7 @@ Item {
compare(empty.multiSeriesUniform, false, "multiSeriesUniform")
compare(empty.barThickness, 1.0, "barThickness")
compare(empty.barSpacing, Qt.size(1.0, 1.0), "barSpacing")
+ compare(empty.barSeriesMargin, Qt.size(0.0, 0.0), "barSeriesMargin")
compare(empty.barSpacingRelative, true, "barSpacingRelative")
compare(empty.seriesList.length, 0, "seriesList")
compare(empty.selectedSeries, null, "selectedSeries")
@@ -124,8 +101,6 @@ Item {
compare(empty.rowAxis.type, AbstractAxis3D.AxisTypeCategory)
compare(empty.valueAxis.type, AbstractAxis3D.AxisTypeValue)
waitForRendering(top)
- empty.destroy()
- waitForRendering(top)
}
}
@@ -140,6 +115,7 @@ Item {
compare(basic.multiSeriesUniform, true, "multiSeriesUniform")
compare(basic.barThickness, 0.1, "barThickness")
compare(basic.barSpacing, Qt.size(0.1, 0.1), "barSpacing")
+ compare(basic.barSeriesMargin, Qt.size(0.3, 0.3), "barSeriesMargin")
compare(basic.barSpacingRelative, false, "barSpacingRelative")
compare(basic.floorLevel, 1.0, "floorLevel")
waitForRendering(top)
@@ -149,11 +125,13 @@ Item {
basic.multiSeriesUniform = false
basic.barThickness = 0.5
basic.barSpacing = Qt.size(1.0, 0.0)
+ basic.barSeriesMargin = Qt.size(0.5, 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.barSeriesMargin, Qt.size(0.5, 0.0), "barSeriesMargin")
compare(basic.barSpacingRelative, true, "barSpacingRelative")
compare(basic.floorLevel, 0.2, "floorLevel")
waitForRendering(top)
@@ -162,10 +140,10 @@ Item {
function test_3_basic_change_invalid() {
basic.barThickness = -1
basic.barSpacing = Qt.size(-1.0, -1.0)
+ basic.barSeriesMargin = 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, -1.0), "barSpacing")
- waitForRendering(top)
- basic.destroy()
+ compare(basic.barSeriesMargin, Qt.size(-1.0, -1.0), "barSeriesMargin")
waitForRendering(top)
}
}
@@ -175,13 +153,16 @@ Item {
when: windowShown
function test_1_common() {
+ if (Qt.platform.os === "android")
+ return;
+
constructCommon()
+ if (common.shadowsSupported === false)
+ return;
+
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.msaaSamples, 4, "msaaSamples")
compare(common.theme.type, Theme3D.ThemeQt, "theme")
compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
compare(common.measureFps, false, "measureFps")
@@ -202,14 +183,14 @@ Item {
}
function test_2_change_common() {
+ if (Qt.platform.os === "android" || common.shadowsSupported === false)
+ return;
+
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")
+ compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality")
+ compare(common.msaaSamples, 8, "msaaSamples")
common.theme.type = Theme3D.ThemeRetro
common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear
common.measureFps = true
@@ -243,6 +224,9 @@ Item {
}
function test_3_change_invalid_common() {
+ if (Qt.platform.os === "android" || common.shadowsSupported === false)
+ return;
+
common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice
common.theme.type = -2
common.renderingMode = -1
@@ -254,28 +238,30 @@ Item {
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
-
- waitForRendering(top)
- common.destroy()
+ compare(common.theme.type, Theme3D.ThemeRetro, "theme")
+ compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode")
+ compare(common.aspectRatio, 1.0, "aspectRatio")
+ compare(common.horizontalAspectRatio, 1.0, "horizontalAspectRatio")
+ compare(common.reflectivity, 1.0, "reflectivity")
waitForRendering(top)
}
+ }
+
+ TestCase {
+ name: "Bars3D Common Initialized"
+ when: windowShown
+
+ function test_1_common_initialized() {
+ if (Qt.platform.os === "android")
+ return;
- function test_4_common_initialized() {
constructCommonInit()
+ if (common_init.shadowsSupported === false) // This test is flaky on VM, use shadowsSupported to detect being run in VM
+ return;
compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
- if (common_init.shadowsSupported === true) {
- tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow)
- compare(common_init.msaaSamples, 2, "msaaSamples")
- } else {
- tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone)
- compare(common_init.msaaSamples, 0, "msaaSamples")
- }
+ tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow)
+ compare(common_init.msaaSamples, 2, "msaaSamples")
compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode")
compare(common_init.measureFps, true, "measureFps")
@@ -290,9 +276,6 @@ Item {
compare(common_init.reflectivity, 0.1, "reflectivity")
compare(common_init.locale, Qt.locale("UK"), "locale")
compare(common_init.margin, 0.2, "margin")
-
- waitForRendering(top)
- common_init.destroy();
waitForRendering(top)
}
}
diff --git a/tests/auto/qmltest/bars3d/tst_proxy.qml b/tests/auto/qmltest/bars3d/tst_proxy.qml
index ca8b8516..bd337017 100644
--- a/tests/auto/qmltest/bars3d/tst_proxy.qml
+++ b/tests/auto/qmltest/bars3d/tst_proxy.qml
@@ -1,34 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {