From 38994ab9accc9aecf1139eb02f7e5fc75fccceec Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 19 Oct 2023 09:47:23 +0200 Subject: [PATCH] tst_QMetaEnum: add round-trip testing to valueToKeys() ... adding a bit of test coverage of keysToValue(). This is not intended as a reproducer for QTBUG-118240, because that is concerned with inputs valueToKeys() cannot produce. Task-number: QTBUG-118240 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I5d772be4231717cdbb5d033b1f11ae31e4c57c0b Reviewed-by: Friedemann Kleint --- tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp index 980830e9ba..b608fbf658 100644 --- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp +++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp @@ -73,6 +73,9 @@ void tst_QMetaEnum::valuesToKeys() QMetaEnum me = QMetaEnum::fromType(); QCOMPARE(me.valueToKeys(windowFlags), expected); + bool ok = false; + QCOMPARE(uint(me.keysToValue(expected, &ok)), windowFlags.toInt()); + QVERIFY(ok); } void tst_QMetaEnum::defaultConstructed()