| 1074 | } |
| 1075 | |
| 1076 | void 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 | |
| 1112 | void SymbolSetTool::processTestData_data() |
nothing calls this directly
no test coverage detected