Changeset View
Changeset View
Standalone View
Standalone View
autotests/foldingtest.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 71 | if (indentationFoldEnabled != state.indentationBasedFoldingEnabled()) { | |||
---|---|---|---|---|---|
72 | indentationFoldEnabled = state.indentationBasedFoldingEnabled(); | 72 | indentationFoldEnabled = state.indentationBasedFoldingEnabled(); | ||
73 | if (indentationFoldEnabled) | 73 | if (indentationFoldEnabled) | ||
74 | m_out << "<indentfold>"; | 74 | m_out << "<indentfold>"; | ||
75 | else | 75 | else | ||
76 | m_out << "</indentfold>"; | 76 | m_out << "</indentfold>"; | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | int offset = 0; | 79 | int offset = 0; | ||
80 | foreach (const auto &fold, m_folds) { | 80 | for (const auto &fold : qAsConst(m_folds)) { | ||
81 | m_out << currentLine.mid(offset, fold.offset - offset); | 81 | m_out << currentLine.mid(offset, fold.offset - offset); | ||
82 | if (fold.region.type() == FoldingRegion::Begin) | 82 | if (fold.region.type() == FoldingRegion::Begin) | ||
83 | m_out << "<beginfold id='" << fold.region.id() << "'>"; | 83 | m_out << "<beginfold id='" << fold.region.id() << "'>"; | ||
84 | else | 84 | else | ||
85 | m_out << "<endfold id='" << fold.region.id() << "'>"; | 85 | m_out << "<endfold id='" << fold.region.id() << "'>"; | ||
86 | m_out << currentLine.mid(fold.offset, fold.length); | 86 | m_out << currentLine.mid(fold.offset, fold.length); | ||
87 | if (fold.region.type() == FoldingRegion::Begin) | 87 | if (fold.region.type() == FoldingRegion::Begin) | ||
88 | m_out << "</beginfold id='" << fold.region.id() << "'>"; | 88 | m_out << "</beginfold id='" << fold.region.id() << "'>"; | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 128 | private Q_SLOTS: | |||
134 | void testFolding_data() | 134 | void testFolding_data() | ||
135 | { | 135 | { | ||
136 | QTest::addColumn<QString>("inFile"); | 136 | QTest::addColumn<QString>("inFile"); | ||
137 | QTest::addColumn<QString>("outFile"); | 137 | QTest::addColumn<QString>("outFile"); | ||
138 | QTest::addColumn<QString>("refFile"); | 138 | QTest::addColumn<QString>("refFile"); | ||
139 | QTest::addColumn<QString>("syntax"); | 139 | QTest::addColumn<QString>("syntax"); | ||
140 | 140 | | |||
141 | const QDir dir(QStringLiteral(TESTSRCDIR "/input")); | 141 | const QDir dir(QStringLiteral(TESTSRCDIR "/input")); | ||
142 | foreach (const auto &fileName, dir.entryList(QDir::Files | QDir::NoSymLinks | QDir::Readable, QDir::Name)) { | 142 | for (const auto &fileName : dir.entryList(QDir::Files | QDir::NoSymLinks | QDir::Readable, QDir::Name)) { | ||
143 | const auto inFile = dir.absoluteFilePath(fileName); | 143 | const auto inFile = dir.absoluteFilePath(fileName); | ||
144 | if (inFile.endsWith(QLatin1String(".syntax"))) | 144 | if (inFile.endsWith(QLatin1String(".syntax"))) | ||
145 | continue; | 145 | continue; | ||
146 | 146 | | |||
147 | QString syntax; | 147 | QString syntax; | ||
148 | QFile syntaxOverride(inFile + QStringLiteral(".syntax")); | 148 | QFile syntaxOverride(inFile + QStringLiteral(".syntax")); | ||
149 | if (syntaxOverride.exists() && syntaxOverride.open(QFile::ReadOnly)) | 149 | if (syntaxOverride.exists() && syntaxOverride.open(QFile::ReadOnly)) | ||
150 | syntax = QString::fromUtf8(syntaxOverride.readAll()).trimmed(); | 150 | syntax = QString::fromUtf8(syntaxOverride.readAll()).trimmed(); | ||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |