Debian Codegraph @

tests/auto/qml-qtquicktest/data/tst_boxplotseries_1_3.qml

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.0
5 import QtTest 1.0
6 import QtCharts 1.3
7
8 Rectangle {
9 width: 400
10 height: 300
11
12 TestCase {
13 id: tc1
14 name: "tst_qml-qtquicktest BoxPlotSeries 1.3"
15 when: windowShown
16
17 function test_properties() {
18 compare(boxPlotSeries.boxWidth, 0.5);
19 }
20
21 function test_setproperties() {
22 var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
23 compare(set.label, "boxplot");
24 compare(set.count, 5);
25 }
26
27 function test_append() {
28 addedSpy.clear();
29 countChangedSpy.clear();
30 var count = 50;
31 for (var i = 0; i < count; i++)
32 boxPlotSeries.append("boxplot" + i, [1, 3, 5, 7, 9]);
33 compare(addedSpy.count, count);
34 compare(countChangedSpy.count, count);
35 boxPlotSeries.clear();
36 }
37
38 function test_remove() {
39 removedSpy.clear();
40 countChangedSpy.clear();
41 var count = 50;
42 for (var i = 0; i < count; i++)
43 boxPlotSeries.append("boxplot" + i, [1, 3, 5, 7, 9]);
44 for (var j = 0; j < count; j++)
45 boxPlotSeries.remove(boxPlotSeries.at(0));
46 compare(removedSpy.count, count);
47 compare(countChangedSpy.count, 2 * count);
48 }
49 }
50
51 ChartView {
52 id: chartView
53 anchors.fill: parent
54
55 BoxPlotSeries {
56 id: boxPlotSeries
57 name: "boxplot"
58 BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
59
60 SignalSpy {
61 id: addedSpy
62 target: boxPlotSeries
63 signalName: "boxsetsAdded"
64 }
65 SignalSpy {
66 id: removedSpy
67 target: boxPlotSeries
68 signalName: "boxsetsRemoved"
69 }
70 SignalSpy {
71 id: countChangedSpy
72 target: boxPlotSeries
73 signalName: "countChanged"
74 }
75 }
76 }
77 }