@@ -53,7 +53,7 class tst_qbarmodelmapper : public QObject | |||
|
53 | 53 | void horizontalMapper(); |
|
54 | 54 | void horizontalMapperCustomMapping_data(); |
|
55 | 55 | void horizontalMapperCustomMapping(); |
|
56 | ||
|
56 | void seriesUpdated(); | |
|
57 | 57 | void verticalModelInsertRows(); |
|
58 | 58 | void verticalModelRemoveRows(); |
|
59 | 59 | void verticalModelInsertColumns(); |
@@ -332,6 +332,49 void tst_qbarmodelmapper::horizontalMapperCustomMapping() | |||
|
332 | 332 | mapper = 0; |
|
333 | 333 | } |
|
334 | 334 | |
|
335 | void tst_qbarmodelmapper::seriesUpdated() | |
|
336 | { | |
|
337 | // setup the mapper | |
|
338 | createVerticalMapper(); | |
|
339 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount); | |
|
340 | QCOMPARE(m_vMapper->count(), -1); | |
|
341 | ||
|
342 | m_series->barSets().first()->append(123); | |
|
343 | QCOMPARE(m_model->rowCount(), m_modelRowCount + 1); | |
|
344 | QCOMPARE(m_vMapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model | |
|
345 | ||
|
346 | m_series->barSets().last()->remove(0, m_modelRowCount); | |
|
347 | QCOMPARE(m_model->rowCount(), 1); | |
|
348 | QCOMPARE(m_vMapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model | |
|
349 | ||
|
350 | m_series->barSets().first()->replace(0, 444.0); | |
|
351 | QCOMPARE(m_model->data(m_model->index(0, 0)).toReal(), 444.0); | |
|
352 | ||
|
353 | m_series->barSets().first()->setLabel("Hello"); | |
|
354 | QCOMPARE(m_model->headerData(0, Qt::Horizontal).toString(), QString("Hello")); | |
|
355 | ||
|
356 | QList<qreal> newValues; | |
|
357 | newValues << 15 << 27 << 35 << 49; | |
|
358 | m_series->barSets().first()->append(newValues); | |
|
359 | QCOMPARE(m_model->rowCount(), 1 + newValues.count()); | |
|
360 | ||
|
361 | QList<QBarSet* > newBarSets; | |
|
362 | QBarSet* newBarSet_1 = new QBarSet("New_1"); | |
|
363 | newBarSet_1->append(101); | |
|
364 | newBarSet_1->append(102); | |
|
365 | newBarSet_1->append(103); | |
|
366 | newBarSets.append(newBarSet_1); | |
|
367 | ||
|
368 | QBarSet* newBarSet_2 = new QBarSet("New_1"); | |
|
369 | newBarSet_2->append(201); | |
|
370 | newBarSet_2->append(202); | |
|
371 | newBarSet_2->append(203); | |
|
372 | newBarSets.append(newBarSet_2); | |
|
373 | ||
|
374 | m_series->append(newBarSets); | |
|
375 | QCOMPARE(m_model->columnCount(), m_modelColumnCount + newBarSets.count()); | |
|
376 | } | |
|
377 | ||
|
335 | 378 | void tst_qbarmodelmapper::verticalModelInsertRows() |
|
336 | 379 | { |
|
337 | 380 | // setup the mapper |
General Comments 0
You need to be logged in to leave comments.
Login now