summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlegend/tst_qlegend.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2014-11-11 11:17:04 +0200
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2014-11-11 11:31:38 +0200
commitc6ed50e68438e5558e7cda0e36c194a4b99f7f83 (patch)
tree8cbb330dc82eae3cb11b2202ba0f34bc6e6988bf /tests/auto/qlegend/tst_qlegend.cpp
parenta686cb49be8689c5e306e895062f47c37a4f908d (diff)
Plugged some memory leaks.
Autotests were also made Valgrind friendly by adding a final one millisecond wait to the end of the test to allow pending deleteLaters to run. Also some minor cosmetic cleanup done to autotests. Change-Id: Ic3719167a22949f243eaf54614e174a681dbe34a Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>
Diffstat (limited to 'tests/auto/qlegend/tst_qlegend.cpp')
-rw-r--r--tests/auto/qlegend/tst_qlegend.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/qlegend/tst_qlegend.cpp b/tests/auto/qlegend/tst_qlegend.cpp
index cc081e1e..47d4b1c2 100644
--- a/tests/auto/qlegend/tst_qlegend.cpp
+++ b/tests/auto/qlegend/tst_qlegend.cpp
@@ -71,6 +71,7 @@ void tst_QLegend::initTestCase()
void tst_QLegend::cleanupTestCase()
{
+ QTest::qWait(1); // Allow final deleteLaters to run
}
void tst_QLegend::init()
@@ -144,8 +145,8 @@ void tst_QLegend::qareaLegendMarker()
QLegend *legend = m_chart->legend();
QAreaSeries *series = new QAreaSeries();
- QLineSeries *upper = new QLineSeries();
- QLineSeries *lower = new QLineSeries();
+ QLineSeries *upper = new QLineSeries(series);
+ QLineSeries *lower = new QLineSeries(series);
upper->append(1,1);
lower->append(1,0);
@@ -257,8 +258,8 @@ void tst_QLegend::markers()
m_chart->addSeries(line);
QAreaSeries *area = new QAreaSeries();
- QLineSeries *upper = new QLineSeries();
- QLineSeries *lower = new QLineSeries();
+ QLineSeries *upper = new QLineSeries(area);
+ QLineSeries *lower = new QLineSeries(area);
upper->append(1,1);
lower->append(1,0);
area->setUpperSeries(upper);
@@ -294,6 +295,8 @@ void tst_QLegend::addAndRemoveSeries()
markers = legend->markers();
QVERIFY(markers.count() == 0);
+
+ delete pie;
}
void tst_QLegend::pieMarkerProperties()
@@ -381,8 +384,8 @@ void tst_QLegend::areaMarkerProperties()
QAreaSeries *area = new QAreaSeries();
area->setName(QString("Area"));
- QLineSeries *upper = new QLineSeries();
- QLineSeries *lower = new QLineSeries();
+ QLineSeries *upper = new QLineSeries(area);
+ QLineSeries *lower = new QLineSeries(area);
upper->append(1,1);
lower->append(1,0);
area->setUpperSeries(upper);
@@ -522,8 +525,8 @@ void tst_QLegend::markerSignals()
QAreaSeries *area = new QAreaSeries();
area->setName(QString("Area 1"));
- QLineSeries *upper = new QLineSeries();
- QLineSeries *lower = new QLineSeries();
+ QLineSeries *upper = new QLineSeries(area);
+ QLineSeries *lower = new QLineSeries(area);
upper->append(2,2);
lower->append(1,1);
area->setUpperSeries(upper);