diff options
Diffstat (limited to 'Swiften/Elements/UnitTest/FormTest.cpp')
-rw-r--r-- | Swiften/Elements/UnitTest/FormTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Swiften/Elements/UnitTest/FormTest.cpp b/Swiften/Elements/UnitTest/FormTest.cpp index 3852d98..715111b 100644 --- a/Swiften/Elements/UnitTest/FormTest.cpp +++ b/Swiften/Elements/UnitTest/FormTest.cpp @@ -15,6 +15,8 @@ using namespace Swift; class FormTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(FormTest); CPPUNIT_TEST(testGetFormType); + CPPUNIT_TEST(testGetFormType_InvalidFormType); + CPPUNIT_TEST(testGetFormType_NoFormType); CPPUNIT_TEST_SUITE_END(); public: @@ -31,6 +33,24 @@ class FormTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(String("jabber:bot"), form.getFormType()); } + + void testGetFormType_InvalidFormType() { + Form form; + + FormField::ref field = FixedFormField::create("jabber:bot"); + field->setName("FORM_TYPE"); + form.addField(field); + + CPPUNIT_ASSERT_EQUAL(String(""), form.getFormType()); + } + + void testGetFormType_NoFormType() { + Form form; + + form.addField(FixedFormField::create("Foo")); + + CPPUNIT_ASSERT_EQUAL(String(""), form.getFormType()); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(FormTest); |