##// END OF EJS Templates
Added isZoomed method to ChartView...
Added isZoomed method to ChartView isZoomed() method added also the the QML side. Change-Id: Ic0e878bb383316f37a4136d4b920849f1f1853ef Task-number: QTRD-3667 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2776:bc1f6aa59d42
r2813:643291cd617f
Show More
tst_pieseries.qml
133 lines | 4.3 KiB | application/x-qml | QmlLexer
Tero Ahola
Unit test module for QML API
r2206 /****************************************************************************
**
Titta Heikkala
Copyright header changes...
r2776 ** Copyright (C) 2015 The Qt Company Ltd
Tero Ahola
Unit test module for QML API
r2206 ** All rights reserved.
Titta Heikkala
Copyright header changes...
r2776 ** For any questions to The Qt Company, please use contact form at http://qt.io
Tero Ahola
Unit test module for QML API
r2206 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Tero Ahola
Unit test module for QML API
r2206 **
Titta Heikkala
Updated license headers...
r2740 ** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
Titta Heikkala
Copyright header changes...
r2776 ** agreement between you and The Qt Company.
Tero Ahola
Unit test module for QML API
r2206 **
** If you have questions regarding the use of this file, please use
Titta Heikkala
Updated license headers...
r2740 ** contact form at http://qt.io
Tero Ahola
Unit test module for QML API
r2206 **
****************************************************************************/
Titta Heikkala
Fix Charts QML api auto test...
r2638 import QtQuick 2.0
import QtTest 1.0
Titta Heikkala
Qt Charts project file structure change...
r2712 import QtCharts 2.0
Tero Ahola
Unit test module for QML API
r2206
Rectangle {
width: 400
height: 300
TestCase {
id: tc1
Tero Ahola
Renamed QML QtQuick tests to match the naming convention
r2228 name: "tst_qml-qtquicktest PieSeries"
Tero Ahola
Unit test module for QML API
r2206 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);
Titta Heikkala
Fix Charts QML api auto test...
r2638 compare(slice.borderWidth, 1);
Tero Ahola
Unit test module for QML API
r2206 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);
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 compare(slice.brushFilename, "");
Tero Ahola
Unit test module for QML API
r2206 }
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);
}
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 function test_find_and_at() {
Tero Ahola
Unit test module for QML API
r2206 var count = 50;
for (var i = 0; i < count; i++)
pieSeries.append("slice" + i, Math.random());
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 for (var j = 0; j < count; j++) {
Tero Ahola
Unit test module for QML API
r2206 compare(pieSeries.find("slice" + j).label, "slice" + j);
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 compare(pieSeries.find("slice" + j).brushFilename, "");
}
compare(pieSeries.at(3).brushFilename,"");
Tero Ahola
Unit test module for QML API
r2206 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"
}
}
}
}