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

Method processExamples

test/symbol_set_t.cpp:1076–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1074}
1075
1076void SymbolSetTool::processExamples()
1077{
1078 QFETCH(QString, name);
1079 QFETCH(QString, id);
1080
1081 QString source_filename = QString::fromLatin1("src/%1.xmap").arg(name);
1082 QVERIFY(examples_dir.exists(source_filename));
1083
1084 QString source_path = examples_dir.absoluteFilePath(source_filename);
1085
1086 Map map;
1087 MapView view{ &map };
1088 map.loadFrom(source_path, &view);
1089
1090 const int num_symbols = map.getNumSymbols();
1091 QStringList previous_numbers;
1092 for (int i = 0; i < num_symbols; ++i)
1093 {
1094 const Symbol* symbol = map.getSymbol(i);
1095 QString number = symbol->getNumberAsString();
1096 QString number_and_name = number + QLatin1Char(' ') % symbol->getPlainTextName();
1097 QVERIFY2(!symbol->getName().isEmpty(), qPrintable(number_and_name + QLatin1String(": Name is empty")));
1098 QVERIFY2(!previous_numbers.contains(number), qPrintable(number_and_name + QLatin1String(": Number is not unique")));
1099 previous_numbers.append(number);
1100 QVERIFY2(symbol->validate(), qPrintable(number_and_name + QLatin1String(": Symbol validation failed")));
1101 }
1102
1103 map.setSymbolSetId(id);
1104 map.undoManager().clear();
1105 saveIfDifferent(source_path, &map, &view);
1106
1107 QString target_filename = QString::fromLatin1("%1.omap").arg(name);
1108 saveIfDifferent(examples_dir.absoluteFilePath(target_filename), &map, &view);
1109}
1110
1111
1112void SymbolSetTool::processTestData_data()

Callers

nothing calls this directly

Calls 12

QLatin1StringClass · 0.85
saveIfDifferentFunction · 0.85
getNumSymbolsMethod · 0.80
getNumberAsStringMethod · 0.80
getPlainTextNameMethod · 0.80
setSymbolSetIdMethod · 0.80
loadFromMethod · 0.45
getSymbolMethod · 0.45
isEmptyMethod · 0.45
containsMethod · 0.45
validateMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected