From 1652396ece844718e3fcbfbc04a6f68bdb64e695 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 27 Aug 2020 16:07:26 +0200 Subject: [PATCH] CppTools: Fix CppSelectionChanger autotest ... on Windows. We need to open the test file in text mode. Otherwise the raw string literal will contain carriage returns. As these get dropped by QTextDocument, the offsets will be inconsistent with the ones reported by the tokens, causing the test to fail. Change-Id: I161a3f5791c33416ff732f90fd615cf39d8152ce Reviewed-by: Christian Stenger --- .../cppselectionchanger/tst_cppselectionchangertest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/cplusplus/cppselectionchanger/tst_cppselectionchangertest.cpp b/tests/auto/cplusplus/cppselectionchanger/tst_cppselectionchangertest.cpp index 45f713a88c5..6432e1d66b6 100644 --- a/tests/auto/cplusplus/cppselectionchanger/tst_cppselectionchangertest.cpp +++ b/tests/auto/cplusplus/cppselectionchanger/tst_cppselectionchangertest.cpp @@ -208,7 +208,7 @@ void tst_CppSelectionChanger::initTestCase() // Read cpp file contents into QTextDocument and CppTools::Document::Ptr. QString fileName(SRCDIR "/testCppFile.cpp"); QFile file(fileName); - file.open(QIODevice::ReadOnly); + file.open(QIODevice::ReadOnly | QIODevice::Text); QTextStream s(&file); cppFileString = s.readAll(); file.close();