/* * 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/Parser/PayloadParsers/SecurityLabelParser.h" #include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h" using namespace Swift; class SecurityLabelParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(SecurityLabelParserTest); CPPUNIT_TEST(testParse); CPPUNIT_TEST_SUITE_END(); public: SecurityLabelParserTest() {} void testParse() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse( "" "SECRET" "" "" "" "" "" "MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=" "" "")); SecurityLabel* payload = dynamic_cast(parser.getPayload().get()); CPPUNIT_ASSERT_EQUAL(std::string("SECRET"), payload->getDisplayMarking()); CPPUNIT_ASSERT_EQUAL(std::string("black"), payload->getForegroundColor()); CPPUNIT_ASSERT_EQUAL(std::string("red"), payload->getBackgroundColor()); CPPUNIT_ASSERT_EQUAL(std::string("MQYCAQQGASk="), payload->getLabel()); CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getEquivalentLabels()[0]); CPPUNIT_ASSERT_EQUAL(std::string("MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk="), payload->getEquivalentLabels()[1]); } }; CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelParserTest);