MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / templateTableModelTest

Method templateTableModelTest

test/template_t.cpp:716–747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714 }
715
716 void templateTableModelTest()
717 {
718 Map map;
719 MapView view{ &map };
720 QVERIFY(map.loadFrom(QStringLiteral("testdata:templates/world-file.xmap"), &view));
721 QCOMPARE(map.getNumTemplates(), 1);
722
723 TemplateTableModel model(map, view);
724 QCOMPARE(model.rowCount(), 2);
725
726 // Single template, in background
727 QCOMPARE(map.getFirstFrontTemplate(), 1);
728 QCOMPARE(model.mapRow(map.getFirstFrontTemplate()), 0);
729 QCOMPARE(model.posFromRow(0), -1);
730 QCOMPARE(model.rowFromPos(0), 1);
731 QCOMPARE(model.posFromRow(1), 0);
732 // Three possible calls in onTemplateAboutToBeAdded
733 QCOMPARE(model.insertionRowFromPos(0, true), 2);
734 QCOMPARE(model.insertionRowFromPos(1, true), 1);
735 QCOMPARE(model.insertionRowFromPos(1, false), 0);
736
737 // Single template, in foreground
738 map.setFirstFrontTemplate(0);
739 QCOMPARE(model.mapRow(map.getFirstFrontTemplate()), 1);
740 QCOMPARE(model.posFromRow(1), -1);
741 QCOMPARE(model.rowFromPos(0), 0);
742 QCOMPARE(model.posFromRow(0), 0);
743 // Three possible calls in onTemplateAboutToBeAdded
744 QCOMPARE(model.insertionRowFromPos(0, true), 2);
745 QCOMPARE(model.insertionRowFromPos(0, false), 1);
746 QCOMPARE(model.insertionRowFromPos(1, false), 0);
747 }
748
749};
750

Callers

nothing calls this directly

Calls 9

getNumTemplatesMethod · 0.80
getFirstFrontTemplateMethod · 0.80
mapRowMethod · 0.80
insertionRowFromPosMethod · 0.80
setFirstFrontTemplateMethod · 0.80
loadFromMethod · 0.45
rowCountMethod · 0.45
posFromRowMethod · 0.45
rowFromPosMethod · 0.45

Tested by

no test coverage detected