summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest/bars3d/tst_bars.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmltest/bars3d/tst_bars.qml')
-rw-r--r--tests/auto/qmltest/bars3d/tst_bars.qml154
1 files changed, 96 insertions, 58 deletions
diff --git a/tests/auto/qmltest/bars3d/tst_bars.qml b/tests/auto/qmltest/bars3d/tst_bars.qml
index dc5eb8bb..25edfa31 100644
--- a/tests/auto/qmltest/bars3d/tst_bars.qml
+++ b/tests/auto/qmltest/bars3d/tst_bars.qml
@@ -1,20 +1,23 @@
-/****************************************************************************
+/******************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd
-** All rights reserved.
-** For any questions to The Qt Company, please use contact form at http://qt.io
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Data Visualization module.
**
-** Licensees holding valid commercial license for Qt may use this file in
-** accordance with the Qt License Agreement provided with the Software
-** or, alternatively, in accordance with the terms contained in a written
-** agreement between you and The Qt Company.
+** $QT_BEGIN_LICENSE:COMM$
**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.io
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-****************************************************************************/
+** $QT_END_LICENSE$
+**
+******************************************************************************/
import QtQuick 2.0
import QtDataVisualization 1.2
@@ -25,65 +28,80 @@ Item {
height: 150
width: 150
- Bars3D {
- id: series
- anchors.fill: parent
+ property var bars3d: null
+
+ function constructBars() {
+ bars3d = Qt.createQmlObject("
+ import QtQuick 2.2
+ import QtDataVisualization 1.2
+ Bars3D {
+ anchors.fill: parent
+ }", top)
+ bars3d.anchors.fill = top
}
TestCase {
name: "Bars3D Series"
+ when: windowShown
Bar3DSeries { id: series1 }
Bar3DSeries { id: series2 }
function test_1_add_series() {
- series.seriesList = [series1, series2]
- compare(series.seriesList.length, 2)
+ constructBars()
+
+ bars3d.seriesList = [series1, series2]
+ compare(bars3d.seriesList.length, 2)
+ console.log("top:", top)
+ waitForRendering(top)
}
function test_2_remove_series() {
- series.seriesList = [series1]
- compare(series.seriesList.length, 1)
+ bars3d.seriesList = [series1]
+ compare(bars3d.seriesList.length, 1)
+ waitForRendering(top)
}
function test_3_remove_series() {
- series.seriesList = []
- compare(series.seriesList.length, 0)
+ bars3d.seriesList = []
+ compare(bars3d.seriesList.length, 0)
+ waitForRendering(top)
}
function test_4_primary_series() {
- series.seriesList = [series1, series2]
- compare(series.primarySeries, series1)
- series.primarySeries = series2
- compare(series.primarySeries, series2)
+ bars3d.seriesList = [series1, series2]
+ compare(bars3d.primarySeries, series1)
+ bars3d.primarySeries = series2
+ compare(bars3d.primarySeries, series2)
+ waitForRendering(top)
}
function test_5_selected_series() {
- series.seriesList[0].selectedBar = Qt.point(0, 0)
- compare(series.selectedSeries, series1)
+ bars3d.seriesList[0].selectedBar = Qt.point(0, 0)
+ compare(bars3d.selectedSeries, series1)
+
+ waitForRendering(top)
+ bars3d.destroy()
+ waitForRendering(top)
}
}
// 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]
+ function constructBarsWithCustomItemList() {
+ bars3d = Qt.createQmlObject("
+ import QtQuick 2.2
+ import QtDataVisualization 1.2
+ Bars3D {
+ anchors.fill: parent
+ customItemList: [item1, item2]
+ }", top)
+ bars3d.anchors.fill = top
}
TestCase {
@@ -93,13 +111,20 @@ Item {
Theme3D { id: newTheme }
function test_1_add_theme() {
- theme.theme = newTheme
- compare(theme.theme, newTheme)
+ constructBars()
+
+ bars3d.theme = newTheme
+ compare(bars3d.theme, newTheme)
+ waitForRendering(top)
}
function test_2_change_theme() {
newTheme.type = Theme3D.ThemePrimaryColors
- compare(theme.theme.type, Theme3D.ThemePrimaryColors)
+ compare(bars3d.theme.type, Theme3D.ThemePrimaryColors)
+
+ waitForRendering(top)
+ bars3d.destroy()
+ waitForRendering(top)
}
}
@@ -108,8 +133,13 @@ Item {
when: windowShown
function test_1_remove_input() {
- input.inputHandler = null
- compare(input.inputHandler, null)
+ constructBars()
+ bars3d.inputHandler = null
+ compare(bars3d.inputHandler, null)
+
+ waitForRendering(top)
+ bars3d.destroy()
+ waitForRendering(top)
}
}
@@ -118,30 +148,38 @@ Item {
when: windowShown
function test_1_custom_items() {
- compare(custom.customItemList.length, 2)
+ constructBarsWithCustomItemList()
+ compare(bars3d.customItemList.length, 2)
+ waitForRendering(top)
}
function test_2_add_custom_items() {
- custom.addCustomItem(item3)
- compare(custom.customItemList.length, 3)
- custom.addCustomItem(item4)
- compare(custom.customItemList.length, 4)
+ bars3d.addCustomItem(item3)
+ compare(bars3d.customItemList.length, 3)
+ bars3d.addCustomItem(item4)
+ compare(bars3d.customItemList.length, 4)
+ waitForRendering(top)
}
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))
+ compare(bars3d.customItemList[0].position, Qt.vector3d(1.0, 1.0, 1.0))
+ waitForRendering(top)
}
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)
+ bars3d.removeCustomItemAt(Qt.vector3d(0.0, 1.0, 0.0))
+ compare(bars3d.customItemList.length, 3)
+ bars3d.releaseCustomItem(item1)
+ compare(bars3d.customItemList[0], item2)
+ bars3d.releaseCustomItem(item2)
+ compare(bars3d.customItemList.length, 1)
+ bars3d.removeCustomItems()
+ compare(bars3d.customItemList.length, 0)
+
+ waitForRendering(top)
+ bars3d.destroy()
+ waitForRendering(top)
}
}
}