summaryrefslogtreecommitdiffstats
path: root/tests/auto/cpptest/q3dsurface-modelproxy
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-10-21 11:05:45 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-10-21 11:23:12 +0300
commitf7f1e1373e652ea2de1666f4b626bf35e367d84b (patch)
tree1f459e063e0f87e302bf331a1a6f95252577ac3b /tests/auto/cpptest/q3dsurface-modelproxy
parent0cc8662c1b245c50910f44153fdb3124dd22abd8 (diff)
Added C++ autotests for series
Also fixed a bug found in testing, and added tests for optional constructors for already tested classes. Task-number: QTRD-3368 Change-Id: I2214f28e2c5069ecab422fc6817acb2f0c0b192b Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'tests/auto/cpptest/q3dsurface-modelproxy')
-rw-r--r--tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp
index f7311ca1..6bef9478 100644
--- a/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp
+++ b/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp
@@ -63,11 +63,75 @@ void tst_proxy::cleanup()
delete m_proxy;
}
+
void tst_proxy::construct()
{
QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy();
QVERIFY(proxy);
delete proxy;
+
+ QTableWidget *table = new QTableWidget();
+
+ proxy = new QItemModelSurfaceDataProxy(table->model());
+ QVERIFY(proxy);
+ delete proxy;
+
+ proxy = new QItemModelSurfaceDataProxy(table->model(), "y");
+ QVERIFY(proxy);
+ QCOMPARE(proxy->rowRole(), QString(""));
+ QCOMPARE(proxy->columnRole(), QString(""));
+ QCOMPARE(proxy->xPosRole(), QString(""));
+ QCOMPARE(proxy->yPosRole(), QString("y"));
+ QCOMPARE(proxy->zPosRole(), QString(""));
+ QCOMPARE(proxy->rowCategories().length(), 0);
+ QCOMPARE(proxy->columnCategories().length(), 0);
+ delete proxy;
+
+ proxy = new QItemModelSurfaceDataProxy(table->model(), "row", "column", "y");
+ QVERIFY(proxy);
+ QCOMPARE(proxy->rowRole(), QString("row"));
+ QCOMPARE(proxy->columnRole(), QString("column"));
+ QCOMPARE(proxy->xPosRole(), QString("column"));
+ QCOMPARE(proxy->yPosRole(), QString("y"));
+ QCOMPARE(proxy->zPosRole(), QString("row"));
+ QCOMPARE(proxy->rowCategories().length(), 0);
+ QCOMPARE(proxy->columnCategories().length(), 0);
+ delete proxy;
+
+ proxy = new QItemModelSurfaceDataProxy(table->model(), "row", "column", "x", "y", "z");
+ QVERIFY(proxy);
+ QCOMPARE(proxy->rowRole(), QString("row"));
+ QCOMPARE(proxy->columnRole(), QString("column"));
+ QCOMPARE(proxy->xPosRole(), QString("x"));
+ QCOMPARE(proxy->yPosRole(), QString("y"));
+ QCOMPARE(proxy->zPosRole(), QString("z"));
+ QCOMPARE(proxy->rowCategories().length(), 0);
+ QCOMPARE(proxy->columnCategories().length(), 0);
+ delete proxy;
+
+ proxy = new QItemModelSurfaceDataProxy(table->model(), "row", "column", "y",
+ QStringList() << "rowCat", QStringList() << "colCat");
+ QVERIFY(proxy);
+ QCOMPARE(proxy->rowRole(), QString("row"));
+ QCOMPARE(proxy->columnRole(), QString("column"));
+ QCOMPARE(proxy->xPosRole(), QString("column"));
+ QCOMPARE(proxy->yPosRole(), QString("y"));
+ QCOMPARE(proxy->zPosRole(), QString("row"));
+ QCOMPARE(proxy->rowCategories().length(), 1);
+ QCOMPARE(proxy->columnCategories().length(), 1);
+ delete proxy;
+
+ proxy = new QItemModelSurfaceDataProxy(table->model(), "row", "column", "x", "y", "z",
+ QStringList() << "rowCat", QStringList() << "colCat");
+ QVERIFY(proxy);
+ QCOMPARE(proxy->rowRole(), QString("row"));
+ QCOMPARE(proxy->columnRole(), QString("column"));
+ QCOMPARE(proxy->xPosRole(), QString("x"));
+ QCOMPARE(proxy->yPosRole(), QString("y"));
+ QCOMPARE(proxy->zPosRole(), QString("z"));
+ QCOMPARE(proxy->rowCategories().length(), 1);
+ QCOMPARE(proxy->columnCategories().length(), 1);
+ delete proxy;
}
void tst_proxy::initialProperties()