added GetConfigurationMessage test
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3336 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -33,7 +33,11 @@ BMPTranslatorTest::Suite()
|
||||
|
||||
suite->addTest(
|
||||
new TC("BMPTranslator TranslateTest",
|
||||
&BMPTranslatorTest::TranslateTest));
|
||||
&BMPTranslatorTest::TranslateTest));
|
||||
|
||||
suite->addTest(
|
||||
new TC("BMPTranslator ConfigMessageTest",
|
||||
&BMPTranslatorTest::ConfigMessageTest));
|
||||
|
||||
#if !TEST_R5
|
||||
suite->addTest(
|
||||
@@ -1019,6 +1023,37 @@ BMPTranslatorTest::TranslateTest()
|
||||
proster = NULL;
|
||||
}
|
||||
|
||||
// Make certain that the BMPTranslator does not
|
||||
// provide a configuration message
|
||||
void
|
||||
BMPTranslatorTest::ConfigMessageTest()
|
||||
{
|
||||
// Init
|
||||
NextSubTest();
|
||||
status_t result = B_ERROR;
|
||||
BTranslatorRoster *proster = new BTranslatorRoster();
|
||||
CPPUNIT_ASSERT(proster);
|
||||
CPPUNIT_ASSERT(proster->AddTranslators(
|
||||
"/boot/home/config/add-ons/Translators/BMPTranslator") == B_OK);
|
||||
|
||||
// GetAllTranslators
|
||||
NextSubTest();
|
||||
translator_id tid, *pids = NULL;
|
||||
int32 count = 0;
|
||||
CPPUNIT_ASSERT(proster->GetAllTranslators(&pids, &count) == B_OK);
|
||||
CPPUNIT_ASSERT(pids);
|
||||
CPPUNIT_ASSERT(count == 1);
|
||||
tid = pids[0];
|
||||
delete[] pids;
|
||||
pids = NULL;
|
||||
|
||||
// GetConfigurationMessage
|
||||
NextSubTest();
|
||||
BMessage msg;
|
||||
CPPUNIT_ASSERT(proster->GetConfigurationMessage(tid, &msg) == B_ERROR);
|
||||
CPPUNIT_ASSERT(msg.IsEmpty());
|
||||
}
|
||||
|
||||
#if !TEST_R5
|
||||
|
||||
// The input formats that this translator is supposed to support
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
#endif
|
||||
void IdentifyTest();
|
||||
void TranslateTest();
|
||||
void ConfigMessageTest();
|
||||
};
|
||||
|
||||
#endif // BMP_TRANSLATOR_TEST_H
|
||||
|
||||
@@ -60,7 +60,11 @@ TGATranslatorTest::Suite()
|
||||
|
||||
suite->addTest(
|
||||
new TC("TGATranslator TranslateTest",
|
||||
&TGATranslatorTest::TranslateTest));
|
||||
&TGATranslatorTest::TranslateTest));
|
||||
|
||||
suite->addTest(
|
||||
new TC("TGATranslator ConfigMessageTest",
|
||||
&TGATranslatorTest::ConfigMessageTest));
|
||||
|
||||
#if !TEST_R5
|
||||
suite->addTest(
|
||||
@@ -500,6 +504,57 @@ TGATranslatorTest::TranslateTest()
|
||||
proster = NULL;
|
||||
}
|
||||
|
||||
// Make certain the TGATranslator
|
||||
// provides a valid configuration message
|
||||
void
|
||||
TGATranslatorTest::ConfigMessageTest()
|
||||
{
|
||||
// Init
|
||||
NextSubTest();
|
||||
status_t result = B_ERROR;
|
||||
BTranslatorRoster *proster = new BTranslatorRoster();
|
||||
CPPUNIT_ASSERT(proster);
|
||||
CPPUNIT_ASSERT(proster->AddTranslators(
|
||||
"/boot/home/config/add-ons/Translators/TGATranslator") == B_OK);
|
||||
|
||||
// GetAllTranslators
|
||||
NextSubTest();
|
||||
translator_id tid, *pids = NULL;
|
||||
int32 count = 0;
|
||||
CPPUNIT_ASSERT(proster->GetAllTranslators(&pids, &count) == B_OK);
|
||||
CPPUNIT_ASSERT(pids);
|
||||
CPPUNIT_ASSERT(count == 1);
|
||||
tid = pids[0];
|
||||
delete[] pids;
|
||||
pids = NULL;
|
||||
|
||||
// GetConfigurationMessage
|
||||
NextSubTest();
|
||||
BMessage msg;
|
||||
CPPUNIT_ASSERT(proster->GetConfigurationMessage(tid, &msg) == B_OK);
|
||||
CPPUNIT_ASSERT(!msg.IsEmpty());
|
||||
|
||||
// B_TRANSLATOR_EXT_HEADER_ONLY
|
||||
NextSubTest();
|
||||
bool bheaderonly = true;
|
||||
CPPUNIT_ASSERT(
|
||||
msg.FindBool(B_TRANSLATOR_EXT_HEADER_ONLY, &bheaderonly) == B_OK);
|
||||
CPPUNIT_ASSERT(bheaderonly == false);
|
||||
|
||||
// B_TRANSLATOR_EXT_DATA_ONLY
|
||||
NextSubTest();
|
||||
bool bdataonly = true;
|
||||
CPPUNIT_ASSERT(
|
||||
msg.FindBool(B_TRANSLATOR_EXT_DATA_ONLY, &bdataonly) == B_OK);
|
||||
CPPUNIT_ASSERT(bdataonly == false);
|
||||
|
||||
// "tga /rle"
|
||||
NextSubTest();
|
||||
bool brle;
|
||||
CPPUNIT_ASSERT(msg.FindBool("tga /rle", &brle) == B_OK);
|
||||
CPPUNIT_ASSERT(brle == true || brle == false);
|
||||
}
|
||||
|
||||
#if !TEST_R5
|
||||
|
||||
// The input formats that this translator is supposed to support
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
#endif
|
||||
void IdentifyTest();
|
||||
void TranslateTest();
|
||||
void ConfigMessageTest();
|
||||
};
|
||||
|
||||
#endif // TGA_TRANSLATOR_TEST_H
|
||||
|
||||
Reference in New Issue
Block a user