MCPcopy Create free account
hub / github.com/KDE/labplot / statisticsMaskValues

Method statisticsMaskValues

tests/backend/Column/ColumnTest.cpp:506–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506void ColumnTest::statisticsMaskValues() {
507 Project project;
508 auto* c = new Column(QStringLiteral("Integer column"), Column::ColumnMode::Integer);
509 c->setIntegers({1, 2, 3});
510 project.addChild(c);
511
512 // check the statistics
513 auto& stats1 = c->statistics();
514 QCOMPARE(stats1.size, 3);
515 QCOMPARE(stats1.minimum, 1.);
516 QCOMPARE(stats1.maximum, 3.);
517
518 // mask the last value and check the statistics
519 c->setMasked(2);
520 auto& stats2 = c->statistics();
521 QCOMPARE(stats2.size, 2);
522 QCOMPARE(stats2.minimum, 1.);
523 QCOMPARE(stats2.maximum, 2.);
524
525 // undo the masking change and check the statistics
526 project.undoStack()->undo();
527 auto& stats3 = c->statistics();
528 QCOMPARE(stats3.size, 3);
529 QCOMPARE(stats3.minimum, 1.);
530 QCOMPARE(stats3.maximum, 3.);
531
532 // redo the masking change and check the statistics
533 project.undoStack()->redo();
534 auto& stats4 = c->statistics();
535 QCOMPARE(stats4.size, 2);
536 QCOMPARE(stats4.minimum, 1.);
537 QCOMPARE(stats4.maximum, 2.);
538}
539
540void ColumnTest::statisticsClearSpreadsheetMasks() {
541 Project project;

Callers

nothing calls this directly

Calls 7

setIntegersMethod · 0.80
statisticsMethod · 0.80
setMaskedMethod · 0.80
addChildMethod · 0.45
undoMethod · 0.45
undoStackMethod · 0.45
redoMethod · 0.45

Tested by

no test coverage detected