Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interface Kit tests: add test for BTextControl.
* Only tests very basic functionality, and size of the class, which must not change for BeOS compatibility. * Also add "manual" test for disabled and invalid controls (just check it looks right)
- Loading branch information
1 parent
a8f520f
commit 48ea56b
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "../common.h" | ||
|
||
#include <Application.h> | ||
#include <String.h> | ||
#include <TextControl.h> | ||
|
||
class TextControlTestcase: public TestCase { | ||
public: | ||
void | ||
SizeTest() | ||
{ | ||
CPPUNIT_ASSERT_EQUAL(312, sizeof(BTextControl)); | ||
} | ||
|
||
void | ||
GetTextTest() | ||
{ | ||
BApplication app("application/x-vnd.Haiku-interfacekit-textcontroltest"); | ||
BRect textRect(0, 0, 100, 100); | ||
BTextControl* v = new BTextControl(textRect, "test", 0, 0, 0); | ||
v->SetText("Initial text"); | ||
v->TextView()->Insert(8, "(inserted) ", 10); | ||
CPPUNIT_ASSERT_EQUAL(BString("Initial (inserted)text"), v->Text()); | ||
} | ||
}; | ||
|
||
|
||
Test* | ||
TextControlTestSuite() | ||
{ | ||
TestSuite *testSuite = new TestSuite(); | ||
|
||
testSuite->addTest(new CppUnit::TestCaller<TextControlTestcase>( | ||
"BTextControl_Size", &TextControlTestcase::SizeTest)); | ||
testSuite->addTest(new CppUnit::TestCaller<TextControlTestcase>( | ||
"BTextControl_GetText", &TextControlTestcase::GetTextTest)); | ||
|
||
return testSuite; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _text_control_test_h_ | ||
#define _text_control_test_h_ | ||
|
||
class CppUnit::Test; | ||
|
||
CppUnit::Test *TextControlTestSuite(); | ||
|
||
#endif // text_control_test_h_ | ||
|
||
|