|
@@
-181,7
+181,7
void tst_qbarmodelmapper::verticalMapper()
|
|
181
|
|
|
181
|
|
|
182
|
m_chart->addSeries(m_series);
|
|
182
|
m_chart->addSeries(m_series);
|
|
183
|
|
|
183
|
|
|
184
|
QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
|
|
184
|
QCOMPARE(m_series->count(), expectedBarSetCount);
|
|
185
|
QCOMPARE(mapper->firstBarSetColumn(), qMax(-1, firstBarSetColumn));
|
|
185
|
QCOMPARE(mapper->firstBarSetColumn(), qMax(-1, firstBarSetColumn));
|
|
186
|
QCOMPARE(mapper->lastBarSetColumn(), qMax(-1, lastBarSetColumn));
|
|
186
|
QCOMPARE(mapper->lastBarSetColumn(), qMax(-1, lastBarSetColumn));
|
|
187
|
|
|
187
|
|
|
@@
-216,7
+216,7
void tst_qbarmodelmapper::verticalMapperCustomMapping()
|
|
216
|
|
|
216
|
|
|
217
|
m_series = new QGroupedBarSeries;
|
|
217
|
m_series = new QGroupedBarSeries;
|
|
218
|
|
|
218
|
|
|
219
|
QCOMPARE(m_series->barsetCount(), 0);
|
|
219
|
QCOMPARE(m_series->count(), 0);
|
|
220
|
|
|
220
|
|
|
221
|
QVBarModelMapper *mapper = new QVBarModelMapper;
|
|
221
|
QVBarModelMapper *mapper = new QVBarModelMapper;
|
|
222
|
mapper->setFirstBarSetColumn(0);
|
|
222
|
mapper->setFirstBarSetColumn(0);
|
|
@@
-227,7
+227,7
void tst_qbarmodelmapper::verticalMapperCustomMapping()
|
|
227
|
mapper->setCount(countLimit);
|
|
227
|
mapper->setCount(countLimit);
|
|
228
|
m_chart->addSeries(m_series);
|
|
228
|
m_chart->addSeries(m_series);
|
|
229
|
|
|
229
|
|
|
230
|
QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
|
|
230
|
QCOMPARE(m_series->count(), expectedBarSetCount);
|
|
231
|
|
|
231
|
|
|
232
|
if (expectedBarSetCount > 0)
|
|
232
|
if (expectedBarSetCount > 0)
|
|
233
|
QCOMPARE(m_series->barSets().first()->count(), expectedCount);
|
|
233
|
QCOMPARE(m_series->barSets().first()->count(), expectedCount);
|
|
@@
-236,7
+236,7
void tst_qbarmodelmapper::verticalMapperCustomMapping()
|
|
236
|
mapper->setFirstBarSetColumn(-1);
|
|
236
|
mapper->setFirstBarSetColumn(-1);
|
|
237
|
mapper->setLastBarSetColumn(1);
|
|
237
|
mapper->setLastBarSetColumn(1);
|
|
238
|
|
|
238
|
|
|
239
|
QCOMPARE(m_series->barsetCount(), 0);
|
|
239
|
QCOMPARE(m_series->count(), 0);
|
|
240
|
|
|
240
|
|
|
241
|
delete mapper;
|
|
241
|
delete mapper;
|
|
242
|
mapper = 0;
|
|
242
|
mapper = 0;
|
|
@@
-271,7
+271,7
void tst_qbarmodelmapper::horizontalMapper()
|
|
271
|
|
|
271
|
|
|
272
|
m_chart->addSeries(m_series);
|
|
272
|
m_chart->addSeries(m_series);
|
|
273
|
|
|
273
|
|
|
274
|
QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
|
|
274
|
QCOMPARE(m_series->count(), expectedBarSetCount);
|
|
275
|
QCOMPARE(mapper->firstBarSetRow(), qMax(-1, firstBarSetRow));
|
|
275
|
QCOMPARE(mapper->firstBarSetRow(), qMax(-1, firstBarSetRow));
|
|
276
|
QCOMPARE(mapper->lastBarSetRow(), qMax(-1, lastBarSetRow));
|
|
276
|
QCOMPARE(mapper->lastBarSetRow(), qMax(-1, lastBarSetRow));
|
|
277
|
|
|
277
|
|
|
@@
-306,7
+306,7
void tst_qbarmodelmapper::horizontalMapperCustomMapping()
|
|
306
|
|
|
306
|
|
|
307
|
m_series = new QGroupedBarSeries;
|
|
307
|
m_series = new QGroupedBarSeries;
|
|
308
|
|
|
308
|
|
|
309
|
QCOMPARE(m_series->barsetCount(), 0);
|
|
309
|
QCOMPARE(m_series->count(), 0);
|
|
310
|
|
|
310
|
|
|
311
|
QHBarModelMapper *mapper = new QHBarModelMapper;
|
|
311
|
QHBarModelMapper *mapper = new QHBarModelMapper;
|
|
312
|
mapper->setFirstBarSetRow(0);
|
|
312
|
mapper->setFirstBarSetRow(0);
|
|
@@
-317,7
+317,7
void tst_qbarmodelmapper::horizontalMapperCustomMapping()
|
|
317
|
mapper->setCount(countLimit);
|
|
317
|
mapper->setCount(countLimit);
|
|
318
|
m_chart->addSeries(m_series);
|
|
318
|
m_chart->addSeries(m_series);
|
|
319
|
|
|
319
|
|
|
320
|
QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
|
|
320
|
QCOMPARE(m_series->count(), expectedBarSetCount);
|
|
321
|
|
|
321
|
|
|
322
|
if (expectedBarSetCount > 0)
|
|
322
|
if (expectedBarSetCount > 0)
|
|
323
|
QCOMPARE(m_series->barSets().first()->count(), expectedCount);
|
|
323
|
QCOMPARE(m_series->barSets().first()->count(), expectedCount);
|
|
@@
-326,7
+326,7
void tst_qbarmodelmapper::horizontalMapperCustomMapping()
|
|
326
|
mapper->setFirstBarSetRow(-1);
|
|
326
|
mapper->setFirstBarSetRow(-1);
|
|
327
|
mapper->setLastBarSetRow(1);
|
|
327
|
mapper->setLastBarSetRow(1);
|
|
328
|
|
|
328
|
|
|
329
|
QCOMPARE(m_series->barsetCount(), 0);
|
|
329
|
QCOMPARE(m_series->count(), 0);
|
|
330
|
|
|
330
|
|
|
331
|
delete mapper;
|
|
331
|
delete mapper;
|
|
332
|
mapper = 0;
|
|
332
|
mapper = 0;
|
|
@@
-379,39
+379,39
void tst_qbarmodelmapper::verticalModelInsertRows()
|
|
379
|
{
|
|
379
|
{
|
|
380
|
// setup the mapper
|
|
380
|
// setup the mapper
|
|
381
|
createVerticalMapper();
|
|
381
|
createVerticalMapper();
|
|
382
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
382
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
383
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
383
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
384
|
QVERIFY(m_vMapper->model() != 0);
|
|
384
|
QVERIFY(m_vMapper->model() != 0);
|
|
385
|
|
|
385
|
|
|
386
|
int insertCount = 4;
|
|
386
|
int insertCount = 4;
|
|
387
|
m_model->insertRows(3, insertCount);
|
|
387
|
m_model->insertRows(3, insertCount);
|
|
388
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
388
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
389
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount);
|
|
389
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount);
|
|
390
|
|
|
390
|
|
|
391
|
int first = 3;
|
|
391
|
int first = 3;
|
|
392
|
m_vMapper->setFirst(3);
|
|
392
|
m_vMapper->setFirst(3);
|
|
393
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
393
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
394
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount - first);
|
|
394
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount - first);
|
|
395
|
|
|
395
|
|
|
396
|
m_model->insertRows(3, insertCount);
|
|
396
|
m_model->insertRows(3, insertCount);
|
|
397
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
397
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
398
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 2 * insertCount - first);
|
|
398
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 2 * insertCount - first);
|
|
399
|
|
|
399
|
|
|
400
|
int countLimit = 6;
|
|
400
|
int countLimit = 6;
|
|
401
|
m_vMapper->setCount(countLimit);
|
|
401
|
m_vMapper->setCount(countLimit);
|
|
402
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
402
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
403
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first));
|
|
403
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first));
|
|
404
|
|
|
404
|
|
|
405
|
m_model->insertRows(3, insertCount);
|
|
405
|
m_model->insertRows(3, insertCount);
|
|
406
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
406
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
407
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first));
|
|
407
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first));
|
|
408
|
|
|
408
|
|
|
409
|
m_vMapper->setFirst(0);
|
|
409
|
m_vMapper->setFirst(0);
|
|
410
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
410
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
411
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount));
|
|
411
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount));
|
|
412
|
|
|
412
|
|
|
413
|
m_vMapper->setCount(-1);
|
|
413
|
m_vMapper->setCount(-1);
|
|
414
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
414
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
415
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 3 * insertCount);
|
|
415
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 3 * insertCount);
|
|
416
|
}
|
|
416
|
}
|
|
417
|
|
|
417
|
|
|
@@
-419,39
+419,39
void tst_qbarmodelmapper::verticalModelRemoveRows()
|
|
419
|
{
|
|
419
|
{
|
|
420
|
// setup the mapper
|
|
420
|
// setup the mapper
|
|
421
|
createVerticalMapper();
|
|
421
|
createVerticalMapper();
|
|
422
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
422
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
423
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
423
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
424
|
QVERIFY(m_vMapper->model() != 0);
|
|
424
|
QVERIFY(m_vMapper->model() != 0);
|
|
425
|
|
|
425
|
|
|
426
|
int removeCount = 2;
|
|
426
|
int removeCount = 2;
|
|
427
|
m_model->removeRows(1, removeCount);
|
|
427
|
m_model->removeRows(1, removeCount);
|
|
428
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
428
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
429
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount);
|
|
429
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount);
|
|
430
|
|
|
430
|
|
|
431
|
int first = 1;
|
|
431
|
int first = 1;
|
|
432
|
m_vMapper->setFirst(first);
|
|
432
|
m_vMapper->setFirst(first);
|
|
433
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
433
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
434
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount - first);
|
|
434
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount - first);
|
|
435
|
|
|
435
|
|
|
436
|
m_model->removeRows(1, removeCount);
|
|
436
|
m_model->removeRows(1, removeCount);
|
|
437
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
437
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
438
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 2 * removeCount - first);
|
|
438
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 2 * removeCount - first);
|
|
439
|
|
|
439
|
|
|
440
|
int countLimit = 3;
|
|
440
|
int countLimit = 3;
|
|
441
|
m_vMapper->setCount(countLimit);
|
|
441
|
m_vMapper->setCount(countLimit);
|
|
442
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
442
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
443
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first));
|
|
443
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first));
|
|
444
|
|
|
444
|
|
|
445
|
m_model->removeRows(1, removeCount);
|
|
445
|
m_model->removeRows(1, removeCount);
|
|
446
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
446
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
447
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first));
|
|
447
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first));
|
|
448
|
|
|
448
|
|
|
449
|
m_vMapper->setFirst(0);
|
|
449
|
m_vMapper->setFirst(0);
|
|
450
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
450
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
451
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount));
|
|
451
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount));
|
|
452
|
|
|
452
|
|
|
453
|
m_vMapper->setCount(-1);
|
|
453
|
m_vMapper->setCount(-1);
|
|
454
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
454
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
455
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 3 * removeCount);
|
|
455
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 3 * removeCount);
|
|
456
|
}
|
|
456
|
}
|
|
457
|
|
|
457
|
|
|
@@
-459,13
+459,13
void tst_qbarmodelmapper::verticalModelInsertColumns()
|
|
459
|
{
|
|
459
|
{
|
|
460
|
// setup the mapper
|
|
460
|
// setup the mapper
|
|
461
|
createVerticalMapper();
|
|
461
|
createVerticalMapper();
|
|
462
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
462
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
463
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
463
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
464
|
QVERIFY(m_vMapper->model() != 0);
|
|
464
|
QVERIFY(m_vMapper->model() != 0);
|
|
465
|
|
|
465
|
|
|
466
|
int insertCount = 4;
|
|
466
|
int insertCount = 4;
|
|
467
|
m_model->insertColumns(3, insertCount);
|
|
467
|
m_model->insertColumns(3, insertCount);
|
|
468
|
QCOMPARE(m_series->barsetCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
468
|
QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
|
|
469
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
469
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
470
|
}
|
|
470
|
}
|
|
471
|
|
|
471
|
|
|
@@
-473,31
+473,31
void tst_qbarmodelmapper::verticalModelRemoveColumns()
|
|
473
|
{
|
|
473
|
{
|
|
474
|
// setup the mapper
|
|
474
|
// setup the mapper
|
|
475
|
createVerticalMapper();
|
|
475
|
createVerticalMapper();
|
|
476
|
QCOMPARE(m_series->barsetCount(), qMin(m_model->columnCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1));
|
|
476
|
QCOMPARE(m_series->count(), qMin(m_model->columnCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1));
|
|
477
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
477
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
478
|
QVERIFY(m_vMapper->model() != 0);
|
|
478
|
QVERIFY(m_vMapper->model() != 0);
|
|
479
|
|
|
479
|
|
|
480
|
int removeCount = m_modelColumnCount - 2;
|
|
480
|
int removeCount = m_modelColumnCount - 2;
|
|
481
|
m_model->removeColumns(0, removeCount);
|
|
481
|
m_model->removeColumns(0, removeCount);
|
|
482
|
QCOMPARE(m_series->barsetCount(), qMin(m_model->columnCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1));
|
|
482
|
QCOMPARE(m_series->count(), qMin(m_model->columnCount(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1));
|
|
483
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
483
|
QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
|
|
484
|
|
|
484
|
|
|
485
|
// leave all the columns
|
|
485
|
// leave all the columns
|
|
486
|
m_model->removeColumns(0, m_modelColumnCount - removeCount);
|
|
486
|
m_model->removeColumns(0, m_modelColumnCount - removeCount);
|
|
487
|
QCOMPARE(m_series->barsetCount(), 0);
|
|
487
|
QCOMPARE(m_series->count(), 0);
|
|
488
|
}
|
|
488
|
}
|
|
489
|
|
|
489
|
|
|
490
|
void tst_qbarmodelmapper::horizontalModelInsertRows()
|
|
490
|
void tst_qbarmodelmapper::horizontalModelInsertRows()
|
|
491
|
{
|
|
491
|
{
|
|
492
|
// setup the mapper
|
|
492
|
// setup the mapper
|
|
493
|
createHorizontalMapper();
|
|
493
|
createHorizontalMapper();
|
|
494
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
494
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
495
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
495
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
496
|
QVERIFY(m_hMapper->model() != 0);
|
|
496
|
QVERIFY(m_hMapper->model() != 0);
|
|
497
|
|
|
497
|
|
|
498
|
int insertCount = 4;
|
|
498
|
int insertCount = 4;
|
|
499
|
m_model->insertRows(3, insertCount);
|
|
499
|
m_model->insertRows(3, insertCount);
|
|
500
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
500
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
501
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
501
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
502
|
}
|
|
502
|
}
|
|
503
|
|
|
503
|
|
|
@@
-505,57
+505,57
void tst_qbarmodelmapper::horizontalModelRemoveRows()
|
|
505
|
{
|
|
505
|
{
|
|
506
|
// setup the mapper
|
|
506
|
// setup the mapper
|
|
507
|
createHorizontalMapper();
|
|
507
|
createHorizontalMapper();
|
|
508
|
QCOMPARE(m_series->barsetCount(), qMin(m_model->rowCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1));
|
|
508
|
QCOMPARE(m_series->count(), qMin(m_model->rowCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1));
|
|
509
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
509
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
510
|
QVERIFY(m_hMapper->model() != 0);
|
|
510
|
QVERIFY(m_hMapper->model() != 0);
|
|
511
|
|
|
511
|
|
|
512
|
int removeCount = m_modelRowCount - 2;
|
|
512
|
int removeCount = m_modelRowCount - 2;
|
|
513
|
m_model->removeRows(0, removeCount);
|
|
513
|
m_model->removeRows(0, removeCount);
|
|
514
|
QCOMPARE(m_series->barsetCount(), qMin(m_model->rowCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1));
|
|
514
|
QCOMPARE(m_series->count(), qMin(m_model->rowCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1));
|
|
515
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
515
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
516
|
|
|
516
|
|
|
517
|
// leave all the columns
|
|
517
|
// leave all the columns
|
|
518
|
m_model->removeRows(0, m_modelRowCount - removeCount);
|
|
518
|
m_model->removeRows(0, m_modelRowCount - removeCount);
|
|
519
|
QCOMPARE(m_series->barsetCount(), 0);
|
|
519
|
QCOMPARE(m_series->count(), 0);
|
|
520
|
}
|
|
520
|
}
|
|
521
|
|
|
521
|
|
|
522
|
void tst_qbarmodelmapper::horizontalModelInsertColumns()
|
|
522
|
void tst_qbarmodelmapper::horizontalModelInsertColumns()
|
|
523
|
{
|
|
523
|
{
|
|
524
|
// setup the mapper
|
|
524
|
// setup the mapper
|
|
525
|
createHorizontalMapper();
|
|
525
|
createHorizontalMapper();
|
|
526
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
526
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
527
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
527
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
528
|
QVERIFY(m_hMapper->model() != 0);
|
|
528
|
QVERIFY(m_hMapper->model() != 0);
|
|
529
|
|
|
529
|
|
|
530
|
int insertCount = 4;
|
|
530
|
int insertCount = 4;
|
|
531
|
m_model->insertColumns(3, insertCount);
|
|
531
|
m_model->insertColumns(3, insertCount);
|
|
532
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
532
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
533
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount);
|
|
533
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount);
|
|
534
|
|
|
534
|
|
|
535
|
int first = 3;
|
|
535
|
int first = 3;
|
|
536
|
m_hMapper->setFirst(3);
|
|
536
|
m_hMapper->setFirst(3);
|
|
537
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
537
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
538
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount - first);
|
|
538
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount - first);
|
|
539
|
|
|
539
|
|
|
540
|
m_model->insertColumns(3, insertCount);
|
|
540
|
m_model->insertColumns(3, insertCount);
|
|
541
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
541
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
542
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 2 * insertCount - first);
|
|
542
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 2 * insertCount - first);
|
|
543
|
|
|
543
|
|
|
544
|
int countLimit = 6;
|
|
544
|
int countLimit = 6;
|
|
545
|
m_hMapper->setCount(countLimit);
|
|
545
|
m_hMapper->setCount(countLimit);
|
|
546
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
546
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
547
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first));
|
|
547
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first));
|
|
548
|
|
|
548
|
|
|
549
|
m_model->insertColumns(3, insertCount);
|
|
549
|
m_model->insertColumns(3, insertCount);
|
|
550
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
550
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
551
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first));
|
|
551
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first));
|
|
552
|
|
|
552
|
|
|
553
|
m_hMapper->setFirst(0);
|
|
553
|
m_hMapper->setFirst(0);
|
|
554
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
554
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
555
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount));
|
|
555
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount));
|
|
556
|
|
|
556
|
|
|
557
|
m_hMapper->setCount(-1);
|
|
557
|
m_hMapper->setCount(-1);
|
|
558
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
558
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
559
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 3 * insertCount);
|
|
559
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 3 * insertCount);
|
|
560
|
}
|
|
560
|
}
|
|
561
|
|
|
561
|
|
|
@@
-563,39
+563,39
void tst_qbarmodelmapper::horizontalModelRemoveColumns()
|
|
563
|
{
|
|
563
|
{
|
|
564
|
// setup the mapper
|
|
564
|
// setup the mapper
|
|
565
|
createHorizontalMapper();
|
|
565
|
createHorizontalMapper();
|
|
566
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
566
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
567
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
567
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
|
|
568
|
QVERIFY(m_hMapper->model() != 0);
|
|
568
|
QVERIFY(m_hMapper->model() != 0);
|
|
569
|
|
|
569
|
|
|
570
|
int removeCount = 2;
|
|
570
|
int removeCount = 2;
|
|
571
|
m_model->removeColumns(1, removeCount);
|
|
571
|
m_model->removeColumns(1, removeCount);
|
|
572
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
572
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
573
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount);
|
|
573
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount);
|
|
574
|
|
|
574
|
|
|
575
|
int first = 1;
|
|
575
|
int first = 1;
|
|
576
|
m_hMapper->setFirst(first);
|
|
576
|
m_hMapper->setFirst(first);
|
|
577
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
577
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
578
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount - first);
|
|
578
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount - first);
|
|
579
|
|
|
579
|
|
|
580
|
m_model->removeColumns(1, removeCount);
|
|
580
|
m_model->removeColumns(1, removeCount);
|
|
581
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
581
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
582
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 2 * removeCount - first);
|
|
582
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 2 * removeCount - first);
|
|
583
|
|
|
583
|
|
|
584
|
int countLimit = 3;
|
|
584
|
int countLimit = 3;
|
|
585
|
m_hMapper->setCount(countLimit);
|
|
585
|
m_hMapper->setCount(countLimit);
|
|
586
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
586
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
587
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first));
|
|
587
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first));
|
|
588
|
|
|
588
|
|
|
589
|
m_model->removeColumns(1, removeCount);
|
|
589
|
m_model->removeColumns(1, removeCount);
|
|
590
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
590
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
591
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first));
|
|
591
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first));
|
|
592
|
|
|
592
|
|
|
593
|
m_hMapper->setFirst(0);
|
|
593
|
m_hMapper->setFirst(0);
|
|
594
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
594
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
595
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount));
|
|
595
|
QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount));
|
|
596
|
|
|
596
|
|
|
597
|
m_hMapper->setCount(-1);
|
|
597
|
m_hMapper->setCount(-1);
|
|
598
|
QCOMPARE(m_series->barsetCount(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
598
|
QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
|
|
599
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 3 * removeCount);
|
|
599
|
QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 3 * removeCount);
|
|
600
|
}
|
|
600
|
}
|
|
601
|
|
|
601
|
|