helpers: Fix QOAIEnum fromByteArray return value
The enum overload was returning true, even when the input was not
a recognized enum value. Change it to return value.isValid() so
callers know whether the input maps to a known enum value.
Unlike other overloads (QString, QByteArray, QDate, QDateTime, int,
bool, float), we cannot leave the output value intact when parsing
fails. QOAIEnum is abstract and fromJson() always writes to the object
directly, so there is no way to try parsing first and only commit on
success. This is acceptable because an invalid state is a valid state
for an enum: it means the string was not recognized, not that the
object is corrupted.
Add a minimal yaml spec with a TestEnum enum and use the generated
class in the added enum test.
Pick-to: 6.11
Task-number: QTBUG-145232
Change-Id: Ifd82e63a656aedf8666329f37200e56450bb6118
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>