Skip to content

Commit f12115e

Browse files
committed
Cleanup tst_qdatastream
Make NColorRoles constexpr and use static_assert() to verify that it has a proper size. Pick-to: 6.9 6.8 Change-Id: I40351e4815e248fe8cc07e906099172d5be531d0 Reviewed-by: Thiago Macieira <[email protected]>
1 parent 01eb929 commit f12115e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private slots:
276276
QString m_previousCurrent;
277277
};
278278

279-
static int NColorRoles[] = {
279+
static constexpr int NColorRoles[] = {
280280
QPalette::NoRole, // No Version
281281
QPalette::NoRole, // Qt_1_0
282282
QPalette::HighlightedText + 1, // Qt_2_0
@@ -300,9 +300,11 @@ static int NColorRoles[] = {
300300
QPalette::PlaceholderText + 1, // Qt_6_0
301301
QPalette::Accent + 1, // Qt_6_6
302302
QPalette::Accent + 1, // Qt_6_7
303-
0 // add the correct value for Qt_5_14 here later
304303
};
305304

305+
// +1, because we start from "No Version"
306+
static_assert(std::size(NColorRoles) == QDataStream::Qt_DefaultCompiledVersion + 1);
307+
306308
// Testing get/set functions
307309
void tst_QDataStream::getSetCheck()
308310
{

0 commit comments

Comments
 (0)