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 <Friedemann.Kleint@qt.io>
This commit is contained in:
Marc Mutz 2023-10-19 09:47:23 +02:00
parent 5452972755
commit 38994ab9ac

View File

@ -73,6 +73,9 @@ void tst_QMetaEnum::valuesToKeys()
QMetaEnum me = QMetaEnum::fromType<Qt::WindowFlags>();
QCOMPARE(me.valueToKeys(windowFlags), expected);
bool ok = false;
QCOMPARE(uint(me.keysToValue(expected, &ok)), windowFlags.toInt());
QVERIFY(ok);
}
void tst_QMetaEnum::defaultConstructed()