Debian Codegraph @

tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_1.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.1
7
8 Rectangle {
9 width: 400
10 height: 300
11
12 TestCase {
13 id: tc1
14 name: "tst_qml-qtquicktest CategoryAxis 1.1"
15 when: windowShown
16
17 function test_minMax() {
18 compare(lineSeries1.axisX.min, 0, "AxisX min");
19 compare(lineSeries1.axisX.max, 10, "AxisX max");
20 compare(lineSeries1.axisY.min, 0, "AxisY min");
21 compare(lineSeries1.axisY.max, 10, "AxisY max");
22 }
23
24 function test_categories() {
25 compare(lineSeries1.axisY.startValue, 0, "AxisY start value");
26 compare(lineSeries1.axisY.count, 3, "AxisY count");
27 compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels");
28 compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels");
29 compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels");
30 }
31 }
32
33 ChartView {
34 id: chartView
35 anchors.fill: parent
36
37 LineSeries {
38 id: lineSeries1
39 axisX: ValuesAxis {
40 id: axisX
41 min: 0
42 max: 10
43 }
44 axisY: CategoryAxis {
45 id: axisY
46 min: 0
47 max: 10
48 startValue: 0
49 CategoryRange {
50 label: "label0"
51 endValue: 1
52 }
53 CategoryRange {
54 label: "label1"
55 endValue: 3
56 }
57 CategoryRange {
58 label: "label2"
59 endValue: 10
60 }
61 }
62 XYPoint { x: -1; y: -1 }
63 XYPoint { x: 0; y: 0 }
64 XYPoint { x: 5; y: 5 }
65 }
66 }
67 }