From 2491ee98b10d0ea2bb33f341b2efa478c50904b2 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 29 Apr 2020 14:11:39 +0200 Subject: QTest::ignoreMessage(): interpret the message in UTF-8 The message to ignore is given in source code, hence UTF-8; it was being ingested as local 8-bit, which lead to problems when a debug message wasn't 7-bit clean and the system's native encoding wasn't UTF-8. Modified QtTest's selftest to check encoding failure. Pick-to: 5.15 Change-Id: I898744a450115b6d2ee992f1d3b36d8efaeeff7e Reviewed-by: Qt CI Bot Reviewed-by: Thiago Macieira --- src/testlib/qtestlog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/testlib/qtestlog.cpp') diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index a388780532..be50176a08 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtTest module of the Qt Toolkit. @@ -521,7 +521,7 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg) { QTEST_ASSERT(msg); - QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg)); + QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromUtf8(msg)); } #if QT_CONFIG(regularexpression) -- cgit v1.2.3