summaryrefslogtreecommitdiffstats
path: root/tests/auto/quuid/tst_quuid.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@nokia.com>2011-05-27 13:34:28 +0200
committerSergio Ahumada <sergio.ahumada@nokia.com>2011-05-27 13:59:53 +0200
commit623c753a7b6a582e352acc5a0abbb7eb402af3b7 (patch)
tree03708ae6e5613acb571889e2dc0a8635e82885c8 /tests/auto/quuid/tst_quuid.cpp
parent8f4c007f85a4c16728281cb36f2f0f85b56c0999 (diff)
Add QUuid::toRfc4122() and fromRfc4122()
Following the RFC4122, provide the interfaces between QUuid and QByteArray, they are simpler then toByteArray() and relevant. Thanks for the suggestion and brief code from Robin Burchell. Task-number: QTBUG-19420 Reviewed-by: joao (cherry picked from commit 06873e467d98ad60d827afae29500bf2ff783c03) Change-Id: I4623ae3363f1d5affa45de73fac616bb67a9eaa1 Reviewed-on: http://codereview.qt.nokia.com/168 Reviewed-by: Liang Qi <liang.qi@nokia.com>
Diffstat (limited to 'tests/auto/quuid/tst_quuid.cpp')
-rw-r--r--tests/auto/quuid/tst_quuid.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp
index 3abc8af4c0..4948312fd4 100644
--- a/tests/auto/quuid/tst_quuid.cpp
+++ b/tests/auto/quuid/tst_quuid.cpp
@@ -65,6 +65,8 @@ private slots:
void fromString();
void toByteArray();
void fromByteArray();
+ void toRfc4122();
+ void fromRfc4122();
void check_QDataStream();
void isNull();
void equal();
@@ -147,6 +149,20 @@ void tst_QUuid::fromByteArray()
QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
}
+void tst_QUuid::toRfc4122()
+{
+ QCOMPARE(uuidA.toRfc4122(), QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5"));
+
+ QCOMPARE(uuidB.toRfc4122(), QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b"));
+}
+
+void tst_QUuid::fromRfc4122()
+{
+ QCOMPARE(uuidA, QUuid::fromRfc4122(QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5")));
+
+ QCOMPARE(uuidB, QUuid::fromRfc4122(QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b")));
+}
+
void tst_QUuid::check_QDataStream()
{
QUuid tmp;