summaryrefslogtreecommitdiffstats
path: root/tests/auto/cpptest/q3dscatter-modelproxy
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2014-11-06 11:36:23 +0200
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2014-11-06 11:46:26 +0200
commitb6bf8a4b70091f836a20f4848d3dc00e82bafe3c (patch)
tree7f40572605816fb28bea19009a264ce0f1d58faa /tests/auto/cpptest/q3dscatter-modelproxy
parent46ef32d424d7e0209e52528286e31f656c654289 (diff)
Fixed Valgrind reported issues in cpp tests
Change-Id: I284832fc697e0ac6ef1ba1bb857892a10cbcd8fd Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'tests/auto/cpptest/q3dscatter-modelproxy')
-rw-r--r--tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp
index 9d5cea90..0dccd54f 100644
--- a/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp
+++ b/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp
@@ -120,9 +120,9 @@ void tst_proxy::initializeProperties()
{
QVERIFY(m_proxy);
- QTableWidget *table = new QTableWidget();
+ QTableWidget table;
- m_proxy->setItemModel(table->model());
+ m_proxy->setItemModel(table.model());
m_proxy->setRotationRole("rotation");
m_proxy->setRotationRolePattern(QRegExp("/-/"));
m_proxy->setRotationRoleReplace("\\\\1");
@@ -153,26 +153,26 @@ void tst_proxy::initializeProperties()
void tst_proxy::addModel()
{
- QTableWidget *table = new QTableWidget();
+ QTableWidget table;
QStringList rows;
rows << "row 1";
QStringList columns;
columns << "col 1";
const char *values[1][2] = {{"0/0/5.5/30", "0/0/10.5/30"}};
- table->setRowCount(2);
- table->setColumnCount(1);
+ table.setRowCount(2);
+ table.setColumnCount(1);
for (int col = 0; col < columns.size(); col++) {
for (int row = 0; row < rows.size(); row++) {
- QModelIndex index = table->model()->index(col, row);
- table->model()->setData(index, values[col][row]);
+ QModelIndex index = table.model()->index(col, row);
+ table.model()->setData(index, values[col][row]);
}
}
- m_proxy->setItemModel(table->model());
- m_proxy->setXPosRole(table->model()->roleNames().value(Qt::DisplayRole));
- m_proxy->setZPosRole(table->model()->roleNames().value(Qt::DisplayRole));
+ m_proxy->setItemModel(table.model());
+ m_proxy->setXPosRole(table.model()->roleNames().value(Qt::DisplayRole));
+ m_proxy->setZPosRole(table.model()->roleNames().value(Qt::DisplayRole));
m_proxy->setXPosRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$")));
m_proxy->setXPosRoleReplace(QStringLiteral("\\2"));
m_proxy->setYPosRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$")));
@@ -187,6 +187,9 @@ void tst_proxy::addModel()
QCOMPARE(m_proxy->itemCount(), 2);
QVERIFY(m_proxy->series());
+
+ delete series;
+ m_proxy = 0; // proxy gets deleted with series
}
QTEST_MAIN(tst_proxy)