summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qdebug
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-07-26 13:55:19 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-11 07:59:15 +0000
commit1c623bc6d1c0a7ca52d81ca72c64f36898b3e12c (patch)
tree1a8d9ff271d8b752fc5eaadcea3e48021692970e /tests/auto/corelib/io/qdebug
parent8f58e1319c064fbdf5ec00a2b261c9d8069c6cfb (diff)
Fix QMetaObject naming of class enum flag
Adds an enumName to QMetaEnum to carry the name of the enum since for flags that doesn't match the name of the Qt type, but is needed if the flag is scoped. Change-Id: I1c0f77eb9e40e6fd1eb6a59bea77caf0f33fcf43 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/io/qdebug')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index b43ea7cfa5..7b8b1df166 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -38,6 +38,13 @@
class tst_QDebug: public QObject
{
Q_OBJECT
+public:
+ enum EnumType { EnumValue1 = 1, EnumValue2 = 2 };
+ enum FlagType { EnumFlag1 = 1, EnumFlag2 = 2 };
+ Q_ENUM(EnumType)
+ Q_DECLARE_FLAGS(Flags, FlagType)
+ Q_FLAG(Flags)
+
private slots:
void assignment() const;
void warningWithoutDebug() const;
@@ -637,6 +644,15 @@ void tst_QDebug::qDebugQFlags() const
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
+ // Test the output of QFlags with an enum not declared with Q_DECLARE_FLAGS and Q_FLAGS
+ QFlags<EnumType> flags2(EnumValue2);
+ qDebug() << flags2;
+ QCOMPARE(s_msg, QString::fromLatin1("QFlags<tst_QDebug::EnumType>(EnumValue2)"));
+
+ // A now for one that was fully declared
+ tst_QDebug::Flags flags3(EnumFlag1);
+ qDebug() << flags3;
+ QCOMPARE(s_msg, QString::fromLatin1("QFlags<tst_QDebug::FlagType>(EnumFlag1)"));
}
void tst_QDebug::textStreamModifiers() const