diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-11-02 14:17:12 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-11-09 08:51:21 +0000 |
commit | 8469e317c9c02bc9760a69ecadb79f396a541eb8 (patch) | |
tree | f640379bc065daa8dcf876cf4eb0e311ed8db188 /src/plugins/cppeditor/cppuseselections_test.cpp | |
parent | 3d939458408d0d61d8f9b05e9b5caec4bc7a6c1b (diff) | |
download | qt-creator-8469e317c9c02bc9760a69ecadb79f396a541eb8.tar.gz |
Utils: Adjust column numbers affected by convertPosition change
convertPosition change was introduced in 931ec39f64a.
It changed 0-based column to 1-based which is how it
naturally is in Qt Creator.
This fixed some usages but broke many more. This is an
attempt to fix the remaining use cases.
Fixes CppEditor auto-tests.
Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppuseselections_test.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppuseselections_test.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/cppeditor/cppuseselections_test.cpp b/src/plugins/cppeditor/cppuseselections_test.cpp index 8de8048a89..99674b2e3c 100644 --- a/src/plugins/cppeditor/cppuseselections_test.cpp +++ b/src/plugins/cppeditor/cppuseselections_test.cpp @@ -31,6 +31,7 @@ #include <QElapsedTimer> #include <QtTest> +// Uses 1-based line and 0-based column. struct Selection { Selection(int line, int column, int length) : line(line), column(column), length(length) {} int line; @@ -116,7 +117,7 @@ SelectionList UseSelectionsTestCase::toSelectionList( int line, column; const int position = qMin(selection.cursor.position(), selection.cursor.anchor()); m_editorWidget->convertPosition(position, &line, &column); - result << Selection(line, column, selection.cursor.selectedText().length()); + result << Selection(line, column - 1, selection.cursor.selectedText().length()); } return result; } |