Utils: Fix logic in TemplateEngine and adjust auto test

Broke with 8641277121.

Change-Id: I49174428bf940ef4c3fa7f6ebd3124a907a555b8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Christian Stenger
2016-08-02 07:40:28 +02:00
parent 734c348700
commit 6f963fd56e
2 changed files with 10 additions and 7 deletions

View File

@@ -139,6 +139,7 @@ bool PreprocessContext::process(const QString &in, QString *out, QString *errorM
const QChar newLine = QLatin1Char('\n');
const QStringList lines = in.split(newLine, QString::KeepEmptyParts);
const int lineCount = lines.size();
bool first = true;
for (int l = 0; l < lineCount; l++) {
// Check for element of the stack (be it dummy, else something is wrong).
if (m_sectionStack.isEmpty()) {
@@ -206,7 +207,9 @@ bool PreprocessContext::process(const QString &in, QString *out, QString *errorM
break;
case OtherSection: // Rest: Append according to current condition.
if (top.condition) {
if (l != 0)
if (first)
first = false;
else
out->append(newLine);
out->append(lines.at(l));
}