@@ -52,6 +52,7 private Q_SLOTS: | |||||
52 | void horizontalMapperCustomMapping_data(); |
|
52 | void horizontalMapperCustomMapping_data(); | |
53 | void horizontalMapperCustomMapping(); |
|
53 | void horizontalMapperCustomMapping(); | |
54 | void seriesUpdated(); |
|
54 | void seriesUpdated(); | |
|
55 | void modelUpdated(); | |||
55 |
|
56 | |||
56 | private: |
|
57 | private: | |
57 | QStandardItemModel *m_model; |
|
58 | QStandardItemModel *m_model; | |
@@ -121,6 +122,8 void tst_qxymodelmapper::verticalMapper() | |||||
121 | QFETCH(int, expectedCount); |
|
122 | QFETCH(int, expectedCount); | |
122 |
|
123 | |||
123 | QVXYModelMapper *mapper = new QVXYModelMapper; |
|
124 | QVXYModelMapper *mapper = new QVXYModelMapper; | |
|
125 | QVERIFY(mapper->model() == 0); | |||
|
126 | ||||
124 | mapper->setXColumn(xColumn); |
|
127 | mapper->setXColumn(xColumn); | |
125 | mapper->setYColumn(yColumn); |
|
128 | mapper->setYColumn(yColumn); | |
126 | mapper->setModel(m_model); |
|
129 | mapper->setModel(m_model); | |
@@ -283,6 +286,43 void tst_qxymodelmapper::seriesUpdated() | |||||
283 | QCOMPARE(m_series->count(), m_modelRowCount); |
|
286 | QCOMPARE(m_series->count(), m_modelRowCount); | |
284 | QCOMPARE(mapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model |
|
287 | QCOMPARE(mapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model | |
285 |
|
288 | |||
|
289 | delete mapper; | |||
|
290 | mapper = 0; | |||
|
291 | ||||
|
292 | otherModel->clear(); | |||
|
293 | delete otherModel; | |||
|
294 | otherModel = 0; | |||
|
295 | } | |||
|
296 | ||||
|
297 | void tst_qxymodelmapper::modelUpdated() | |||
|
298 | { | |||
|
299 | QStandardItemModel *otherModel = new QStandardItemModel; | |||
|
300 | for (int row = 0; row < m_modelRowCount; ++row) { | |||
|
301 | for (int column = 0; column < m_modelColumnCount; column++) { | |||
|
302 | QStandardItem *item = new QStandardItem(row * column); | |||
|
303 | otherModel->setItem(row, column, item); | |||
|
304 | } | |||
|
305 | } | |||
|
306 | ||||
|
307 | QVXYModelMapper *mapper = new QVXYModelMapper; | |||
|
308 | QVERIFY(mapper->model() == 0); | |||
|
309 | mapper->setXColumn(0); | |||
|
310 | mapper->setYColumn(1); | |||
|
311 | mapper->setModel(otherModel); | |||
|
312 | mapper->setSeries(m_series); | |||
|
313 | QCOMPARE(m_series->count(), m_modelRowCount); | |||
|
314 | ||||
|
315 | QVERIFY(mapper->model() != 0); | |||
|
316 | ||||
|
317 | if (otherModel->insertRows(3, 4)) | |||
|
318 | QCOMPARE(m_series->count(), m_modelRowCount + 4); | |||
|
319 | ||||
|
320 | if (otherModel->removeRows(1, 5)) | |||
|
321 | QCOMPARE(m_series->count(), m_modelRowCount - 1); | |||
|
322 | ||||
|
323 | delete mapper; | |||
|
324 | mapper = 0; | |||
|
325 | ||||
286 | otherModel->clear(); |
|
326 | otherModel->clear(); | |
287 | delete otherModel; |
|
327 | delete otherModel; | |
288 | otherModel = 0; |
|
328 | otherModel = 0; |
General Comments 0
You need to be logged in to leave comments.
Login now