@@ -223,7 +223,7 void QHXYModelMapper::setColumnCount(int columnCount) | |||||
223 | { |
|
223 | { | |
224 | if (columnCount != count()) { |
|
224 | if (columnCount != count()) { | |
225 | setCount(columnCount); |
|
225 | setCount(columnCount); | |
226 |
emit |
|
226 | emit columnCountChanged(); | |
227 | } |
|
227 | } | |
228 | } |
|
228 | } | |
229 |
|
229 |
@@ -223,7 +223,7 void QVXYModelMapper::setRowCount(int rowCount) | |||||
223 | { |
|
223 | { | |
224 | if (rowCount != count()) { |
|
224 | if (rowCount != count()) { | |
225 | setCount(rowCount); |
|
225 | setCount(rowCount); | |
226 |
emit |
|
226 | emit rowCountChanged(); | |
227 | } |
|
227 | } | |
228 | } |
|
228 | } | |
229 |
|
229 |
@@ -63,6 +63,8 class tst_qxymodelmapper : public QObject | |||||
63 | void horizontalModelInsertColumns(); |
|
63 | void horizontalModelInsertColumns(); | |
64 | void horizontalModelRemoveColumns(); |
|
64 | void horizontalModelRemoveColumns(); | |
65 | void modelUpdateCell(); |
|
65 | void modelUpdateCell(); | |
|
66 | void verticalMapperSignals(); | |||
|
67 | void horizontalMapperSignals(); | |||
66 |
|
68 | |||
67 | private: |
|
69 | private: | |
68 | QStandardItemModel *m_model; |
|
70 | QStandardItemModel *m_model; | |
@@ -524,6 +526,59 void tst_qxymodelmapper::modelUpdateCell() | |||||
524 | QCOMPARE(m_model->data(m_model->index(1, 0)).toReal(), 44.0); |
|
526 | QCOMPARE(m_model->data(m_model->index(1, 0)).toReal(), 44.0); | |
525 | } |
|
527 | } | |
526 |
|
528 | |||
|
529 | void tst_qxymodelmapper::verticalMapperSignals() | |||
|
530 | { | |||
|
531 | QVXYModelMapper *mapper = new QVXYModelMapper; | |||
|
532 | ||||
|
533 | QSignalSpy spy0(mapper, SIGNAL(firstRowChanged())); | |||
|
534 | QSignalSpy spy1(mapper, SIGNAL(rowCountChanged())); | |||
|
535 | QSignalSpy spy2(mapper, SIGNAL(xColumnChanged())); | |||
|
536 | QSignalSpy spy3(mapper, SIGNAL(yColumnChanged())); | |||
|
537 | QSignalSpy spy4(mapper, SIGNAL(modelReplaced())); | |||
|
538 | QSignalSpy spy5(mapper, SIGNAL(seriesReplaced())); | |||
|
539 | ||||
|
540 | mapper->setXColumn(0); | |||
|
541 | mapper->setYColumn(1); | |||
|
542 | mapper->setModel(m_model); | |||
|
543 | mapper->setSeries(m_series); | |||
|
544 | mapper->setFirstRow(1); | |||
|
545 | mapper->setRowCount(5); | |||
|
546 | ||||
|
547 | QCOMPARE(spy0.count(), 1); | |||
|
548 | QCOMPARE(spy1.count(), 1); | |||
|
549 | QCOMPARE(spy2.count(), 1); | |||
|
550 | QCOMPARE(spy3.count(), 1); | |||
|
551 | QCOMPARE(spy4.count(), 1); | |||
|
552 | QCOMPARE(spy5.count(), 1); | |||
|
553 | ||||
|
554 | } | |||
|
555 | ||||
|
556 | void tst_qxymodelmapper::horizontalMapperSignals() | |||
|
557 | { | |||
|
558 | QHXYModelMapper *mapper = new QHXYModelMapper; | |||
|
559 | ||||
|
560 | QSignalSpy spy0(mapper, SIGNAL(firstColumnChanged())); | |||
|
561 | QSignalSpy spy1(mapper, SIGNAL(columnCountChanged())); | |||
|
562 | QSignalSpy spy2(mapper, SIGNAL(xRowChanged())); | |||
|
563 | QSignalSpy spy3(mapper, SIGNAL(yRowChanged())); | |||
|
564 | QSignalSpy spy4(mapper, SIGNAL(modelReplaced())); | |||
|
565 | QSignalSpy spy5(mapper, SIGNAL(seriesReplaced())); | |||
|
566 | ||||
|
567 | mapper->setXRow(0); | |||
|
568 | mapper->setYRow(1); | |||
|
569 | mapper->setModel(m_model); | |||
|
570 | mapper->setSeries(m_series); | |||
|
571 | mapper->setFirstColumn(1); | |||
|
572 | mapper->setColumnCount(5); | |||
|
573 | ||||
|
574 | QCOMPARE(spy0.count(), 1); | |||
|
575 | QCOMPARE(spy1.count(), 1); | |||
|
576 | QCOMPARE(spy2.count(), 1); | |||
|
577 | QCOMPARE(spy3.count(), 1); | |||
|
578 | QCOMPARE(spy4.count(), 1); | |||
|
579 | QCOMPARE(spy5.count(), 1); | |||
|
580 | } | |||
|
581 | ||||
527 | QTEST_MAIN(tst_qxymodelmapper) |
|
582 | QTEST_MAIN(tst_qxymodelmapper) | |
528 |
|
583 | |||
529 | #include "tst_qxymodelmapper.moc" |
|
584 | #include "tst_qxymodelmapper.moc" |
General Comments 0
You need to be logged in to leave comments.
Login now