1 #include "../common.h" 2 3 #include <Application.h> 4 #include <String.h> 5 #include <TextControl.h> 6 7 class TextControlTestcase: public TestCase { 8 public: 9 void 10 SizeTest() 11 { 12 CPPUNIT_ASSERT_EQUAL(312, sizeof(BTextControl)); 13 } 14 15 void 16 GetTextTest() 17 { 18 BApplication app("application/x-vnd.Haiku-interfacekit-textcontroltest"); 19 BRect textRect(0, 0, 100, 100); 20 BTextControl* v = new BTextControl(textRect, "test", 0, 0, 0); 21 v->SetText("Initial text"); 22 v->TextView()->Insert(8, "(inserted) ", 10); 23 CPPUNIT_ASSERT_EQUAL(BString("Initial (inserted)text"), v->Text()); 24 } 25 }; 26 27 28 Test* 29 TextControlTestSuite() 30 { 31 TestSuite *testSuite = new TestSuite(); 32 33 testSuite->addTest(new CppUnit::TestCaller<TextControlTestcase>( 34 "BTextControl_Size", &TextControlTestcase::SizeTest)); 35 testSuite->addTest(new CppUnit::TestCaller<TextControlTestcase>( 36 "BTextControl_GetText", &TextControlTestcase::GetTextTest)); 37 38 return testSuite; 39 } 40