summaryrefslogtreecommitdiffstats
path: root/tests/auto/qbytearray
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-01-21 10:28:00 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-01-21 11:48:09 (GMT)
commit694be5a31be7e24761753ab9eccd87e8d08607e0 (patch)
treeacc4fcf9eba015cbbdd202775bd2230cf8af8e5f /tests/auto/qbytearray
parent967b6980372b3a3b988d2284bdd10b8154482680 (diff)
downloadQt-694be5a31be7e24761753ab9eccd87e8d08607e0.zip
Qt-694be5a31be7e24761753ab9eccd87e8d08607e0.tar.gz
Qt-694be5a31be7e24761753ab9eccd87e8d08607e0.tar.bz2
qUncompress: Fix terminating \0
Task-number: 6666 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'tests/auto/qbytearray')
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 35e4463..5c72c7a 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -76,6 +76,7 @@ private slots:
void qCompress();
void qUncompress_data();
void qUncompress();
+ void qCompressionZeroTermination();
#endif
void constByteArray();
void leftJustified();
@@ -261,6 +262,14 @@ void tst_QByteArray::qUncompress()
}
QCOMPARE(res, out);
}
+
+void tst_QByteArray::qCompressionZeroTermination()
+{
+ QString s = "Hello, I'm a string.";
+ QByteArray ba = ::qUncompress(::qCompress(s.toLocal8Bit()));
+ QVERIFY((int) *(ba.data() + ba.size()) == 0);
+}
+
#endif
void tst_QByteArray::constByteArray()