Debian Codegraph @

tests/auto/qml-qtquicktest/data/tst_boxplotseries.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 2.1
7
8 Rectangle {
9 width: 400
10 height: 300
11
12 TestCase {
13 id: tc1
14 name: "tst_qml-qtquicktest BoxPlotSeries"
15 when: windowShown
16
17 function test_properties() {
18 compare(boxPlotSeries.boxWidth, 0.5);
19 compare(boxPlotSeries.brushFilename, "");
20 }
21
22 function test_setproperties() {
23 var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
24 compare(set.label, "boxplot");
25 compare(set.count, 5);
26 compare(set.brushFilename, "");
27 }
28
29 function test_append() {
30 boxPlotSeries.clear();
31 addedSpy.clear();
32 countChangedSpy.clear();
33 var count = 50;
34 for (var i = 0; i < count; i++)
35 boxPlotSeries.append("boxplot" + i, [1, 3, 5, 7, 9]);
36 compare(addedSpy.count, count);
37 compare(countChangedSpy.count, count);
38 compare(boxPlotSeries.count, count)
39 boxPlotSeries.clear();
40 }
41
42 function test_remove() {
43 boxPlotSeries.clear();
44 removedSpy.clear();
45 countChangedSpy.clear();
46 var count = 50;
47 for (var i = 0; i < count; i++)
48 boxPlotSeries.append("boxplot" + i, [1, 3, 5, 7, 9]);
49 for (var j = 0; j < count; j++)
50 boxPlotSeries.remove(boxPlotSeries.at(0));
51 compare(removedSpy.count, count);
52 compare(countChangedSpy.count, 2 * count);
53 compare(boxPlotSeries.count, 0)
54 }
55 }
56
57 ChartView {
58 id: chartView
59 anchors.fill: parent
60
61 BoxPlotSeries {
62 id: boxPlotSeries
63 name: "boxplot"
64 BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
65
66 SignalSpy {
67 id: addedSpy
68 target: boxPlotSeries
69 signalName: "boxsetsAdded"
70 }
71 SignalSpy {
72 id: removedSpy
73 target: boxPlotSeries
74 signalName: "boxsetsRemoved"
75 }
76 SignalSpy {
77 id: countChangedSpy
78 target: boxPlotSeries
79 signalName: "countChanged"
80 }
81 }
82 }
83 }