/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include #include #include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" using namespace Swift; class SecurityLabelSerializerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(SecurityLabelSerializerTest); CPPUNIT_TEST(testSerialize); CPPUNIT_TEST(testSerialize_EmptyLabel); CPPUNIT_TEST_SUITE_END(); public: void testSerialize() { SecurityLabelSerializer testling; boost::shared_ptr securityLabel(new SecurityLabel()); securityLabel->setDisplayMarking("SECRET"); securityLabel->setForegroundColor("black"); securityLabel->setBackgroundColor("red"); securityLabel->setLabel("MQYCAQQGASk="); securityLabel->addEquivalentLabel(""); securityLabel->addEquivalentLabel("MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk="); CPPUNIT_ASSERT_EQUAL(String( "" "SECRET" "" "" "" "" "" "MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=" "" ""), testling.serialize(securityLabel)); } void testSerialize_EmptyLabel() { SecurityLabelSerializer testling; boost::shared_ptr securityLabel(new SecurityLabel()); securityLabel->setDisplayMarking("SECRET"); securityLabel->setLabel(""); CPPUNIT_ASSERT_EQUAL(String( "" "SECRET" "" ""), testling.serialize(securityLabel)); } }; CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelSerializerTest);