| 232 | } |
| 233 | |
| 234 | TestBreakpointModel::ReloadMode TestBreakpointModel::applyReloadModeAndReload(const QUrl& url, IDocument* doc, |
| 235 | Breakpoint* b1) |
| 236 | { |
| 237 | QFETCH(const ReloadMode, reloadMode); |
| 238 | if (reloadMode != ReloadMode::Clean) { |
| 239 | const auto* const textDoc = doc->textDocument(); |
| 240 | QString text; |
| 241 | if (reloadMode == ReloadMode::DirtyBreakpointLine) { |
| 242 | // Modify text on a breakpoint's line to prevent KTextEditor from restoring the breakpoint's mark when |
| 243 | // the document is reloaded. KDevelop must ensure the breakpoint mark is restored in this case too. |
| 244 | text = textDoc->text({{0, 0}, {b1->line(), 0}}); |
| 245 | text += textDoc->text({{b1->line(), 4}, textDoc->documentEnd()}); |
| 246 | } else { |
| 247 | // Remove several lines from the end of the document's file. |
| 248 | // This must not affect breakpoints above the removed lines. |
| 249 | text = textDoc->text({{0, 0}, {textDoc->lines() - 3, 0}}); |
| 250 | } |
| 251 | |
| 252 | overwriteExistingFile(url, text); |
| 253 | RETURN_IF_TEST_FAILED(reloadMode); |
| 254 | } |
| 255 | |
| 256 | doc->reload(); |
| 257 | return reloadMode; |
| 258 | } |
| 259 | |
| 260 | TestBreakpointModel::TestBreakpointModel(QObject* parent) |
| 261 | : QObject(parent) |
nothing calls this directly
no test coverage detected