Hi,

is there any documentation, blog post, wiki page, other source or guideline 
about usage of string literals in autotests?

More specifically:

The line
QString ("I love QLatin1StringView");

...triggers 'QString' is deprecated: Use fromUtf8, QStringLiteral, or 
QLatin1StringView. QString has been explicitly marked deprecated here'

in qwindow.cpp, but not in tst_qwindow.cpp.

In gui autotests, only tst_QStandardItemModel uses the _L1 macro, in widgets 
only tst_QComboBox. "using namespace Qt::StringLiterals" can be found at the 
beginning of a test class, as well as at the beginning of a test function.
>From what I see, most test functions actually construct QString with a const 
>char*. Some use QStringLiteral locally, others use QLatin1StringView.

Since _L1 usage is massive in corelib, I wonder whether there is a standard 
that everyone can apply when writing or reviewing autotests. If it exists and I 
have overlooked it, please forgive my negligence and point me to it.


  *
What is the recommended way to construct a string in autotests?
  *
Where to place "using namespace"?
  *
Shall string constructions be fixed as a drive-by?

IMHO, clarifying these questions generally helps and expedites code reviews.
See 
https://codereview.qt-project.org/c/qt/qtbase/+/551645<https://codereview.qt-project.org/c/qt/qtbase/+/551645?forceReload=true>
 as a recent example.

Thanks, kind regards and happy Easter
Axel
-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to