summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@theqtcompany.com>2015-11-24 21:00:38 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2015-11-26 16:00:30 +0000
commit4a4b17805c976b40a404b48ba51984c9abdba633 (patch)
tree3d758dd052153bd1a48473b2a9364c55fad1f472 /src/testlib
parentadc4894fca0eeeb5a302009ca2bf597e80e28914 (diff)
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 9626baaea98edc13236250fc4b92d461b80e3875, auto test is not included) Task-number: QTBUG-49597 Change-Id: I29c4331a9b0c61f2e60c2bcab5a99f65daa7060f 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