Changeset View
Changeset View
Standalone View
Standalone View
plugins/grepview/tests/test_findreplace.cpp
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Line(s) | 156 | { | |||
---|---|---|---|---|---|
157 | QFile file(dir.filePath(fileData.first)); | 157 | QFile file(dir.filePath(fileData.first)); | ||
158 | QVERIFY(file.open(QIODevice::WriteOnly)); | 158 | QVERIFY(file.open(QIODevice::WriteOnly)); | ||
159 | QVERIFY(file.write(fileData.second.toUtf8()) != -1); | 159 | QVERIFY(file.write(fileData.second.toUtf8()) != -1); | ||
160 | file.close(); | 160 | file.close(); | ||
161 | } | 161 | } | ||
162 | 162 | | |||
163 | GrepJob *job = new GrepJob(this); | 163 | GrepJob *job = new GrepJob(this); | ||
164 | GrepOutputModel *model = new GrepOutputModel(job); | 164 | GrepOutputModel *model = new GrepOutputModel(job); | ||
165 | GrepJobSettings settings; | ||||
165 | 166 | | |||
166 | job->setOutputModel(model); | 167 | job->setOutputModel(model); | ||
167 | job->setPatternString(searchPattern); | | |||
168 | job->setTemplateString(searchTemplate); | | |||
169 | job->setReplacementTemplateString(replaceTemplate); | | |||
170 | job->setFilesString(QStringLiteral("*")); | | |||
171 | job->setExcludeString(QString()); | | |||
172 | job->setDirectoryChoice(QList<QUrl>() << QUrl::fromLocalFile(dir.path())); | 168 | job->setDirectoryChoice(QList<QUrl>() << QUrl::fromLocalFile(dir.path())); | ||
173 | job->setDepth(-1); // fully recursive | 169 | | ||
174 | job->setRegexpFlag(true); | 170 | settings.projectFilesOnly = false; | ||
175 | job->setCaseSensitive(true); | 171 | settings.caseSensitive = true; | ||
176 | job->setProjectFilesFlag(false); | 172 | settings.regexp = true; | ||
173 | settings.depth = -1; // fully recursive | ||||
174 | settings.pattern = searchPattern; | ||||
175 | settings.searchTemplate = searchTemplate; | ||||
176 | settings.replacementTemplate = replaceTemplate; | ||||
177 | settings.files = QStringLiteral("*"); | ||||
178 | settings.exclude = QString(); | ||||
179 | | ||||
180 | job->setSettings(settings); | ||||
181 | | ||||
177 | QVERIFY(job->exec()); | 182 | QVERIFY(job->exec()); | ||
178 | 183 | | |||
179 | QVERIFY(model->hasResults()); | 184 | QVERIFY(model->hasResults()); | ||
180 | model->setReplacement(replace); | 185 | model->setReplacement(replace); | ||
181 | model->makeItemsCheckable(true); | 186 | model->makeItemsCheckable(true); | ||
182 | model->doReplacements(); | 187 | model->doReplacements(); | ||
183 | 188 | | |||
184 | foreach(const File& fileData, result) | 189 | foreach(const File& fileData, result) | ||
Show All 11 Lines |