From 13081fd7aed0c4bcfe2173046383bc6765fc2628 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Tue, 25 Jun 2019 12:34:05 +0200 Subject: Add test for checking 'required' mode of stream features Co-authored-by: Melvin Keskin --- tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp') diff --git a/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp b/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp index 4646d354..b658217e 100644 --- a/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp +++ b/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp @@ -30,6 +30,7 @@ class tst_QXmppStreamFeatures : public QObject private slots: void testEmpty(); + void testRequired(); void testFull(); }; @@ -44,11 +45,27 @@ void tst_QXmppStreamFeatures::testEmpty() QCOMPARE(features.nonSaslAuthMode(), QXmppStreamFeatures::Disabled); QCOMPARE(features.tlsMode(), QXmppStreamFeatures::Disabled); QCOMPARE(features.clientStateIndicationMode(), QXmppStreamFeatures::Disabled); + QCOMPARE(features.registerMode(), QXmppStreamFeatures::Disabled); QCOMPARE(features.authMechanisms(), QStringList()); QCOMPARE(features.compressionMethods(), QStringList()); serializePacket(features, xml); } +void tst_QXmppStreamFeatures::testRequired() +{ + const QByteArray xml( + "" + "" + "" + "" + ""); + + QXmppStreamFeatures features; + parsePacket(features, xml); + QCOMPARE(features.tlsMode(), QXmppStreamFeatures::Required); + serializePacket(features, xml); +} + void tst_QXmppStreamFeatures::testFull() { const QByteArray xml("" @@ -57,6 +74,7 @@ void tst_QXmppStreamFeatures::testFull() "" "" "" + "" "zlib" "PLAIN" ""); @@ -68,6 +86,7 @@ void tst_QXmppStreamFeatures::testFull() QCOMPARE(features.nonSaslAuthMode(), QXmppStreamFeatures::Enabled); QCOMPARE(features.tlsMode(), QXmppStreamFeatures::Enabled); QCOMPARE(features.clientStateIndicationMode(), QXmppStreamFeatures::Enabled); + QCOMPARE(features.registerMode(), QXmppStreamFeatures::Enabled); QCOMPARE(features.authMechanisms(), QStringList() << "PLAIN"); QCOMPARE(features.compressionMethods(), QStringList() << "zlib"); serializePacket(features, xml); -- cgit v1.2.3