added testing for translating from and to a MallocIO object (before it only translated from BFiles)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2307 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber 2002-12-28 03:27:05 +00:00
parent 2df68a7bf6
commit d138c6bb6c

View File

@ -270,7 +270,7 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster,
pinput_file = &styled_file;
}
BMallocIO mallio;
BMallocIO mallio, dmallio;
// Convert to B_TRANSLATOR_ANY_TYPE (should be B_TRANSLATOR_TEXT)
ptest->NextSubTest();
@ -288,6 +288,14 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster,
B_TRANSLATOR_TEXT) == B_OK);
CPPUNIT_ASSERT(CompareStreams(mallio, plain_file) == true);
// Convert plain mallio to B_TRANSLATOR_TEXT dmallio
ptest->NextSubTest();
CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0);
CPPUNIT_ASSERT(dmallio.SetSize(0) == B_OK);
CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio,
B_TRANSLATOR_TEXT) == B_OK);
CPPUNIT_ASSERT(CompareStreams(dmallio, plain_file) == true);
// Convert to B_STYLED_TEXT_FORMAT
ptest->NextSubTest();
CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0);
@ -295,6 +303,22 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster,
CPPUNIT_ASSERT(proster->Translate(pinput_file, NULL, NULL, &mallio,
B_STYLED_TEXT_FORMAT) == B_OK);
CPPUNIT_ASSERT(CompareStreams(mallio, styled_file) == true);
// Convert styled mallio to B_TRANSLATOR_TEXT dmallio
ptest->NextSubTest();
CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0);
CPPUNIT_ASSERT(dmallio.SetSize(0) == B_OK);
CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio,
B_TRANSLATOR_TEXT) == B_OK);
CPPUNIT_ASSERT(CompareStreams(dmallio, plain_file) == true);
// Convert styled mallio to B_STYLED_TEXT_FORMAT dmallio
ptest->NextSubTest();
CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0);
CPPUNIT_ASSERT(dmallio.SetSize(0) == B_OK);
CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio,
B_STYLED_TEXT_FORMAT) == B_OK);
CPPUNIT_ASSERT(CompareStreams(dmallio, styled_file) == true);
}
delete[] styled_path;