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

Method processSymbolSet

test/symbol_set_t.cpp:795–909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793}
794
795void SymbolSetTool::processSymbolSet()
796{
797 // On failure, we exit with translations_complete == false.
798 auto completeness = translations_complete;
799 translations_complete = false;
800
801 QFETCH(QString, name);
802 QFETCH(unsigned int, source_scale);
803 QFETCH(unsigned int, target_scale);
804
805 QString source_filename = QString::fromLatin1("src/%1_%2.xmap").arg(name, QString::number(source_scale));
806 QVERIFY(symbol_set_dir.exists(source_filename));
807
808 QString source_path = symbol_set_dir.absoluteFilePath(source_filename);
809
810 Map map;
811 MapView view{ &map };
812 map.loadFrom(source_path, &view);
813 QCOMPARE(map.getScaleDenominator(), source_scale);
814 QCOMPARE(map.getNumClosedTemplates(), 0);
815
816 auto id = map.symbolSetId();
817 QCOMPARE(id, name);
818
819 map.resetPrinterConfig();
820 map.undoManager().clear();
821 for (int i = 0; i < map.getNumColors(); ++i)
822 {
823 auto color = map.getMapColor(i);
824 if (color->getSpotColorMethod() == MapColor::CustomColor)
825 {
826 color->setCmykFromSpotColors();
827 color->setRgbFromSpotColors();
828 }
829 else
830 {
831 color->setRgbFromCmyk();
832 }
833 }
834 saveIfDifferent(source_path, &map, &view);
835
836 if (name == QLatin1String("ISSkiOM 2019"))
837 {
838 ISSkiOM_2019::mergeISOM(map, symbol_set_dir);
839 }
840
841 const int num_symbols = map.getNumSymbols();
842 QStringList previous_numbers;
843 for (int i = 0; i < num_symbols; ++i)
844 {
845 const Symbol* symbol = map.getSymbol(i);
846 QString number = symbol->getNumberAsString();
847 QString number_and_name = number + QLatin1Char(' ') % symbol->getPlainTextName();
848 QVERIFY2(!symbol->getName().isEmpty(), qPrintable(number_and_name + QLatin1String(": Name is empty")));
849 QVERIFY2(!previous_numbers.contains(number), qPrintable(number_and_name + QLatin1String(": Number is not unique")));
850 previous_numbers.append(number);
851 QVERIFY2(symbol->validate(), qPrintable(number_and_name + QLatin1String(": Symbol validation failed")));
852 if (symbol->getType() == Symbol::Line)

Callers

nothing calls this directly

Calls 15

saveIfDifferentFunction · 0.85
QLatin1StringClass · 0.85
mergeISOMFunction · 0.85
validLineWidthFunction · 0.85
processTranslationFunction · 0.85
checkOsmCrtFileFunction · 0.85
scaleFunction · 0.85
makeViewFunction · 0.85
resetPrinterConfigFunction · 0.85
getNumClosedTemplatesMethod · 0.80
symbolSetIdMethod · 0.80
resetPrinterConfigMethod · 0.80

Tested by

no test coverage detected