From 0cc314e0ac5e0b4ea0957b3050ebd71982cc1f53 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Wed, 23 Oct 2002 02:35:47 +0000 Subject: [PATCH] Added some more checking, added a few BApplication objects because some Translators fail to work without them git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1609 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kits/translation/TranslatorRosterTest.cpp | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/tests/kits/translation/TranslatorRosterTest.cpp b/src/tests/kits/translation/TranslatorRosterTest.cpp index fc27bb1c13..549cd1de5b 100644 --- a/src/tests/kits/translation/TranslatorRosterTest.cpp +++ b/src/tests/kits/translation/TranslatorRosterTest.cpp @@ -57,7 +57,7 @@ TranslatorRosterTest::~TranslatorRosterTest() { CppUnit::Test* TranslatorRosterTest::Suite() { /* create our suite */ - CppUnit::TestSuite *suite = new CppUnit::TestSuite("TranslatorRosterTest Suite"); + CppUnit::TestSuite *suite = new CppUnit::TestSuite("TranslatorRoster"); /* add suckers */ suite->addTest(new CppUnit::TestCaller("TranslatorRosterTest::Initialize Test", &TranslatorRosterTest::InitializeTest)); @@ -361,6 +361,7 @@ void TranslatorRosterTest::GetTranslatorInfoTest() { * @return B_OK if everything went ok, B_ERROR if not */ void TranslatorRosterTest::GetTranslatorsTest() { + BApplication app("application/x-vnd.OpenBeOS-translationkit_translatorrostertest"); //open image to get a translator for BFile image("../src/tests/kits/translation/data/images/image.png", B_READ_ONLY); CPPUNIT_ASSERT(image.InitCheck() == B_OK); @@ -382,11 +383,11 @@ void TranslatorRosterTest::GetTranslatorsTest() { CPPUNIT_ASSERT(roster->GetTranslators(&garbled, NULL, &info, NULL) == B_BAD_VALUE); //get translator for garbled data - NextSubTest(); + NextSubTest(); CPPUNIT_ASSERT(roster->GetTranslators(&garbled, NULL, &info, &outCount) == B_NO_TRANSLATOR); //get translator for image - NextSubTest(); + NextSubTest(); CPPUNIT_ASSERT(roster->GetTranslators(&image, NULL, &info, &outCount) == B_OK); NextSubTest(); @@ -403,6 +404,7 @@ void TranslatorRosterTest::GetTranslatorsTest() { * @return B_OK if everything went ok, B_ERROR if not */ void TranslatorRosterTest::IdentifyTest() { + BApplication app("application/x-vnd.OpenBeOS-translationkit_translatorrostertest"); //open image to get a translator for BFile image("../src/tests/kits/translation/data/images/image.png", B_READ_ONLY); CPPUNIT_ASSERT(image.InitCheck() == B_OK); @@ -466,18 +468,31 @@ void TranslatorRosterTest::MakeConfigurationViewTest() { * @return B_OK if everything went ok, B_ERROR if not */ void TranslatorRosterTest::TranslateTest() { + BApplication app("application/x-vnd.OpenBeOS-translationkit_translatorrostertest"); //input + NextSubTest(); BFile input("../src/tests/kits/translation/data/images/image.jpg", B_READ_ONLY); + CPPUNIT_ASSERT(input.InitCheck() == B_OK); //temp file for generic format - BFile temp("/tmp/TranslatorRosterTest.temp", B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); + NextSubTest(); + BFile temp("/tmp/TranslatorRosterTest.temp", + B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); + CPPUNIT_ASSERT(temp.InitCheck() == B_OK); //output file - BFile output("../src/tests/kits/translation/data/images/image.out.png", B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); + NextSubTest(); + BFile output("../src/tests/kits/translation/data/images/image.out.png", + B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); + CPPUNIT_ASSERT(output.InitCheck() == B_OK); + //get default translators + NextSubTest(); roster = BTranslatorRoster::Default(); + CPPUNIT_ASSERT(roster != NULL); //translate to generic + NextSubTest(); CPPUNIT_ASSERT(roster->Translate(&input, NULL, NULL, &temp, B_TRANSLATOR_BITMAP) == B_OK); //translate to specific