From 67851e8142edecf87fa334354ca3c3884fd44bec 2012-10-23 08:59:39 From: Tero Ahola Date: 2012-10-23 08:59:39 Subject: [PATCH] Unit test module for QML API --- diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 4411b14..9cb588d 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -29,12 +29,18 @@ SUBDIRS += \ contains(QT_VERSION, ^4\\.[0-7]\\.[0-3]\\s*$) | contains(QT_VERSION, ^4\\.[0-6]\\..*) { warning("QtCommercial.Charts QML API requires at least Qt 4.7.4. You are using $${QT_VERSION} so the QML API is disabled.") } else { - SUBDIRS += qml + + # Check if QtQuickTest is installed + exists($$(QTDIR)/lib/QtQuickTest.lib) { + SUBDIRS += qml-qtquicktest + } else { + warning("QtQuickTest not found; cannot build QML api unit tests") + } } !linux-arm*: { -SUBDIRS += \ + SUBDIRS += \ qdatetimeaxis } diff --git a/tests/auto/qml-qtquicktest/main.cpp b/tests/auto/qml-qtquicktest/main.cpp new file mode 100644 index 0000000..8ab2357 --- /dev/null +++ b/tests/auto/qml-qtquicktest/main.cpp @@ -0,0 +1,22 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include +QUICK_TEST_MAIN(example) diff --git a/tests/auto/qml-qtquicktest/qml-qtquicktest.pro b/tests/auto/qml-qtquicktest/qml-qtquicktest.pro new file mode 100644 index 0000000..b34338b --- /dev/null +++ b/tests/auto/qml-qtquicktest/qml-qtquicktest.pro @@ -0,0 +1,8 @@ +!include( ../auto.pri ) { + error( "Couldn't find the auto.pri file!" ) +} + +TEMPLATE = app +CONFIG += warn_on qmltestcase +SOURCES += main.cpp +DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" diff --git a/tests/auto/qml-qtquicktest/tst_chartview.qml b/tests/auto/qml-qtquicktest/tst_chartview.qml new file mode 100644 index 0000000..9ef5fd1 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_chartview.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: "ChartView Properties" + 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 new file mode 100644 index 0000000..8da3dcd --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.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: "ChartView Functions" + 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 new file mode 100644 index 0000000..ba1b3d6 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals.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: "ChartView Signals" + 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 new file mode 100644 index 0000000..a18a3f1 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_pieseries.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: "PieSeries" + 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 new file mode 100644 index 0000000..467c98e --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_xyseries.qml @@ -0,0 +1,259 @@ +/**************************************************************************** +** +** 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: "XY Series" + when: windowShown + + function test_properties() { + verify(lineSeries.color != undefined); + compare(lineSeries.pointsVisible, false); + // TODO: Should the properties be set or not? +// verify(lineSeries.axisX != null); +// verify(lineSeries.axisY != null); + compare(lineSeries.capStyle, Qt.SquareCap); + compare(lineSeries.style, Qt.SolidLine); + compare(lineSeries.width, 2.0); + + verify(splineSeries.color != undefined); + compare(splineSeries.pointsVisible, false); + // TODO: Should the properties be set or not? +// verify(splineSeries.axisX != null); +// verify(splineSeries.axisY != null); + compare(splineSeries.capStyle, Qt.SquareCap); + compare(splineSeries.style, Qt.SolidLine); + compare(splineSeries.width, 2.0); + + verify(scatterSeries.color != undefined); + // TODO: Should the properties be set or not? +// verify(scatterSeries.axisX != null); +// verify(scatterSeries.axisY != null); + 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" + } + } + } +}