Commit Graph

5 Commits

Author SHA1 Message Date
David Schulz
b2e30e7ef8 Utils: add Position::fromCursor with tests
Change-Id: I1cd989eaf7e75bc04f171989f9f9fe932402abef
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-17 12:53:22 +00:00
David Schulz
9758e71458 Utils: add tests for Position::fromPositionInDocument
Change-Id: I2b530cf62a4defe0292c51834b1e5093a7d5e55f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-16 10:30:15 +00:00
David Schulz
479d7e3732 Utils: remove duplicated test
Change-Id: I0391feb848af09295afd9d3e84e25337023c24b6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-16 08:55:21 +00:00
David Schulz
b4734ff727 Utils: add tests for Position::fromFileName
Change-Id: I321b91567e47e08883c7b991cd24d02bb8a9b9c6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-16 08:24:28 +00:00
David Schulz
1a98dda5c4 Utils: fix Text::Range length and remove mid
Those functions are based on the assumption that the passed text starts
at the begin position, which was good enough for search results, but if
used in other parts of the codebase it might give unwanted results.
Calculate the length of the range now as expected and subtract the
beginning lines.
In order to still got the correct results for the text result texts
modify the result range to always start at the first line before
calculating the length of the range.
Also add tests for the modified functionality

Change-Id: I7ccd75b642dda6dd4f738877cbe3543d46c03652
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-12 11:03:33 +00:00