summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qoffsetstringarray
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-09-29 19:08:15 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-11-03 14:54:37 -0700
commit2c2c6de85ae41d09063f3c68a42522e3d74ad8fa (patch)
tree50d56fbef5ed5c0b3dbcf3d35c9bbba93a758e5f /tests/auto/corelib/tools/qoffsetstringarray
parent95cc652e1afe7a6edd17cd251fc8ba1eb639eb4f (diff)
qlibraryinfo.cpp: use qOffsetStringArray for qtConfEntries
Beats a manual array with too wide strings. I thought even to simply replace this with a switch (loc)... it's not like this is performance-critical code, given it uses QString. Change-Id: I2bbf422288924c198645fffd16a977778ff8d52d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qoffsetstringarray')
-rw-r--r--tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp b/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp
index 0130939b4e..aecbe0b616 100644
--- a/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp
+++ b/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp
@@ -46,8 +46,7 @@ constexpr const auto messages = qOffsetStringArray(
"level - 1",
"level - 2",
"level - 3",
- "level - 4",
- ""
+ "level - 4"
);
constexpr const auto messages257 = qOffsetStringArray(
@@ -90,15 +89,15 @@ constexpr const auto messagesBigOffsets = qOffsetStringArray(
void tst_QOffsetStringArray::init()
{
- static_assert(messages.m_string.size() == 51);
+ static_assert(messages.m_string.size() == 50);
static_assert(messages.m_offsets.size() == 6);
static_assert(std::is_same_v<decltype(messages.m_offsets)::value_type, quint8>);
- static_assert(messages257.m_offsets.size() == 257);
+ static_assert(messages257.m_offsets.size() == 258);
static_assert(messages257.m_string.size() == 260);
static_assert(std::is_same_v<decltype(messages257.m_offsets)::value_type, quint16>);
- static_assert(messagesBigOffsets.m_offsets.size() == 4);
+ static_assert(messagesBigOffsets.m_offsets.size() == 5);
static_assert(messagesBigOffsets.m_string.size() == 364);
static_assert(std::is_same_v<decltype(messagesBigOffsets.m_offsets)::value_type, quint16>);
}
@@ -110,6 +109,7 @@ void tst_QOffsetStringArray::access()
QCOMPARE(messages[2], "level - 2");
QCOMPARE(messages[3], "level - 3");
QCOMPARE(messages[4], "level - 4");
+ // out of bounds returns empty strings:
QCOMPARE(messages[5], "");
QCOMPARE(messages[6], "");
}