summaryrefslogtreecommitdiffstats
path: root/tests/auto/qml-qtquicktest
diff options
context:
space:
mode:
authorTero Ahola <tero.ahola@digia.com>2012-11-08 12:12:25 +0200
committerTero Ahola <tero.ahola@digia.com>2012-11-08 12:50:05 +0200
commit9cb45eae013f11322155e8b4274e5538e1e47a5b (patch)
tree242c773c384e1bee44976533b7f343b09a726728 /tests/auto/qml-qtquicktest
parent2523dbee725453a20698020d6ae63f7446489891 (diff)
Improved QML API test coverage
Diffstat (limited to 'tests/auto/qml-qtquicktest')
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries.qml125
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries_1_1.qml125
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview.qml6
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview_1_1.qml79
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml158
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml73
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml131
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml250
12 files changed, 950 insertions, 5 deletions
diff --git a/tests/auto/qml-qtquicktest/tst_barseries.qml b/tests/auto/qml-qtquicktest/tst_barseries.qml
new file mode 100644
index 00000000..61156bb8
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_barseries.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.2
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest BarSeries"
+ when: windowShown
+
+ function test_properties() {
+ compare(barSeries.barWidth, 0.5);
+ compare(barSeries.labelsVisible, false);
+ }
+
+ function test_append() {
+ var setCount = 5;
+ var valueCount = 50;
+ addedSpy.clear();
+ append(setCount, valueCount);
+
+ compare(barSeries.count, setCount);
+ for (var k = 0; k < setCount; k++) {
+ compare(barSeries.at(k).count, valueCount);
+ compare(barSeries.at(k).label, "barset" + k);
+ }
+ compare(addedSpy.count, setCount);
+
+ barSeries.clear();
+ compare(barSeries.count, 0);
+ }
+
+ function test_insert() {
+ var setCount = 5;
+ var valueCount = 50;
+ addedSpy.clear();
+ append(setCount, valueCount);
+
+ for (var i = 0; i < setCount; i++) {
+ var values = [];
+ for (var j = 0; j < valueCount; j++)
+ values[j] = Math.random() * 10;
+ var set = barSeries.insert(i, "barset" + i, values);
+ compare(set.label, "barset" + i);
+ }
+
+ compare(barSeries.count, setCount * 2);
+ for (var k = 0; k < setCount * 2; k++)
+ compare(barSeries.at(k).count, valueCount);
+ compare(addedSpy.count, 2 * setCount);
+
+ barSeries.clear();
+ compare(barSeries.count, 0);
+ }
+
+ function test_remove() {
+ var setCount = 5;
+ var valueCount = 50;
+ removedSpy.clear();
+ append(setCount, valueCount);
+
+ for (var k = 0; k < setCount; k++)
+ barSeries.remove(barSeries.at(0));
+
+ compare(barSeries.count, 0);
+ compare(removedSpy.count, setCount);
+ }
+
+ // Not a test function, used by one or more test functions
+ function append(setCount, valueCount) {
+ for (var i = 0; i < setCount; i++) {
+ var values = [];
+ for (var j = 0; j < valueCount; j++)
+ values[j] = Math.random() * 10;
+ barSeries.append("barset" + i, values);
+ }
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ BarSeries {
+ axisX: BarCategoriesAxis {}
+ axisY: ValuesAxis { min: 0; max: 10 }
+ id: barSeries
+ name: "bar"
+
+ SignalSpy {
+ id: addedSpy
+ target: barSeries
+ signalName: "barsetsAdded"
+ }
+ SignalSpy {
+ id: removedSpy
+ target: barSeries
+ signalName: "barsetsRemoved"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml
new file mode 100644
index 00000000..9980528d
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest BarSeries 1.1"
+ when: windowShown
+
+ function test_properties() {
+ compare(barSeries.barWidth, 0.5);
+ compare(barSeries.labelsVisible, false);
+ }
+
+ function test_append() {
+ var setCount = 5;
+ var valueCount = 50;
+ addedSpy.clear();
+ append(setCount, valueCount);
+
+ compare(barSeries.count, setCount);
+ for (var k = 0; k < setCount; k++) {
+ compare(barSeries.at(k).count, valueCount);
+ compare(barSeries.at(k).label, "barset" + k);
+ }
+ compare(addedSpy.count, setCount);
+
+ barSeries.clear();
+ compare(barSeries.count, 0);
+ }
+
+ function test_insert() {
+ var setCount = 5;
+ var valueCount = 50;
+ addedSpy.clear();
+ append(setCount, valueCount);
+
+ for (var i = 0; i < setCount; i++) {
+ var values = [];
+ for (var j = 0; j < valueCount; j++)
+ values[j] = Math.random() * 10;
+ var set = barSeries.insert(i, "barset" + i, values);
+ compare(set.label, "barset" + i);
+ }
+
+ compare(barSeries.count, setCount * 2);
+ for (var k = 0; k < setCount * 2; k++)
+ compare(barSeries.at(k).count, valueCount);
+ compare(addedSpy.count, 2 * setCount);
+
+ barSeries.clear();
+ compare(barSeries.count, 0);
+ }
+
+ function test_remove() {
+ var setCount = 5;
+ var valueCount = 50;
+ removedSpy.clear();
+ append(setCount, valueCount);
+
+ for (var k = 0; k < setCount; k++)
+ barSeries.remove(barSeries.at(0));
+
+ compare(barSeries.count, 0);
+ compare(removedSpy.count, setCount);
+ }
+
+ // Not a test function, used by one or more test functions
+ function append(setCount, valueCount) {
+ for (var i = 0; i < setCount; i++) {
+ var values = [];
+ for (var j = 0; j < valueCount; j++)
+ values[j] = Math.random() * 10;
+ barSeries.append("barset" + i, values);
+ }
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ BarSeries {
+ axisX: BarCategoriesAxis {}
+ axisY: ValuesAxis { min: 0; max: 10 }
+ id: barSeries
+ name: "bar"
+
+ SignalSpy {
+ id: addedSpy
+ target: barSeries
+ signalName: "barsetsAdded"
+ }
+ SignalSpy {
+ id: removedSpy
+ target: barSeries
+ signalName: "barsetsRemoved"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_chartview.qml b/tests/auto/qml-qtquicktest/tst_chartview.qml
index 9a893648..fc4a50e5 100644
--- a/tests/auto/qml-qtquicktest/tst_chartview.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartview.qml
@@ -20,7 +20,7 @@
import QtQuick 1.0
import QtQuickTest 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.2
Rectangle {
width: 400
@@ -38,6 +38,10 @@ Rectangle {
verify(chartView.topMargin > 0, "ChartView.topMargin");
verify(chartView.leftMargin > 0, "ChartView.leftMargin");
verify(chartView.rightMargin > 0, "ChartView.rightMargin");
+ verify(chartView.margins.bottom > 0, "ChartView.margins.bottom");
+ verify(chartView.margins.top > 0, "ChartView.margins.top");
+ verify(chartView.margins.left > 0, "ChartView.margins.left");
+ verify(chartView.margins.right > 0, "ChartView.margins.right");
compare(chartView.count, 0, "ChartView.count");
compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled");
verify(chartView.plotArea.height > 0, "ChartView.plotArea.height");
diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml
new file mode 100644
index 00000000..9d41c216
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ChartView Properties 1.1"
+ when: windowShown
+
+ function test_chartViewProperties() {
+ compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions");
+ verify(chartView.backgroundColor != undefined);
+ verify(chartView.bottomMargin > 0, "ChartView.bottomMargin");
+ verify(chartView.topMargin > 0, "ChartView.topMargin");
+ verify(chartView.leftMargin > 0, "ChartView.leftMargin");
+ verify(chartView.rightMargin > 0, "ChartView.rightMargin");
+ compare(chartView.count, 0, "ChartView.count");
+ compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled");
+ verify(chartView.plotArea.height > 0, "ChartView.plotArea.height");
+ verify(chartView.plotArea.width > 0, "ChartView.plotArea.width");
+ verify(chartView.plotArea.x > 0, "ChartView.plotArea.x");
+ verify(chartView.plotArea.y > 0, "ChartView.plotArea.y");
+ compare(chartView.theme, ChartView.ChartThemeLight, "ChartView.theme");
+ compare(chartView.title, "", "ChartView.title");
+ compare(chartView.title, "", "ChartView.title");
+ verify(chartView.titleColor != undefined, "ChartView.titleColor");
+ compare(chartView.titleFont.bold, false, "ChartView.titleFont.bold");
+ // Legend
+ compare(chartView.legend.visible, true, "ChartView.legend.visible");
+ compare(chartView.legend.alignment, Qt.AlignTop, "ChartView.legend.alignment");
+ compare(chartView.legend.backgroundVisible, false, "ChartView.legend.backgroundVisible");
+ verify(chartView.legend.borderColor != undefined, "ChartView.legend.borderColor");
+ verify(chartView.legend.color != undefined, "ChartView.legend.color");
+ // Legend font
+ compare(chartView.legend.font.bold, false, "ChartView.legend.font.bold");
+ compare(chartView.legend.font.capitalization, Font.MixedCase, "ChartView.legend.font.capitalization");
+ compare(chartView.legend.font.family, "arial", "ChartView.legend.font.family");
+ compare(chartView.legend.font.italic, false, "ChartView.legend.font.italic");
+ compare(chartView.legend.font.letterSpacing, 0.0, "ChartView.legend.font.letterSpacing");
+ verify(chartView.legend.font.pixelSize > 0
+ && chartView.legend.font.pixelSize < 50, "ChartView.legend.font.pixelSize");
+ verify(chartView.legend.font.pointSize > 0
+ && chartView.legend.font.pointSize < 50, "ChartView.legend.font.pointSize");
+ compare(chartView.legend.font.strikeout, false, "ChartView.legend.font.strikeout");
+ compare(chartView.legend.font.underline, false, "ChartView.legend.font.underline");
+ compare(chartView.legend.font.weight, Font.Normal, "ChartView.legend.font.weight");
+ compare(chartView.legend.font.wordSpacing, 0.0, "ChartView.legend.font.wordSpacing");
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml
index 3936aec5..a575073d 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml
@@ -20,7 +20,7 @@
import QtQuick 1.0
import QtQuickTest 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml
new file mode 100644
index 00000000..441dcd38
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ChartView Functions 1.1"
+ when: windowShown
+
+ function test_chartViewSeriesAndAxes() {
+ // Create XY series
+ var line = chartView.createSeries(ChartView.SeriesTypeLine, "line");
+ verify(line != null && line != undefined);
+ var spline = chartView.createSeries(ChartView.SeriesTypeSpline, "spline");
+ verify(spline != null && spline != undefined);
+ var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter");
+ verify(scatter != null && scatter != undefined);
+
+ // Create a series with specific axes
+ var line2 = chartView.createSeries(ChartView.SeriesTypeLine, "line2", chartView.axisX(line), chartView.axisY(line));
+
+ // Check that all the XY series use the same axes
+ verify(chartView.axisX(line) != null);
+ verify(chartView.axisY(line) != null);
+ compare(chartView.axisX(line), chartView.axisX(line2));
+ compare(chartView.axisY(line), chartView.axisY(line2));
+ compare(chartView.axisX(line), chartView.axisX(spline));
+ compare(chartView.axisY(line), chartView.axisY(spline));
+ compare(chartView.axisX(line), chartView.axisX(scatter));
+ compare(chartView.axisY(line), chartView.axisY(scatter));
+
+ var bar = chartView.createSeries(ChartView.SeriesTypeBar, "bar");
+ verify(bar != null && bar != undefined);
+ var stackedbar = chartView.createSeries(ChartView.SeriesTypeStackedBar, "stackedbar");
+ verify(stackedbar != null && stackedbar != undefined);
+ var percentbar = chartView.createSeries(ChartView.SeriesTypePercentBar, "percentbar");
+ verify(percentbar != null && percentbar != undefined);
+ var horizontalbar = chartView.createSeries(ChartView.SeriesTypeHorizontalBar, "horizontalbar");
+ verify(horizontalbar != null && horizontalbar != undefined);
+ var horizontalstackedbar = chartView.createSeries(ChartView.SeriesTypeHorizontalStackedBar, "horizontalstackedbar");
+ verify(horizontalstackedbar != null && horizontalstackedbar != undefined);
+ var horizontalpercentbar = chartView.createSeries(ChartView.SeriesTypeHorizontalPercentBar, "horizontalpercentbar");
+ verify(horizontalpercentbar != null && horizontalpercentbar != undefined);
+ var area = chartView.createSeries(ChartView.SeriesTypeArea, "area");
+ verify(area != null && area != undefined);
+
+ // Remove all series
+ chartView.removeAllSeries();
+ compare(chartView.count, 0);
+ }
+
+ function test_chartViewRange() {
+ // Set initial values
+ chartView.createSeries(ChartView.SeriesTypeLine, "line");
+ verify(chartView.axisX() != null);
+ verify(chartView.axisY() != null);
+ chartView.axisX().min = 1.0;
+ chartView.axisX().max = 2.0;
+ chartView.axisY().min = 1.0;
+ chartView.axisY().max = 2.0;
+
+ var xMax = chartView.axisX().max;
+ var xMin = chartView.axisX().min;
+ var yMax = chartView.axisY().max;
+ var yMin = chartView.axisY().min;
+
+ // zoom x 2.5
+ chartView.zoom(1.5);
+ verify(chartView.axisX().max < xMax);
+ verify(chartView.axisX().min > xMin);
+ verify(chartView.axisY().max < yMax);
+ verify(chartView.axisY().min > yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // zoom x 0.5
+ chartView.zoom(0.5);
+ verify(chartView.axisX().max > xMax);
+ verify(chartView.axisX().min < xMin);
+ verify(chartView.axisY().max > yMax);
+ verify(chartView.axisY().min < yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // Scroll up
+ chartView.scrollUp(10);
+ compare(chartView.axisX().max, xMax);
+ compare(chartView.axisX().min, xMin);
+ verify(chartView.axisY().max > yMax);
+ verify(chartView.axisY().min > yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // Scroll down
+ chartView.scrollDown(10);
+ compare(chartView.axisX().max, xMax);
+ compare(chartView.axisX().min, xMin);
+ verify(chartView.axisY().max < yMax);
+ verify(chartView.axisY().min < yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ chartView.scrollLeft(10);
+ verify(chartView.axisX().max < xMax);
+ verify(chartView.axisX().min < xMin);
+ compare(chartView.axisY().max, yMax);
+ compare(chartView.axisY().min, yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ chartView.scrollRight(10);
+ verify(chartView.axisX().max > xMax);
+ verify(chartView.axisX().min > xMin);
+ compare(chartView.axisY().max, yMax);
+ compare(chartView.axisY().min, yMin);
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ title: "Chart"
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml
index e93c319d..f09c0ab1 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml
@@ -20,7 +20,7 @@
import QtQuick 1.0
import QtQuickTest 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml
new file mode 100644
index 00000000..2df6f4d2
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ChartView Signals 1.1"
+ when: windowShown
+
+ // Verify onSeriesAdded and onSeriesRemoved signals
+ function test_chartView() {
+ var series = chartView.createSeries(ChartView.SeriesTypeLine, "line");
+ seriesAddedSpy.wait();
+ compare(seriesAddedSpy.count, 1, "ChartView.onSeriesAdded");
+
+ // Modifying layout triggers more than one plotAreaChanged signal
+ chartView.titleFont.pixelSize = 50;
+ verify(plotAreaChangedSpy.count > 0, "ChartView.onPlotAreaChanged");
+
+ chartView.removeSeries(series);
+ seriesRemovedSpy.wait();
+ compare(seriesRemovedSpy.count, 1, "ChartView.onSeriesAdded");
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ title: "Chart"
+
+ SignalSpy {
+ id: plotAreaChangedSpy
+ target: chartView
+ signalName: "plotAreaChanged"
+ }
+
+ SignalSpy {
+ id: seriesAddedSpy
+ target: chartView
+ signalName: "seriesAdded"
+ }
+
+ SignalSpy {
+ id: seriesRemovedSpy
+ target: chartView
+ signalName: "seriesRemoved"
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries.qml b/tests/auto/qml-qtquicktest/tst_pieseries.qml
index f0674a27..80786989 100644
--- a/tests/auto/qml-qtquicktest/tst_pieseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_pieseries.qml
@@ -20,7 +20,7 @@
import QtQuick 1.0
import QtQuickTest 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml
new file mode 100644
index 00000000..18a8c73a
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest PieSeries 1.1"
+ when: windowShown
+
+ function test_properties() {
+ compare(pieSeries.endAngle, 360);
+ compare(pieSeries.holeSize, 0);
+ compare(pieSeries.horizontalPosition, 0.5);
+ compare(pieSeries.size, 0.7);
+ compare(pieSeries.startAngle, 0);
+ compare(pieSeries.sum, 0);
+ compare(pieSeries.verticalPosition, 0.5);
+ }
+
+ function test_sliceproperties() {
+ var slice = pieSeries.append("slice", 10);
+ compare(slice.angleSpan, 360.0);
+ verify(slice.borderColor != undefined);
+ compare(slice.borderWidth, 0);
+ verify(slice.color != undefined);
+ compare(slice.explodeDistanceFactor, 0.15);
+ compare(slice.exploded, false);
+ compare(slice.label, "slice");
+ compare(slice.labelArmLengthFactor, 0.15);
+ verify(slice.labelColor != undefined);
+ compare(slice.labelFont.bold, false);
+ compare(slice.labelPosition, PieSlice.LabelOutside);
+ compare(slice.labelVisible, false);
+ compare(slice.percentage, 1.0);
+ compare(slice.startAngle, 0.0);
+ compare(slice.value, 10.0);
+ }
+
+ function test_append() {
+ addedSpy.clear();
+ countChangedSpy.clear();
+ sumChangedSpy.clear();
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ pieSeries.append("slice" + i, Math.random());
+ compare(addedSpy.count, count);
+ compare(countChangedSpy.count, count);
+ compare(sumChangedSpy.count, count);
+ pieSeries.clear();
+ }
+
+ function test_remove() {
+ removedSpy.clear();
+ countChangedSpy.clear();
+ sumChangedSpy.clear();
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ pieSeries.append("slice" + i, Math.random());
+ for (var j = 0; j < count; j++)
+ pieSeries.remove(pieSeries.at(0));
+ compare(removedSpy.count, count);
+ compare(countChangedSpy.count, 2 * count);
+ compare(sumChangedSpy.count, 2 * count);
+ compare(pieSeries.count, 0);
+ }
+
+ function test_find() {
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ pieSeries.append("slice" + i, Math.random());
+ for (var j = 0; j < count; j++)
+ compare(pieSeries.find("slice" + j).label, "slice" + j);
+ pieSeries.clear();
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ PieSeries {
+ id: pieSeries
+ name: "pie"
+
+ SignalSpy {
+ id: addedSpy
+ target: pieSeries
+ signalName: "added"
+ }
+ SignalSpy {
+ id: removedSpy
+ target: pieSeries
+ signalName: "removed"
+ }
+ SignalSpy {
+ id: sumChangedSpy
+ target: pieSeries
+ signalName: "sumChanged"
+ }
+ SignalSpy {
+ id: countChangedSpy
+ target: pieSeries
+ signalName: "countChanged"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries.qml b/tests/auto/qml-qtquicktest/tst_xyseries.qml
index b648df3c..eba5006f 100644
--- a/tests/auto/qml-qtquicktest/tst_xyseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_xyseries.qml
@@ -20,7 +20,7 @@
import QtQuick 1.0
import QtQuickTest 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml
new file mode 100644
index 00000000..31eb9fed
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial 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
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest XY Series 1.1"
+ when: windowShown
+
+ function test_properties() {
+ verify(lineSeries.color != undefined);
+ compare(lineSeries.pointsVisible, false);
+ compare(lineSeries.capStyle, Qt.SquareCap);
+ compare(lineSeries.style, Qt.SolidLine);
+ compare(lineSeries.width, 2.0);
+
+ verify(splineSeries.color != undefined);
+ compare(splineSeries.pointsVisible, false);
+ compare(splineSeries.capStyle, Qt.SquareCap);
+ compare(splineSeries.style, Qt.SolidLine);
+ compare(splineSeries.width, 2.0);
+
+ verify(scatterSeries.color != undefined);
+ verify(scatterSeries.borderColor != undefined);
+ compare(scatterSeries.borderWidth, 2.0);
+ compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
+ compare(scatterSeries.markerSize, 15.0);
+
+ verify(areaSeries.color != undefined);
+ verify(areaSeries.borderColor != undefined);
+ compare(areaSeries.borderWidth, 2.0);
+ }
+
+ function test_append() {
+ lineSeriesPointAddedSpy.clear();
+ splineSeriesPointAddedSpy.clear();
+ scatterSeriesPointAddedSpy.clear();
+ var count = append();
+ compare(lineSeries.count, count);
+ compare(splineSeries.count, count);
+ compare(scatterSeries.count, count);
+ tryCompare(lineSeriesPointAddedSpy.count, count);
+ tryCompare(splineSeriesPointAddedSpy.count, count);
+ tryCompare(scatterSeriesPointAddedSpy.count, count);
+ clear();
+ compare(lineSeries.count, 0);
+ compare(splineSeries.count, 0);
+ compare(scatterSeries.count, 0);
+ }
+
+ function test_replace() {
+ var count = append();
+ for (var i = 0; i < count; i++) {
+ lineSeries.replace(lineSeries.at(i).x, lineSeries.at(i).y, i, Math.random());
+ splineSeries.replace(splineSeries.at(i).x, splineSeries.at(i).y, i, Math.random());
+ scatterSeries.replace(scatterSeries.at(i).x, scatterSeries.at(i).y, i, Math.random());
+ }
+ compare(lineSeries.count, count);
+ compare(splineSeries.count, count);
+ compare(scatterSeries.count, count);
+ tryCompare(lineSeriesPointReplacedSpy.count, count);
+ tryCompare(splineSeriesPointReplacedSpy.count, count);
+ tryCompare(scatterSeriesPointReplacedSpy.count, count);
+ clear();
+ }
+
+ function test_insert() {
+ var count = append();
+ lineSeriesPointAddedSpy.clear();
+ splineSeriesPointAddedSpy.clear();
+ scatterSeriesPointAddedSpy.clear();
+ for (var i = 0; i < count; i++) {
+ lineSeries.insert(i * 2, i, Math.random());
+ splineSeries.insert(i * 2, i, Math.random());
+ scatterSeries.insert(i * 2, i, Math.random());
+ }
+ compare(lineSeries.count, count * 2);
+ compare(splineSeries.count, count * 2);
+ compare(scatterSeries.count, count * 2);
+ tryCompare(lineSeriesPointAddedSpy.count, count);
+ tryCompare(splineSeriesPointAddedSpy.count, count);
+ tryCompare(scatterSeriesPointAddedSpy.count, count);
+ clear();
+ }
+
+ function test_remove() {
+ lineSeriesPointRemovedSpy.clear();
+ splineSeriesPointRemovedSpy.clear();
+ scatterSeriesPointRemovedSpy.clear();
+ var count = append();
+ for (var i = 0; i < count; i++) {
+ lineSeries.remove(lineSeries.at(0).x, lineSeries.at(0).y);
+ splineSeries.remove(splineSeries.at(0).x, splineSeries.at(0).y);
+ scatterSeries.remove(scatterSeries.at(0).x, scatterSeries.at(0).y);
+ }
+ compare(lineSeries.count, 0);
+ compare(splineSeries.count, 0);
+ compare(scatterSeries.count, 0);
+ tryCompare(lineSeriesPointRemovedSpy.count, count);
+ tryCompare(splineSeriesPointRemovedSpy.count, count);
+ tryCompare(scatterSeriesPointRemovedSpy.count, count);
+ }
+
+ // Not a test function, called from test functions
+ function append() {
+ var count = 100;
+ chartView.axisX().min = 0;
+ chartView.axisX().max = 100;
+ chartView.axisY().min = 0;
+ chartView.axisY().max = 1;
+
+ for (var i = 0; i < count; i++) {
+ lineSeries.append(i, Math.random());
+ splineSeries.append(i, Math.random());
+ scatterSeries.append(i, Math.random());
+ }
+
+ return count;
+ }
+
+ // Not a test function, called from test functions
+ function clear() {
+ lineSeries.clear();
+ splineSeries.clear();
+ scatterSeries.clear();
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ LineSeries {
+ id: lineSeries
+ name: "line"
+
+ SignalSpy {
+ id: lineSeriesPointAddedSpy
+ target: lineSeries
+ signalName: "pointAdded"
+ }
+
+ SignalSpy {
+ id: lineSeriesPointReplacedSpy
+ target: lineSeries
+ signalName: "pointReplaced"
+ }
+
+ SignalSpy {
+ id: lineSeriesPointsReplacedSpy
+ target: lineSeries
+ signalName: "pointsReplaced"
+ }
+
+ SignalSpy {
+ id: lineSeriesPointRemovedSpy
+ target: lineSeries
+ signalName: "pointRemoved"
+ }
+ }
+
+ AreaSeries {
+ id: areaSeries
+ name: "area"
+ upperSeries: lineSeries
+ }
+
+ SplineSeries {
+ id: splineSeries
+ name: "spline"
+
+ SignalSpy {
+ id: splineSeriesPointAddedSpy
+ target: splineSeries
+ signalName: "pointAdded"
+ }
+
+ SignalSpy {
+ id: splineSeriesPointReplacedSpy
+ target: splineSeries
+ signalName: "pointReplaced"
+ }
+
+ SignalSpy {
+ id: splineSeriesPointsReplacedSpy
+ target: splineSeries
+ signalName: "pointsReplaced"
+ }
+
+ SignalSpy {
+ id: splineSeriesPointRemovedSpy
+ target: splineSeries
+ signalName: "pointRemoved"
+ }
+ }
+
+ ScatterSeries {
+ id: scatterSeries
+ name: "scatter"
+
+ SignalSpy {
+ id: scatterSeriesPointAddedSpy
+ target: scatterSeries
+ signalName: "pointAdded"
+ }
+
+ SignalSpy {
+ id: scatterSeriesPointReplacedSpy
+ target: scatterSeries
+ signalName: "pointReplaced"
+ }
+
+ SignalSpy {
+ id: scatterSeriesPointsReplacedSpy
+ target: scatterSeries
+ signalName: "pointsReplaced"
+ }
+
+ SignalSpy {
+ id: scatterSeriesPointRemovedSpy
+ target: scatterSeries
+ signalName: "pointRemoved"
+ }
+ }
+ }
+}