helpers: Refactor fromByteArray overloads and add tests
Clean up fromByteArray implementations across many overloads.
They now consistently leave the output value intact on failure.
For QByteArray and QString, always return true even if the input is
empty or null and leave the output value intact.
If we check the fromByteArray call in api-body.mustache:
{{cppCommonNamespace}}::fromByteArray(response, output);
response is the result of {{prefix}}HttpRequestWorker::parseResponse()
where the body is read using: result = reply.networkReply()->readAll().
An empty server response is a valid value that should not be treated
as a failure. In that case QIODevice::readAll() returns a null QBA,
because readBytes <= 0 triggers result.clear() before returning.
For qint32, qint64, float and double, introduce a local parsed variable
and assign only when ok is true.
For bool, return immediately in each branch and remove the local ok
variable.
Add tests for the refactored fromByteArray overloads and for QDate and
QDateTime overloads since they delegate to fromStrinValue().
The QDateTime tests also cover setDateTimeFormat() with a custom string
format and the Qt::TextDate enum.
Task-number: QTBUG-145232
Pick-to: 6.11
Change-Id: I62400493ad014404bb3282616b93077755752c32
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>