Files
@ 34ec0df769f1
Branch filter:
Location: libtransport.git/src/tests/component.cpp - annotation
34ec0df769f1
2.4 KiB
text/x-c++hdr
avoid WTF-8.
what arrives from XMPP is already UTF-8 encoded, so applying UTF-8 again
produces somewhat unfortunate results.
this line is not always necessary. before this change, the code was
dependent on the locale.
what arrives from XMPP is already UTF-8 encoded, so applying UTF-8 again
produces somewhat unfortunate results.
this line is not always necessary. before this change, the code was
dependent on the locale.
dd11e43325de dd11e43325de dd11e43325de dd11e43325de dd11e43325de dd11e43325de dd11e43325de c86358c64f5f dd11e43325de dd11e43325de dd11e43325de dd11e43325de c86358c64f5f c86358c64f5f c86358c64f5f dd11e43325de 848f672b07e5 dd11e43325de 848f672b07e5 dd11e43325de 848f672b07e5 dd11e43325de c86358c64f5f 225a246407f7 dd11e43325de dd11e43325de dd11e43325de dd11e43325de 225a246407f7 225a246407f7 dd11e43325de 848f672b07e5 225a246407f7 225a246407f7 dd11e43325de dd11e43325de dd11e43325de 848f672b07e5 dd11e43325de dd11e43325de 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 c86358c64f5f 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 225a246407f7 c86358c64f5f c86358c64f5f c86358c64f5f c86358c64f5f dd11e43325de c86358c64f5f 225a246407f7 225a246407f7 225a246407f7 225a246407f7 dd11e43325de 225a246407f7 225a246407f7 dd11e43325de dd11e43325de dd11e43325de | #include "transport/userregistry.h"
#include "transport/config.h"
#include "transport/transport.h"
#include "transport/conversation.h"
#include "transport/localbuddy.h"
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <Swiften/Swiften.h>
#include <Swiften/EventLoop/DummyEventLoop.h>
#include <Swiften/Server/Server.h>
#include <Swiften/Network/DummyNetworkFactories.h>
#include <Swiften/Network/DummyConnectionServer.h>
#include "Swiften/Server/ServerStanzaChannel.h"
#include "Swiften/Server/ServerFromClientSession.h"
#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
#include "basictest.h"
using namespace Transport;
class ComponentTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
CPPUNIT_TEST_SUITE(ComponentTest);
CPPUNIT_TEST(handlePresenceWithNode);
CPPUNIT_TEST(handlePresenceWithoutNode);
CPPUNIT_TEST_SUITE_END();
public:
void setUp (void) {
onUserPresenceReceived = false;
onUserDiscoInfoReceived = false;
setMeUp();
component->onUserPresenceReceived.connect(boost::bind(&ComponentTest::handleUserPresenceReceived, this, _1));
component->onUserDiscoInfoReceived.connect(boost::bind(&ComponentTest::handleUserDiscoInfoReceived, this, _1, _2));
}
void tearDown (void) {
tearMeDown();
}
void handleUserDiscoInfoReceived(const Swift::JID& jid, boost::shared_ptr<Swift::DiscoInfo> info) {
onUserDiscoInfoReceived = true;
}
void handleUserPresenceReceived(Swift::Presence::ref presence) {
onUserPresenceReceived = true;
}
void handlePresenceWithNode() {
Swift::Presence::ref response = Swift::Presence::create();
response->setTo("somebody@localhost");
response->setFrom("user@localhost/resource");
dynamic_cast<Swift::ServerStanzaChannel *>(component->getStanzaChannel())->onPresenceReceived(response);
loop->processEvents();
CPPUNIT_ASSERT_EQUAL(0, (int) received.size());
}
void handlePresenceWithoutNode() {
Swift::Presence::ref response = Swift::Presence::create();
response->setTo("localhost");
response->setFrom("user@localhost/resource");
dynamic_cast<Swift::ServerStanzaChannel *>(component->getStanzaChannel())->onPresenceReceived(response);
loop->processEvents();
CPPUNIT_ASSERT(getStanza(received[0])->getPayload<Swift::DiscoInfo>());
CPPUNIT_ASSERT(onUserPresenceReceived);
}
private:
bool onUserPresenceReceived;
bool onUserDiscoInfoReceived;
};
CPPUNIT_TEST_SUITE_REGISTRATION (ComponentTest);
|