summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qoffsetstringarray
diff options
context:
space:
mode:
authorMikhail Svetkin <mikhail.svetkin@qt.io>2018-08-28 15:56:09 +0200
committerMikhail Svetkin <mikhail.svetkin@qt.io>2018-08-28 14:42:46 +0000
commit6b4e603c62c71593cadb69fee4cf6e6f4555f7d7 (patch)
treeafaf9259c2846c408d24b6ddb9838de088e20763 /tests/auto/corelib/tools/qoffsetstringarray
parentfde0adc3c791f47fff88fbc4c5128e344f307466 (diff)
corelib/tools: Fix auto detection of QOffsetStringArray::m_offset type
The previous implementation wrongly calculated the necessary data type to hold the offset indexes. It looked at the amount of elements, but instead we should look at value for the last element in the offset array Change-Id: I84c6985dc3c329df3bbc5a14f9789170877b65bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qoffsetstringarray')
-rw-r--r--tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp b/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp
index 9174308a9a..dfa0450b18 100644
--- a/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp
+++ b/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp
@@ -81,6 +81,13 @@ constexpr const auto messages257 = qOffsetStringArray(
"", "", "", "", "", "", "end"
);
+constexpr const auto messagesBigOffsets = qOffsetStringArray(
+ " 10 20 30 40 50 60 70 80 90",
+ " 10 20 30 40 50 60 70 80 90",
+ " 10 20 30 40 50 60 70 80 90",
+ " 10 20 30 40 50 60 70 80 90"
+);
+
void tst_QOffsetStringArray::init()
{
static_assert(messages.sizeString == 51, "message.sizeString");
@@ -91,6 +98,11 @@ void tst_QOffsetStringArray::init()
static_assert(messages257.sizeString == 260, "messages257.sizeString");
static_assert(std::is_same<decltype(messages257)::Type, quint16>::value,
"messages257::Type != quint16");
+
+ static_assert(messagesBigOffsets.sizeOffsets == 4, "messagesBigOffsets.sizeOffsets");
+ static_assert(messagesBigOffsets.sizeString == 364, "messagesBigOffsets.sizeString");
+ static_assert(std::is_same<decltype(messagesBigOffsets)::Type, quint16>::value,
+ "messagesBigOffsets::Type != quint16");
}
void tst_QOffsetStringArray::access()