@@ -60,72 +60,87 @@ void tst_QXmppJingleIq::testContent()
6060 const QByteArray xml (
6161 " <content creator=\" initiator\" name=\" voice\" >"
6262 " <description xmlns=\" urn:xmpp:jingle:apps:rtp:1\" media=\" audio\" >"
63- " <payload-type id=\" 96\" name=\" speex\" clockrate=\" 16000\" />"
64- " <payload-type id=\" 97\" name=\" speex\" clockrate=\" 8000\" />"
65- " <payload-type id=\" 18\" name=\" G729\" />"
66- " <payload-type id=\" 0\" name=\" PCMU\" />"
67- " <payload-type id=\" 103\" name=\" L16\" channels=\" 2\" clockrate=\" 16000\" />"
68- " <payload-type id=\" 98\" name=\" x-ISAC\" clockrate=\" 8000\" />"
63+ " <payload-type id=\" 96\" />"
64+ " <payload-type id=\" 97\" />"
6965 " </description>"
7066 " <transport xmlns=\" urn:xmpp:jingle:transports:ice-udp:1\" "
7167 " ufrag=\" 8hhy\" "
7268 " pwd=\" asd88fgpdd777uzjYhagZg\" >"
73- " <candidate component=\" 1\" "
74- " foundation=\" 1\" "
69+ " <candidate component=\" 0\" "
7570 " generation=\" 0\" "
7671 " id=\" el0747fg11\" "
77- " ip=\" 10.0.1.1\" "
78- " network=\" 1\" "
79- " port=\" 8998\" "
80- " priority=\" 2130706431\" "
81- " protocol=\" udp\" "
72+ " network=\" 0\" "
73+ " port=\" 0\" "
74+ " priority=\" 0\" "
8275 " type=\" host\" />"
83- " <candidate component=\" 1\" "
84- " foundation=\" 2\" "
76+ " <candidate component=\" 0\" "
8577 " generation=\" 0\" "
8678 " id=\" y3s2b30v3r\" "
87- " ip=\" 192.0.2.3\" "
88- " network=\" 1\" "
89- " port=\" 45664\" "
90- " priority=\" 1694498815\" "
91- " protocol=\" udp\" "
92- " type=\" srflx\" />"
79+ " network=\" 0\" "
80+ " port=\" 0\" "
81+ " priority=\" 0\" "
82+ " type=\" host\" />"
9383 " </transport>"
9484 " </content>" );
9585
96- QXmppJingleIq::Content content;
97- parsePacket (content, xml);
98-
99- QCOMPARE (content.creator (), QLatin1String (" initiator" ));
100- QCOMPARE (content.name (), QLatin1String (" voice" ));
101- QCOMPARE (content.descriptionMedia (), QLatin1String (" audio" ));
102- QCOMPARE (content.descriptionSsrc (), quint32 (0 ));
103- QCOMPARE (content.payloadTypes ().size (), 6 );
104- QCOMPARE (content.payloadTypes ()[0 ].id (), quint8 (96 ));
105- QCOMPARE (content.payloadTypes ()[1 ].id (), quint8 (97 ));
106- QCOMPARE (content.payloadTypes ()[2 ].id (), quint8 (18 ));
107- QCOMPARE (content.payloadTypes ()[3 ].id (), quint8 (0 ));
108- QCOMPARE (content.payloadTypes ()[4 ].id (), quint8 (103 ));
109- QCOMPARE (content.payloadTypes ()[5 ].id (), quint8 (98 ));
110- QCOMPARE (content.transportCandidates ().size (), 2 );
111- QCOMPARE (content.transportCandidates ()[0 ].component (), 1 );
112- QCOMPARE (content.transportCandidates ()[0 ].foundation (), QLatin1String (" 1" ));
113- QCOMPARE (content.transportCandidates ()[0 ].host (), QHostAddress (" 10.0.1.1" ));
114- QCOMPARE (content.transportCandidates ()[0 ].port (), quint16 (8998 ));
115- QCOMPARE (content.transportCandidates ()[0 ].priority (), 2130706431 );
116- QCOMPARE (content.transportCandidates ()[0 ].protocol (), QLatin1String (" udp" ));
117- QCOMPARE (content.transportCandidates ()[0 ].type (), QXmppJingleCandidate::HostType);
118- QCOMPARE (content.transportCandidates ()[1 ].component (), 1 );
119- QCOMPARE (content.transportCandidates ()[1 ].foundation (), QLatin1String (" 2" ));
120- QCOMPARE (content.transportCandidates ()[1 ].host (), QHostAddress (" 192.0.2.3" ));
121- QCOMPARE (content.transportCandidates ()[1 ].port (), quint16 (45664 ));
122- QCOMPARE (content.transportCandidates ()[1 ].priority (), 1694498815 );
123- QCOMPARE (content.transportCandidates ()[1 ].protocol (), QLatin1String (" udp" ));
124- QCOMPARE (content.transportCandidates ()[1 ].type (), QXmppJingleCandidate::ServerReflexiveType);
125- QCOMPARE (content.transportUser (), QLatin1String (" 8hhy" ));
126- QCOMPARE (content.transportPassword (), QLatin1String (" asd88fgpdd777uzjYhagZg" ));
127-
128- serializePacket (content, xml);
86+ QXmppJingleIq::Content content1;
87+ QVERIFY (content1.creator ().isEmpty ());
88+ QVERIFY (content1.name ().isEmpty ());
89+ QVERIFY (content1.descriptionMedia ().isEmpty ());
90+ QCOMPARE (content1.descriptionSsrc (), quint32 (0 ));
91+ QCOMPARE (content1.payloadTypes ().size (), 0 );
92+ QVERIFY (content1.transportUser ().isEmpty ());
93+ QVERIFY (content1.transportPassword ().isEmpty ());
94+ QCOMPARE (content1.transportCandidates ().size (), 0 );
95+ parsePacket (content1, xml);
96+
97+ QCOMPARE (content1.creator (), QStringLiteral (" initiator" ));
98+ QCOMPARE (content1.name (), QStringLiteral (" voice" ));
99+ QCOMPARE (content1.descriptionMedia (), QStringLiteral (" audio" ));
100+ QCOMPARE (content1.descriptionSsrc (), quint32 (0 ));
101+ QCOMPARE (content1.payloadTypes ().size (), 2 );
102+ QCOMPARE (content1.payloadTypes ().at (0 ).id (), quint8 (96 ));
103+ QCOMPARE (content1.payloadTypes ().at (1 ).id (), quint8 (97 ));
104+ QCOMPARE (content1.transportUser (), QStringLiteral (" 8hhy" ));
105+ QCOMPARE (content1.transportPassword (), QStringLiteral (" asd88fgpdd777uzjYhagZg" ));
106+ QCOMPARE (content1.transportCandidates ().size (), 2 );
107+ QCOMPARE (content1.transportCandidates ().at (0 ).id (), QStringLiteral (" el0747fg11" ));
108+ QCOMPARE (content1.transportCandidates ().at (1 ).id (), QStringLiteral (" y3s2b30v3r" ));
109+ serializePacket (content1, xml);
110+
111+ QXmppJingleIq::Content content2;
112+ content2.setCreator (QStringLiteral (" initiator" ));
113+ content2.setName (QStringLiteral (" voice" ));
114+ content2.setDescriptionMedia (QStringLiteral (" audio" ));
115+ content2.setDescriptionSsrc (quint32 (0 ));
116+ QXmppJinglePayloadType payloadType1;
117+ payloadType1.setId (quint8 (96 ));
118+ content2.setPayloadTypes ({ payloadType1 });
119+ QXmppJinglePayloadType payloadType2;
120+ payloadType2.setId (quint8 (97 ));
121+ content2.addPayloadType (payloadType2);
122+ content2.setTransportUser (QStringLiteral (" 8hhy" ));
123+ content2.setTransportPassword (QStringLiteral (" asd88fgpdd777uzjYhagZg" ));
124+ QXmppJingleCandidate transportCandidate1;
125+ transportCandidate1.setId (QStringLiteral (" el0747fg11" ));
126+ content2.setTransportCandidates ({ transportCandidate1 });
127+ QXmppJingleCandidate transportCandidate2;
128+ transportCandidate2.setId (QStringLiteral (" y3s2b30v3r" ));
129+ content2.addTransportCandidate (transportCandidate2);
130+
131+ QCOMPARE (content2.creator (), QStringLiteral (" initiator" ));
132+ QCOMPARE (content2.name (), QStringLiteral (" voice" ));
133+ QCOMPARE (content2.descriptionMedia (), QStringLiteral (" audio" ));
134+ QCOMPARE (content2.descriptionSsrc (), quint32 (0 ));
135+ QCOMPARE (content2.payloadTypes ().size (), 2 );
136+ QCOMPARE (content2.payloadTypes ().at (0 ).id (), quint8 (96 ));
137+ QCOMPARE (content2.payloadTypes ().at (1 ).id (), quint8 (97 ));
138+ QCOMPARE (content2.transportUser (), QStringLiteral (" 8hhy" ));
139+ QCOMPARE (content2.transportPassword (), QStringLiteral (" asd88fgpdd777uzjYhagZg" ));
140+ QCOMPARE (content2.transportCandidates ().size (), 2 );
141+ QCOMPARE (content2.transportCandidates ().at (0 ).id (), QStringLiteral (" el0747fg11" ));
142+ QCOMPARE (content2.transportCandidates ().at (1 ).id (), QStringLiteral (" y3s2b30v3r" ));
143+ serializePacket (content2, xml);
129144}
130145
131146void tst_QXmppJingleIq::testContentFingerprint ()
0 commit comments