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 <thiago.macieira@intel.com>
This commit is contained in:
Ivan Solovev 2025-04-24 17:43:57 +02:00
parent 01eb9297d0
commit f12115e97c

View File

@ -276,7 +276,7 @@ private:
QString m_previousCurrent;
};
static int NColorRoles[] = {
static constexpr int NColorRoles[] = {
QPalette::NoRole, // No Version
QPalette::NoRole, // Qt_1_0
QPalette::HighlightedText + 1, // Qt_2_0
@ -300,9 +300,11 @@ static int NColorRoles[] = {
QPalette::PlaceholderText + 1, // Qt_6_0
QPalette::Accent + 1, // Qt_6_6
QPalette::Accent + 1, // Qt_6_7
0 // add the correct value for Qt_5_14 here later
};
// +1, because we start from "No Version"
static_assert(std::size(NColorRoles) == QDataStream::Qt_DefaultCompiledVersion + 1);
// Testing get/set functions
void tst_QDataStream::getSetCheck()
{