Fix QCOMPARE with enum classes.
As these are strongly typed, they won't implicitly convert to int, so make sure
to cast explicitly.
(cherry picked from commit 9626baaea9, auto test
is not included)
Task-number: QTBUG-49597
Change-Id: I29c4331a9b0c61f2e60c2bcab5a99f65daa7060f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
parent
adc4894fca
commit
4a4b17805c
|
|
@ -238,7 +238,7 @@ namespace QTest
|
|||
inline typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, char*>::Type toString(T e)
|
||||
{
|
||||
QMetaEnum me = QMetaEnum::fromType<T>();
|
||||
return qstrdup(me.key(e));
|
||||
return qstrdup(me.key(int(e))); // int cast is necessary to support enum classes
|
||||
}
|
||||
|
||||
template <typename T> // Fallback
|
||||
|
|
|
|||
Loading…
Reference in New Issue