summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@theqtcompany.com>2015-11-01 16:41:25 +0100
committerRobin Burchell <robin.burchell@viroteck.net>2015-11-06 11:40:15 +0000
commit9626baaea98edc13236250fc4b92d461b80e3875 (patch)
treea3db37f73fdca71e133c307672b06ad153d6f85d /src/testlib
parentd8f41bdc2efa36dd9e2f80e23d7cb4874c019452 (diff)
Fix QCOMPARE with enum classes.
As these are strongly typed, they won't implicitly convert to int, so make sure to cast explicitly. Change-Id: Ic8daa31c528bbd8f399ab401d0963e13db191312 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 7d2fd2e701..9d79439e04 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -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