Ahmad Samir 3b95bfe7c7 QString/QByteArray: add nullTerminate{,d}()
As requested in code review.

utf16() guarantees that the string will always be \0-terminated which
could mean allocating behind the scenes. On the other hand
nullTerminate{,d}() makes it obvious that the data may be deep-copied.

For QByteArray, this partially reverts
e0206fe9d47bfbf18a0d4c2e5e780504305f72e7. Adding the same method to
QByteArray was requested in code review for API symmetry.

[ChangeLog][QtCore][QString] Added nullTerminate() and nullTerminated()
methods (like chop() and chopped()), which are useful for strings
constructed with fromRawData() when calling methods that expect
\0-terminated strings.

[ChangeLog][QtCore][QByteArray] Added nullTerminate() and
nullTerminated() methods, which are useful for byte arrays constructed
with fromRawData() when calling methods that expect \0-terminated data.

Change-Id: Iec33b889a9ab62460b7a0df8f9b2189f3f794a54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-01-22 19:11:10 +02:00
..
2024-11-05 14:36:16 +01:00
2023-04-13 18:30:58 +02:00

This directory contains autotests and benchmarks based on Qt Test. In order
to run the autotests reliably, you need to configure a desktop to match the
test environment that these tests are written for.

Linux X11:

   * The user must be logged in to an active desktop; you can't run the
     autotests without a valid DISPLAY that allows X11 connections.

   * The tests are run against a KDE3 or KDE4 desktop.

   * Window manager uses "click to focus", and not "focus follows mouse". Many
     tests move the mouse cursor around and expect this to not affect focus
     and activation.

   * Disable "click to activate", i.e., when a window is opened, the window
     manager should automatically activate it (give it input focus) and not
     wait for the user to click the window.