summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTitta Heikkala <titta.heikkala@theqtcompany.com>2015-09-22 09:54:20 +0300
committerTitta Heikkala <titta.heikkala@theqtcompany.com>2015-09-22 08:38:25 +0000
commit4c1d3bc34edbea5f7ed8f145d4c11198b7610a53 (patch)
tree21b3d4cc180226833508f1a8d2b198f151513417 /tests
parent79dc9c599f412117d04cb1ba8c0c9af93bb0b9de (diff)
Added option to set labels clipping
It's now possible to enable and disable the point label clipping. The clipping is enabled by default. Clipping cuts the point labels on the edge of the plot area. Change-Id: Ifaa6017b4c6d55fe030effeec8b336a7fc317adf Task-number: QTRD-3520 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlineseries/tst_qlineseries.cpp1
-rw-r--r--tests/auto/qxyseries/tst_qxyseries.cpp18
-rw-r--r--tests/auto/qxyseries/tst_qxyseries.h1
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml2
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml4
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml2
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml4
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml2
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml8
-rw-r--r--tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml2
10 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/qlineseries/tst_qlineseries.cpp b/tests/auto/qlineseries/tst_qlineseries.cpp
index f4406308..e1df6c78 100644
--- a/tests/auto/qlineseries/tst_qlineseries.cpp
+++ b/tests/auto/qlineseries/tst_qlineseries.cpp
@@ -80,6 +80,7 @@ void tst_QLineSeries::qlineseries()
QCOMPARE(series.pointsVisible(), false);
QCOMPARE(series.pointLabelsVisible(), false);
QCOMPARE(series.pointLabelsFormat(), QLatin1String("@xPoint, @yPoint"));
+ QCOMPARE(series.pointLabelsClipping(), true);
series.append(QList<QPointF>());
series.append(0.0,0.0);
diff --git a/tests/auto/qxyseries/tst_qxyseries.cpp b/tests/auto/qxyseries/tst_qxyseries.cpp
index 337bc4ec..bb827412 100644
--- a/tests/auto/qxyseries/tst_qxyseries.cpp
+++ b/tests/auto/qxyseries/tst_qxyseries.cpp
@@ -152,6 +152,24 @@ void tst_QXYSeries::pointLabelsColor()
QVERIFY(arguments.at(0).value<QColor>() == defaultColor);
}
+void tst_QXYSeries::pointLabelsClipping()
+{
+ QSignalSpy labelsClippingSpy(m_series, SIGNAL(pointLabelsClippingChanged(bool)));
+ QCOMPARE(m_series->pointLabelsClipping(), true);
+
+ m_series->setPointLabelsClipping(false);
+ QCOMPARE(m_series->pointLabelsClipping(), false);
+ TRY_COMPARE(labelsClippingSpy.count(), 1);
+ QList<QVariant> arguments = labelsClippingSpy.takeFirst();
+ QVERIFY(arguments.at(0).toBool() == false);
+
+ m_series->setPointLabelsClipping();
+ QCOMPARE(m_series->pointLabelsClipping(), true);
+ TRY_COMPARE(labelsClippingSpy.count(), 1);
+ arguments = labelsClippingSpy.takeFirst();
+ QVERIFY(arguments.at(0).toBool() == true);
+}
+
void tst_QXYSeries::append_data()
{
QTest::addColumn< QList<QPointF> >("points");
diff --git a/tests/auto/qxyseries/tst_qxyseries.h b/tests/auto/qxyseries/tst_qxyseries.h
index 59a2c99b..fca4a492 100644
--- a/tests/auto/qxyseries/tst_qxyseries.h
+++ b/tests/auto/qxyseries/tst_qxyseries.h
@@ -44,6 +44,7 @@ private slots:
void pointLabelsVisible();
void pointLabelsFont();
void pointLabelsColor();
+ void pointLabelsClipping();
void seriesOpacity();
void oper_data();
void oper();
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
index 3f2a87bf..020cbdeb 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
@@ -79,6 +79,8 @@ ChartView {
+ font.family);
onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: "
+ color);
+ onPointLabelsClippingChanged: console.log(name + ".onPointLabelsClippingChanged: "
+ + clipping);
onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y);
onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y);
onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y);
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
index 79cc84d9..23ed70ea 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
@@ -79,6 +79,10 @@ Flow {
onClicked: series.pointLabelsColor = main.nextColor();
}
Button {
+ text: "point labels clipping"
+ onClicked: series.pointLabelsClipping = !series.pointLabelsClipping;
+ }
+ Button {
id: upperButton
text: "upper series"
unpressedColor: "#79bd8f"
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
index f1eaaa45..784a575c 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
@@ -60,6 +60,8 @@ ChartView {
+ font.family);
onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
+ color);
+ onPointLabelsClippingChanged: console.log("lineSeries.onPointLabelsClippingChanged: "
+ + clipping);
onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y);
onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y);
onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y);
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
index a6390cb5..c44f63e3 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
@@ -96,6 +96,10 @@ Flow {
onClicked: series.pointLabelsColor = main.nextColor();
}
Button {
+ text: "point labels clipping"
+ onClicked: series.pointLabelsClipping = !series.pointLabelsClipping;
+ }
+ Button {
text: "append point"
onClicked: series.append(series.count - 1, series.count - 1);
}
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
index eada1aa7..f957f02d 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
@@ -57,6 +57,8 @@ ChartView {
+ font.family);
onPointLabelsColorChanged: console.log("scatterSeries.onPointLabelsColorChanged: "
+ color);
+ onPointLabelsClippingChanged: console.log("scatterSeries.onPointLabelsClippingChanged: "
+ + clipping);
onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y);
onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y);
onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y);
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
index ce95cf59..4eca23ca 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
@@ -69,6 +69,10 @@ Flow {
onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
}
Button {
+ text: "point labels clipping"
+ onClicked: series.pointLabelsClipping = !series.pointLabelsClipping;
+ }
+ Button {
text: "point labels format"
onClicked: {
if (series.pointLabelsFormat === "@xPoint, @yPoint")
@@ -91,6 +95,10 @@ Flow {
onClicked: series.pointLabelsColor = main.nextColor();
}
Button {
+ text: "point labels clipping"
+ onClicked: series.pointLabelsClipping = !series.pointLabelsClipping;
+ }
+ Button {
text: "append point"
onClicked: series.append(series.count - 1, series.count - 1);
}
diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
index fe21688f..0eaa47ca 100644
--- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
+++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
@@ -59,6 +59,8 @@ ChartView {
+ font.family);
onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: "
+ color);
+ onPointLabelsClippingChanged: console.log("splineSeries.onPointLabelsClippingChanged: "
+ + clipping);
onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y);
onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y);
onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y);