summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-12-01 17:44:34 -0800
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2016-05-08 08:57:16 +0000
commit194a56ea79a4aa11a01dda0491427bb5ba4b37fd (patch)
tree3c15a26564ec0b8df88c9efd03c0211342be9fe3 /src
parent9ba296cc4cefaeb9d6c5abc2e0c0b272f2288733 (diff)
QTest: Fix printing of values of Q_ENUMs
QMetaEnum::key(n) returns the n-th key, which is not necessarily the one of value n. For the key of value n, we want QMetaEnum::valueToKey(n). Change-Id: Ic90fe6b1cbe84978a02fffff141bf4a06074917a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-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 9d79439e04..14ee0865eb 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(int(e))); // int cast is necessary to support enum classes
+ return qstrdup(me.valueToKey(int(e))); // int cast is necessary to support enum classes
}
template <typename T> // Fallback