added constructor test where bitmap is passed, changed to use typedef when added tests to the suite to clean things up

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3347 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber 2003-05-27 00:30:11 +00:00
parent a476bfc5b1
commit 8ec8ccef8e

View File

@ -1,7 +1,7 @@
/*****************************************************************************/
// OpenBeOS Translation Kit Test
// Author: Brian Matzon <brian@matzon.dk>
// Version: 0.1.0
// Authors: Brian Matzon <brian@matzon.dk>, Michael Wilber
// Version:
//
// This is the Test application for BBitmapStream
//
@ -61,13 +61,23 @@ BitmapStreamTest::Suite()
{
/* create our suite */
CppUnit::TestSuite *suite = new CppUnit::TestSuite("BitmapStream");
typedef CppUnit::TestCaller<BitmapStreamTest> TC;
/* add suckers */
suite->addTest(new CppUnit::TestCaller<BitmapStreamTest>("BitmapStreamTest::Constructor Test", &BitmapStreamTest::ConstructorTest));
suite->addTest(new CppUnit::TestCaller<BitmapStreamTest>("BitmapStreamTest::DetachBitmap Test", &BitmapStreamTest::DetachBitmapTest));
suite->addTest(new CppUnit::TestCaller<BitmapStreamTest>("BitmapStreamTest::ReadWrite Test", &BitmapStreamTest::ReadWriteTest));
suite->addTest(new CppUnit::TestCaller<BitmapStreamTest>("BitmapStreamTest::Seek Test", &BitmapStreamTest::SeekTest));
suite->addTest(new CppUnit::TestCaller<BitmapStreamTest>("BitmapStreamTest::SetSize Test", &BitmapStreamTest::SetSizeTest));
/* add tests */
suite->addTest(new TC("BitmapStreamTest::Constructor Test",
&BitmapStreamTest::ConstructorTest));
suite->addTest(new TC("BitmapStreamTest::DetachBitmap Test",
&BitmapStreamTest::DetachBitmapTest));
suite->addTest(new TC("BitmapStreamTest::ReadWrite Test",
&BitmapStreamTest::ReadWriteTest));
suite->addTest(new TC("BitmapStreamTest::Seek Test",
&BitmapStreamTest::SeekTest));
suite->addTest(new TC("BitmapStreamTest::SetSize Test",
&BitmapStreamTest::SetSizeTest));
return suite;
}
@ -79,7 +89,10 @@ BitmapStreamTest::Suite()
void
BitmapStreamTest::ConstructorTest()
{
//BBitmapStream with a blank bitmap
BApplication
app("application/x-vnd.OpenBeOS-translationkit_bitmapstreamtest");
//BBitmapStream with no bitmap supplied
NextSubTest();
BBitmapStream streamEmpty;
BBitmap *pbits = NULL;
@ -88,7 +101,27 @@ BitmapStreamTest::ConstructorTest()
CPPUNIT_ASSERT(streamEmpty.DetachBitmap(&pbits) == B_ERROR);
CPPUNIT_ASSERT(pbits == NULL);
//constructor is created with a value in DetachBitmapTest()
//BBitmapStream with an empty BBitmap
NextSubTest();
pbits = new BBitmap(BRect(0,0,5,5), B_RGB32);
CPPUNIT_ASSERT(pbits);
BBitmapStream *pstreamWithBits;
pstreamWithBits = new BBitmapStream(pbits);
CPPUNIT_ASSERT(pstreamWithBits);
CPPUNIT_ASSERT(pstreamWithBits->Position() == 0);
CPPUNIT_ASSERT(pstreamWithBits->Size() == 176);
BBitmap *poutbits = NULL;
CPPUNIT_ASSERT(pstreamWithBits->DetachBitmap(&poutbits) == B_OK);
CPPUNIT_ASSERT(pbits == poutbits);
delete pstreamWithBits;
pstreamWithBits = NULL;
delete pbits;
pbits = NULL;
//constructor is also created with a value in DetachBitmapTest()
}
/**