##// END OF EJS Templates
barsetCount -> count in tests and examples too
sauimone -
r1463:e1e0c05a814c
parent child
Show More
@@ -178,8 +178,8 void MainWidget::attachLegend()
178 178
179 179 void MainWidget::addBarset()
180 180 {
181 QBarSet *barSet = new QBarSet(QString("set ") + QString::number(m_series->barsetCount()));
182 qreal delta = m_series->barsetCount() * 0.1;
181 QBarSet *barSet = new QBarSet(QString("set ") + QString::number(m_series->count()));
182 qreal delta = m_series->count() * 0.1;
183 183 *barSet << QPointF(0.0 + delta, 1 + delta) << QPointF(1.0 + delta, 2 + delta) << QPointF(2.0 + delta, 3 + delta) << QPointF(3.0 + delta, 4 + delta);
184 184 m_series->append(barSet);
185 185 }
@@ -181,7 +181,7 void tst_qbarmodelmapper::verticalMapper()
181 181
182 182 m_chart->addSeries(m_series);
183 183
184 QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
184 QCOMPARE(m_series->count(), expectedBarSetCount);
185 185 QCOMPARE(mapper->firstBarSetColumn(), qMax(-1, firstBarSetColumn));
186 186 QCOMPARE(mapper->lastBarSetColumn(), qMax(-1, lastBarSetColumn));
187 187
@@ -216,7 +216,7 void tst_qbarmodelmapper::verticalMapperCustomMapping()
216 216
217 217 m_series = new QGroupedBarSeries;
218 218
219 QCOMPARE(m_series->barsetCount(), 0);
219 QCOMPARE(m_series->count(), 0);
220 220
221 221 QVBarModelMapper *mapper = new QVBarModelMapper;
222 222 mapper->setFirstBarSetColumn(0);
@@ -227,7 +227,7 void tst_qbarmodelmapper::verticalMapperCustomMapping()
227 227 mapper->setCount(countLimit);
228 228 m_chart->addSeries(m_series);
229 229
230 QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
230 QCOMPARE(m_series->count(), expectedBarSetCount);
231 231
232 232 if (expectedBarSetCount > 0)
233 233 QCOMPARE(m_series->barSets().first()->count(), expectedCount);
@@ -236,7 +236,7 void tst_qbarmodelmapper::verticalMapperCustomMapping()
236 236 mapper->setFirstBarSetColumn(-1);
237 237 mapper->setLastBarSetColumn(1);
238 238
239 QCOMPARE(m_series->barsetCount(), 0);
239 QCOMPARE(m_series->count(), 0);
240 240
241 241 delete mapper;
242 242 mapper = 0;
@@ -271,7 +271,7 void tst_qbarmodelmapper::horizontalMapper()
271 271
272 272 m_chart->addSeries(m_series);
273 273
274 QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
274 QCOMPARE(m_series->count(), expectedBarSetCount);
275 275 QCOMPARE(mapper->firstBarSetRow(), qMax(-1, firstBarSetRow));
276 276 QCOMPARE(mapper->lastBarSetRow(), qMax(-1, lastBarSetRow));
277 277
@@ -306,7 +306,7 void tst_qbarmodelmapper::horizontalMapperCustomMapping()
306 306
307 307 m_series = new QGroupedBarSeries;
308 308
309 QCOMPARE(m_series->barsetCount(), 0);
309 QCOMPARE(m_series->count(), 0);
310 310
311 311 QHBarModelMapper *mapper = new QHBarModelMapper;
312 312 mapper->setFirstBarSetRow(0);
@@ -317,7 +317,7 void tst_qbarmodelmapper::horizontalMapperCustomMapping()
317 317 mapper->setCount(countLimit);
318 318 m_chart->addSeries(m_series);
319 319
320 QCOMPARE(m_series->barsetCount(), expectedBarSetCount);
320 QCOMPARE(m_series->count(), expectedBarSetCount);
321 321
322 322 if (expectedBarSetCount > 0)
323 323 QCOMPARE(m_series->barSets().first()->count(), expectedCount);
@@ -326,7 +326,7 void tst_qbarmodelmapper::horizontalMapperCustomMapping()
326 326 mapper->setFirstBarSetRow(-1);
327 327 mapper->setLastBarSetRow(1);
328 328
329 QCOMPARE(m_series->barsetCount(), 0);
329 QCOMPARE(m_series->count(), 0);
330 330
331 331 delete mapper;
332 332 mapper = 0;
@@ -379,39 +379,39 void tst_qbarmodelmapper::verticalModelInsertRows()
379 379 {
380 380 // setup the mapper
381 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 383 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
384 384 QVERIFY(m_vMapper->model() != 0);
385 385
386 386 int insertCount = 4;
387 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 389 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount);
390 390
391 391 int first = 3;
392 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 394 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount - first);
395 395
396 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 398 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 2 * insertCount - first);
399 399
400 400 int countLimit = 6;
401 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 403 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first));
404 404
405 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 407 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first));
408 408
409 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 411 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount));
412 412
413 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 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 420 // setup the mapper
421 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 423 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
424 424 QVERIFY(m_vMapper->model() != 0);
425 425
426 426 int removeCount = 2;
427 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 429 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount);
430 430
431 431 int first = 1;
432 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 434 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount - first);
435 435
436 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 438 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 2 * removeCount - first);
439 439
440 440 int countLimit = 3;
441 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 443 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first));
444 444
445 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 447 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first));
448 448
449 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 451 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount));
452 452
453 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 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 460 // setup the mapper
461 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 463 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
464 464 QVERIFY(m_vMapper->model() != 0);
465 465
466 466 int insertCount = 4;
467 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 469 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
470 470 }
471 471
@@ -473,31 +473,31 void tst_qbarmodelmapper::verticalModelRemoveColumns()
473 473 {
474 474 // setup the mapper
475 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 477 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
478 478 QVERIFY(m_vMapper->model() != 0);
479 479
480 480 int removeCount = m_modelColumnCount - 2;
481 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 483 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
484 484
485 485 // leave all the columns
486 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 490 void tst_qbarmodelmapper::horizontalModelInsertRows()
491 491 {
492 492 // setup the mapper
493 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 495 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
496 496 QVERIFY(m_hMapper->model() != 0);
497 497
498 498 int insertCount = 4;
499 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 501 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
502 502 }
503 503
@@ -505,57 +505,57 void tst_qbarmodelmapper::horizontalModelRemoveRows()
505 505 {
506 506 // setup the mapper
507 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 509 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
510 510 QVERIFY(m_hMapper->model() != 0);
511 511
512 512 int removeCount = m_modelRowCount - 2;
513 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 515 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
516 516
517 517 // leave all the columns
518 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 522 void tst_qbarmodelmapper::horizontalModelInsertColumns()
523 523 {
524 524 // setup the mapper
525 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 527 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
528 528 QVERIFY(m_hMapper->model() != 0);
529 529
530 530 int insertCount = 4;
531 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 533 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount);
534 534
535 535 int first = 3;
536 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 538 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount - first);
539 539
540 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 542 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 2 * insertCount - first);
543 543
544 544 int countLimit = 6;
545 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 547 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first));
548 548
549 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 551 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first));
552 552
553 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 555 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount));
556 556
557 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 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 564 // setup the mapper
565 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 567 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount);
568 568 QVERIFY(m_hMapper->model() != 0);
569 569
570 570 int removeCount = 2;
571 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 573 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount);
574 574
575 575 int first = 1;
576 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 578 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount - first);
579 579
580 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 582 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 2 * removeCount - first);
583 583
584 584 int countLimit = 3;
585 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 587 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first));
588 588
589 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 591 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first));
592 592
593 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 595 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount));
596 596
597 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 599 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 3 * removeCount);
600 600 }
601 601
@@ -49,8 +49,8 private slots:
49 49 void remove();
50 50 void appendList_data();
51 51 void appendList();
52 void barsetCount_data();
53 void barsetCount();
52 void count_data();
53 void count();
54 54 void barSets_data();
55 55 void barSets();
56 56 void setLabelsVisible_data();
@@ -129,7 +129,7 void tst_QBarSeries::append_data()
129 129
130 130 void tst_QBarSeries::append()
131 131 {
132 QVERIFY(m_barseries->barsetCount() == 0);
132 QVERIFY(m_barseries->count() == 0);
133 133
134 134 bool ret = false;
135 135
@@ -138,24 +138,24 void tst_QBarSeries::append()
138 138 ret = m_barseries->append(barset);
139 139
140 140 QVERIFY(ret == true);
141 QVERIFY(m_barseries->barsetCount() == 1);
141 QVERIFY(m_barseries->count() == 1);
142 142
143 143 // Try adding another set
144 144 QBarSet *barset2 = new QBarSet("testset2");
145 145 ret = m_barseries->append(barset2);
146 146
147 147 QVERIFY(ret == true);
148 QVERIFY(m_barseries->barsetCount() == 2);
148 QVERIFY(m_barseries->count() == 2);
149 149
150 150 // Try adding same set again
151 151 ret = m_barseries->append(barset2);
152 152 QVERIFY(ret == false);
153 QVERIFY(m_barseries->barsetCount() == 2);
153 QVERIFY(m_barseries->count() == 2);
154 154
155 155 // Try adding null set
156 156 ret = m_barseries->append(0);
157 157 QVERIFY(ret == false);
158 QVERIFY(m_barseries->barsetCount() == 2);
158 QVERIFY(m_barseries->count() == 2);
159 159
160 160 }
161 161
@@ -166,18 +166,18 void tst_QBarSeries::remove_data()
166 166 void tst_QBarSeries::remove()
167 167 {
168 168 int count = m_testSets.count();
169 QVERIFY(m_barseries_with_sets->barsetCount() == count);
169 QVERIFY(m_barseries_with_sets->count() == count);
170 170
171 171 // Try to remove null pointer (should not remove, should not crash)
172 172 bool ret = false;
173 173 ret = m_barseries_with_sets->remove(0);
174 174 QVERIFY(ret == false);
175 QVERIFY(m_barseries_with_sets->barsetCount() == count);
175 QVERIFY(m_barseries_with_sets->count() == count);
176 176
177 177 // Try to remove invalid pointer (should not remove, should not crash)
178 178 ret = m_barseries_with_sets->remove((QBarSet*) (m_testSets.at(0) + 1) );
179 179 QVERIFY(ret == false);
180 QVERIFY(m_barseries_with_sets->barsetCount() == count);
180 QVERIFY(m_barseries_with_sets->count() == count);
181 181
182 182 // remove some sets
183 183 ret = m_barseries_with_sets->remove(m_testSets.at(2));
@@ -187,7 +187,7 void tst_QBarSeries::remove()
187 187 ret = m_barseries_with_sets->remove(m_testSets.at(4));
188 188 QVERIFY(ret == true);
189 189
190 QVERIFY(m_barseries_with_sets->barsetCount() == 2);
190 QVERIFY(m_barseries_with_sets->count() == 2);
191 191
192 192 QList<QBarSet*> verifysets = m_barseries_with_sets->barSets();
193 193
@@ -201,7 +201,7 void tst_QBarSeries::remove()
201 201 }
202 202
203 203 QVERIFY(ret == true);
204 QVERIFY(m_barseries_with_sets->barsetCount() == 0);
204 QVERIFY(m_barseries_with_sets->count() == 0);
205 205 }
206 206
207 207 void tst_QBarSeries::appendList_data()
@@ -212,7 +212,7 void tst_QBarSeries::appendList_data()
212 212 void tst_QBarSeries::appendList()
213 213 {
214 214 int count = 5;
215 QVERIFY(m_barseries->barsetCount() == 0);
215 QVERIFY(m_barseries->count() == 0);
216 216
217 217 QList<QBarSet*> sets;
218 218 for (int i=0; i<count; i++) {
@@ -223,25 +223,25 void tst_QBarSeries::appendList()
223 223 bool ret = false;
224 224 ret = m_barseries->append(sets);
225 225 QVERIFY(ret == true);
226 QVERIFY(m_barseries->barsetCount() == count);
226 QVERIFY(m_barseries->count() == count);
227 227
228 228 // Append same sets again (should fail, count should remain same)
229 229 ret = m_barseries->append(sets);
230 230 QVERIFY(ret == false);
231 QVERIFY(m_barseries->barsetCount() == count);
231 QVERIFY(m_barseries->count() == count);
232 232
233 233 // Try append empty list (should succeed, but count should remain same)
234 234 QList<QBarSet*> invalidList;
235 235 ret = m_barseries->append(invalidList);
236 236 QVERIFY(ret == true);
237 QVERIFY(m_barseries->barsetCount() == count);
237 QVERIFY(m_barseries->count() == count);
238 238
239 239 // Try append list with one new and one existing set (should fail, count remains same)
240 240 invalidList.append(new QBarSet("ok set"));
241 241 invalidList.append(sets.at(0));
242 242 ret = m_barseries->append(invalidList);
243 243 QVERIFY(ret == false);
244 QVERIFY(m_barseries->barsetCount() == count);
244 QVERIFY(m_barseries->count() == count);
245 245
246 246 // Try append list with null pointers (should fail, count remains same)
247 247 QList<QBarSet*> invalidList2;
@@ -250,18 +250,18 void tst_QBarSeries::appendList()
250 250 invalidList2.append(0);
251 251 ret = m_barseries->append(invalidList2);
252 252 QVERIFY(ret == false);
253 QVERIFY(m_barseries->barsetCount() == count);
253 QVERIFY(m_barseries->count() == count);
254 254 }
255 255
256 void tst_QBarSeries::barsetCount_data()
256 void tst_QBarSeries::count_data()
257 257 {
258 258
259 259 }
260 260
261 void tst_QBarSeries::barsetCount()
261 void tst_QBarSeries::count()
262 262 {
263 QVERIFY(m_barseries->barsetCount() == 0);
264 QVERIFY(m_barseries_with_sets->barsetCount() == m_testSets.count());
263 QVERIFY(m_barseries->count() == 0);
264 QVERIFY(m_barseries_with_sets->count() == m_testSets.count());
265 265 }
266 266
267 267 void tst_QBarSeries::barSets_data()
General Comments 0
You need to be logged in to leave comments. Login now