Ticket #7161: tests-translators.patch

File tests-translators.patch, 19.1 KB (added by Karvjorm, 14 years ago)

An updated RAWTranslatorTest for the RAWTranslator Add-Ons (added to Suite).

  • src/tests/add-ons/translators/TranslatorTestAddOn.cpp

     
    1212#include "stxttranslator/STXTTranslatorTest.h"
    1313#include "tgatranslator/TGATranslatorTest.h"
    1414#include "tifftranslator/TIFFTranslatorTest.h"
     15#include "rawtranslator/RAWTranslatorTest.h"
    1516
    1617BTestSuite *
    1718getTestSuite()
     
    2425    suite->addTest("STXTTranslator", STXTTranslatorTest::Suite());
    2526    suite->addTest("TGATranslator", TGATranslatorTest::Suite());
    2627    suite->addTest("TIFFTranslator", TIFFTranslatorTest::Suite());
     28    suite->addTest("RAWTranslator", RAWTranslatorTest::Suite());
    2729
    2830    return suite;
    2931}
  • src/tests/add-ons/translators/rawtranslator/RAWTranslatorTest.cpp

     
     1// RAWTranslatorTest.cpp
     2#include "RAWTranslatorTest.h"
     3#include "RAWTranslator.h"
     4
     5#include <cppunit/Test.h>
     6#include <cppunit/TestCaller.h>
     7#include <cppunit/TestSuite.h>
     8#include <stdio.h>
     9#include <string.h>
     10#include <unistd.h>
     11#include <image.h>
     12
     13#include <DataIO.h>
     14#include <Errors.h>
     15#include <File.h>
     16#include <Message.h>
     17#include <OS.h>
     18#include <Rect.h>
     19#include <Translator.h>
     20#include <TranslatorFormats.h>
     21#include <TranslatorRoster.h>
     22#include <View.h>
     23
     24#include "TranslatorTestAddOn.h"
     25
     26// Suite
     27CppUnit::Test *
     28RAWTranslatorTest::Suite()
     29{
     30    CppUnit::TestSuite *suite = new CppUnit::TestSuite();
     31    typedef CppUnit::TestCaller<RAWTranslatorTest> TC;
     32           
     33    suite->addTest(
     34        new TC("RAWTranslator IdentifyTest",
     35            &RAWTranslatorTest::IdentifyTest));
     36
     37    suite->addTest(
     38        new TC("RAWTranslator TranslateTest",
     39            &RAWTranslatorTest::TranslateTest));   
     40
     41#if !TEST_R5
     42    suite->addTest(
     43        new TC("RAWTranslator LoadAddOnTest",
     44            &RAWTranslatorTest::LoadAddOnTest));
     45#endif
     46       
     47    return suite;
     48}       
     49
     50// setUp
     51void
     52RAWTranslatorTest::setUp()
     53{
     54    BTestCase::setUp();
     55}
     56   
     57// tearDown
     58void
     59RAWTranslatorTest::tearDown()
     60{
     61    BTestCase::tearDown();
     62}
     63
     64void
     65CheckBits_Raw(translator_info *pti)
     66{
     67    CheckTranslatorInfo(pti, B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP,
     68        0.7f, 0.6f, "Be Bitmap Format (RAWTranslator)",
     69        "image/x-be-bitmap");
     70}
     71
     72void
     73CheckRaw(translator_info *pti, const char *imageType)
     74{
     75    CheckTranslatorInfo(pti, RAW_IMAGE_FORMAT, B_TRANSLATOR_BITMAP,
     76        0.7f, 0.6f, imageType, "image/rcw");
     77}
     78
     79// coveniently group path of image with
     80// the expected Identify() string for that image
     81struct IdentifyInfo {
     82    const char *imagePath;
     83    const char *identifyString;
     84};
     85
     86void
     87IdentifyTests(RAWTranslatorTest *ptest, BTranslatorRoster *proster,
     88    const IdentifyInfo *pinfo, int32 len, bool bbits)
     89{
     90    translator_info ti;
     91    printf(" [%d] ", (int) bbits);
     92   
     93    for (int32 i = 0; i < len; i++) {
     94        ptest->NextSubTest();
     95        BFile file;
     96        printf(" [%s] ", pinfo[i].imagePath);
     97        CPPUNIT_ASSERT(file.SetTo(pinfo[i].imagePath, B_READ_ONLY) == B_OK);
     98
     99        // Identify (output: B_TRANSLATOR_ANY_TYPE)
     100        ptest->NextSubTest();
     101        memset(&ti, 0, sizeof(translator_info));
     102        CPPUNIT_ASSERT(proster->Identify(&file, NULL, &ti) == B_OK);
     103        if (bbits)
     104            CheckBits_Raw(&ti);
     105        else
     106            CheckRaw(&ti, pinfo[i].identifyString);
     107   
     108        // Identify (output: B_TRANSLATOR_BITMAP)
     109        ptest->NextSubTest();
     110        memset(&ti, 0, sizeof(translator_info));
     111        CPPUNIT_ASSERT(proster->Identify(&file, NULL, &ti, 0, NULL,
     112            B_TRANSLATOR_BITMAP) == B_OK);
     113        if (bbits)
     114            CheckBits_Raw(&ti);
     115        else
     116            CheckRaw(&ti, pinfo[i].identifyString);
     117   
     118        // Identify (output: RAW_IMAGE_FORMAT)
     119        ptest->NextSubTest();
     120        memset(&ti, 0, sizeof(translator_info));
     121        CPPUNIT_ASSERT(proster->Identify(&file, NULL, &ti, 0, NULL,
     122            RAW_IMAGE_FORMAT) == B_OK);
     123        if (bbits)
     124            CheckBits_Raw(&ti);
     125        else
     126            CheckRaw(&ti, pinfo[i].identifyString);
     127    }
     128}
     129
     130void
     131RAWTranslatorTest::IdentifyTest()
     132{
     133    // Init
     134    NextSubTest();
     135    status_t result = B_ERROR;
     136    BTranslatorRoster *proster = new BTranslatorRoster();
     137    CPPUNIT_ASSERT(proster);
     138    CPPUNIT_ASSERT(proster->AddTranslators(
     139        "/boot/home/config/add-ons/Translators/RAWTranslator") == B_OK);
     140    BFile wronginput("../src/tests/kits/translation/data/images/image.jpg",
     141        B_READ_ONLY);
     142    CPPUNIT_ASSERT(wronginput.InitCheck() == B_OK);
     143       
     144    // Identify (bad input, output types)
     145    NextSubTest();
     146    translator_info ti;
     147    memset(&ti, 0, sizeof(translator_info));
     148    result = proster->Identify(&wronginput, NULL, &ti, 0,
     149        NULL, B_TRANSLATOR_TEXT);
     150    CPPUNIT_ASSERT(result == B_NO_TRANSLATOR);
     151    CPPUNIT_ASSERT(ti.type == 0 && ti.translator == 0);
     152   
     153    // Identify (wrong type of input data)
     154    NextSubTest();
     155    memset(&ti, 0, sizeof(translator_info));
     156    result = proster->Identify(&wronginput, NULL, &ti);
     157    CPPUNIT_ASSERT(result == B_NO_TRANSLATOR);
     158    CPPUNIT_ASSERT(ti.type == 0 && ti.translator == 0);
     159   
     160    // Identify (successfully identify the following files)
     161    const IdentifyInfo aBitsPaths[] = {
     162        { "/boot/home/resources/raw/beer.bits", "" },
     163        { "/boot/home/resources/raw/blocks.bits", "" }
     164    };
     165    const IdentifyInfo aRawPaths[] = {
     166        { "/boot/home/resources/raw/beer_rgb_nocomp.raw",
     167            "RAW image (Little, RGB, None)" },
     168        { "/boot/home/resources/raw/beer_rgb_nocomp_big.raw",
     169            "RAW image (Big, RGB, None)" },
     170        { "/boot/home/resources/raw/blocks_rgb_nocomp.raw",
     171            "RAW image (Little, RGB, None)" },
     172        { "/boot/home/resources/raw/hills_bw_huffman.raw",
     173            "RAW image (Little, Mono, Huffman)" },
     174        { "/boot/home/resources/raw/hills_cmyk_nocomp.raw",
     175            "RAW image (Little, CMYK, None)" },
     176        { "/boot/home/resources/raw/hills_cmyk_nocomp_big.rcw",
     177            "RAW image (Big, CMYK, None)" },
     178        { "/boot/home/resources/raw/hills_rgb_nocomp.rcw",
     179            "RAW image (Little, RGB, None)" },
     180        { "/boot/home/resources/raw/hills_rgb_packbits.rcw",
     181            "RAW image (Little, RGB, PackBits)" },
     182        { "/boot/home/resources/raw/homes_bw_fax.rcw",
     183            "RAW image (Little, Mono, Group 3)" },
     184        { "/boot/home/resources/raw/homes_bw_huffman.rcw",
     185            "RAW image (Little, Mono, Huffman)" },
     186        { "/boot/home/resources/raw/homes_bw_nocomp.rcw",
     187            "RAW image (Little, Mono, None)" },
     188        { "/boot/home/resources/raw/homes_bw_nocomp_big.rcw",
     189            "RAW image (Big, Mono, None)" },
     190        { "/boot/home/resources/raw/homes_bw_packbits.rcw",
     191            "RAW image (Little, Mono, PackBits)" },
     192        { "/boot/home/resources/raw/homes_cmap4_nocomp.rcw",
     193            "RAW image (Little, Palette, None)" },
     194        { "/boot/home/resources/raw/homes_cmap4_nocomp_big.rcw",
     195            "RAW image (Big, Palette, None)" },
     196        { "/boot/home/resources/raw/homes_cmap4_packbits.rcw",
     197            "RAW image (Little, Palette, PackBits)" },
     198        { "/boot/home/resources/raw/homes_gray8_nocomp.rcw",
     199            "RAW image (Little, Gray, None)" },
     200        { "/boot/home/resources/raw/homes_gray8_nocomp_big.rcw",
     201            "RAW image (Big, Gray, None)" },
     202        { "/boot/home/resources/raw/homes_gray8_packbits.rcw",
     203            "RAW image (Little, Gray, PackBits)" },
     204        { "/boot/home/resources/raw/logo_cmap4_nocomp.rcw",
     205            "RAW image (Little, Palette, None)" },
     206        { "/boot/home/resources/raw/logo_cmap4_nocomp_big.rcw",
     207            "RAW image (Big, Palette, None)" },
     208        { "/boot/home/resources/raw/logo_cmap4_packbits.rcw",
     209            "RAW image (Little, Palette, PackBits)" },
     210        { "/boot/home/resources/raw/logo_cmap8_nocomp.rcw",
     211            "RAW image (Little, Palette, None)" },
     212        { "/boot/home/resources/raw/logo_cmap8_nocomp_big.rcw",
     213            "RAW image (Big, Palette, None)" },
     214        { "/boot/home/resources/raw/logo_cmap8_packbits.rcw",
     215            "RAW image (Little, Palette, PackBits)" },
     216        { "/boot/home/resources/raw/logo_cmyk_nocomp.rcw",
     217            "RAW image (Little, CMYK, None)" },
     218        { "/boot/home/resources/raw/vsmall_cmap4_nocomp.rcw",
     219            "RAW image (Little, Palette, None)" },
     220        { "/boot/home/resources/raw/vsmall_rgb_nocomp.rcw",
     221            "RAW image (Little, RGB, None)" },
     222        { "/boot/home/resources/raw/backup_help.rcw",
     223            "RAW image (Big, Mono, Group 3)" }
     224    };
     225
     226    IdentifyTests(this, proster, aRawPaths,
     227        sizeof(aRawPaths) / sizeof(IdentifyInfo), false);
     228    IdentifyTests(this, proster, aBitsPaths,
     229        sizeof(aBitsPaths) / sizeof(IdentifyInfo), true);
     230   
     231    delete proster;
     232    proster = NULL;
     233}
     234
     235// coveniently group path of raw image with
     236// path of bits image that it should translate to
     237struct TranslatePaths {
     238    const char *rawPath;
     239    const char *bitsPath;
     240};
     241
     242void
     243TranslateTests(RAWTranslatorTest *ptest, BTranslatorRoster *proster,
     244    const TranslatePaths *paths, int32 len)
     245{
     246    // Perform translations on every file in the array
     247    for (int32 i = 0; i < len; i++) {
     248        // Setup input files   
     249        ptest->NextSubTest();
     250        BFile raw_file, bits_file;
     251        CPPUNIT_ASSERT(raw_file.SetTo(paths[i].rawPath, B_READ_ONLY) == B_OK);
     252        CPPUNIT_ASSERT(bits_file.SetTo(paths[i].bitsPath, B_READ_ONLY) == B_OK);
     253        printf(" [%s] ", paths[i].rawPath);
     254       
     255        BMallocIO mallio, dmallio;
     256       
     257        // Convert to B_TRANSLATOR_ANY_TYPE (should be B_TRANSLATOR_BITMAP)
     258        ptest->NextSubTest();
     259        CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0);
     260        CPPUNIT_ASSERT(mallio.SetSize(0) == B_OK);
     261        CPPUNIT_ASSERT(proster->Translate(&raw_file, NULL, NULL, &mallio,
     262            B_TRANSLATOR_ANY_TYPE) == B_OK);
     263        CPPUNIT_ASSERT(CompareStreams(mallio, bits_file) == true);
     264       
     265        // Convert to B_TRANSLATOR_BITMAP
     266        ptest->NextSubTest();
     267        CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0);
     268        CPPUNIT_ASSERT(mallio.SetSize(0) == B_OK);
     269        CPPUNIT_ASSERT(proster->Translate(&raw_file, NULL, NULL, &mallio,
     270            B_TRANSLATOR_BITMAP) == B_OK);
     271        CPPUNIT_ASSERT(CompareStreams(mallio, bits_file) == true);
     272       
     273        // Convert bits mallio to B_TRANSLATOR_BITMAP dmallio
     274        /* Not Supported Yet
     275        ptest->NextSubTest();
     276        CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0);
     277        CPPUNIT_ASSERT(dmallio.SetSize(0) == B_OK);
     278        CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio,
     279            B_TRANSLATOR_BITMAP) == B_OK);
     280        CPPUNIT_ASSERT(CompareStreams(dmallio, bits_file) == true);
     281        */
     282       
     283        // Convert to RAW_IMAGE_FORMAT
     284        /* Not Supported Yet
     285        ptest->NextSubTest();
     286        CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0);
     287        CPPUNIT_ASSERT(mallio.SetSize(0) == B_OK);
     288        CPPUNIT_ASSERT(proster->Translate(&raw_file, NULL, NULL, &mallio,
     289            RAW_IMAGE_FORMAT) == B_OK);
     290        CPPUNIT_ASSERT(CompareStreams(mallio, raw_file) == true);
     291        */
     292       
     293        // Convert RAW mallio to B_TRANSLATOR_BITMAP dmallio
     294        /* Not Ready Yet
     295        ptest->NextSubTest();
     296        CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0);
     297        CPPUNIT_ASSERT(dmallio.SetSize(0) == B_OK);
     298        CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio,
     299            B_TRANSLATOR_BITMAP) == B_OK);
     300        CPPUNIT_ASSERT(CompareStreams(dmallio, bits_file) == true);
     301        */
     302       
     303        // Convert RAW mallio to RAW_IMAGE_FORMAT dmallio
     304        /* Not Ready Yet
     305        ptest->NextSubTest();
     306        CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0);
     307        CPPUNIT_ASSERT(dmallio.SetSize(0) == B_OK);
     308        CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio,
     309            RAW_IMAGE_FORMAT) == B_OK);
     310        CPPUNIT_ASSERT(CompareStreams(dmallio, raw_file) == true);
     311        */
     312    }
     313}
     314
     315void
     316RAWTranslatorTest::TranslateTest()
     317{
     318    // Init
     319    NextSubTest();
     320    status_t result = B_ERROR;
     321    off_t filesize = -1;
     322    BTranslatorRoster *proster = new BTranslatorRoster();
     323    CPPUNIT_ASSERT(proster);
     324    CPPUNIT_ASSERT(proster->AddTranslators(
     325        "/boot/home/config/add-ons/Translators/RAWTranslator") == B_OK);
     326    BFile wronginput("../src/tests/kits/translation/data/images/image.jpg",
     327        B_READ_ONLY);
     328    CPPUNIT_ASSERT(wronginput.InitCheck() == B_OK);
     329    BFile output("/tmp/raw_test.out", B_WRITE_ONLY |
     330        B_CREATE_FILE | B_ERASE_FILE);
     331    CPPUNIT_ASSERT(output.InitCheck() == B_OK);
     332   
     333    // Translate (bad input, output types)
     334    NextSubTest();
     335    result = proster->Translate(&wronginput, NULL, NULL, &output,
     336        B_TRANSLATOR_TEXT);
     337    CPPUNIT_ASSERT(result == B_NO_TRANSLATOR);
     338    CPPUNIT_ASSERT(output.GetSize(&filesize) == B_OK);
     339    CPPUNIT_ASSERT(filesize == 0);
     340   
     341    // Translate (wrong type of input data)
     342    NextSubTest();
     343    result = proster->Translate(&wronginput, NULL, NULL, &output,
     344        RAW_IMAGE_FORMAT);
     345    CPPUNIT_ASSERT(result == B_NO_TRANSLATOR);
     346    CPPUNIT_ASSERT(output.GetSize(&filesize) == B_OK);
     347    CPPUNIT_ASSERT(filesize == 0);
     348   
     349    // Translate (wrong type of input, B_TRANSLATOR_ANY_TYPE output)
     350    NextSubTest();
     351    result = proster->Translate(&wronginput, NULL, NULL, &output,
     352        B_TRANSLATOR_ANY_TYPE);
     353    CPPUNIT_ASSERT(result == B_NO_TRANSLATOR);
     354    CPPUNIT_ASSERT(output.GetSize(&filesize) == B_OK);
     355    CPPUNIT_ASSERT(filesize == 0);
     356   
     357    // Translate RAW images to bits
     358    const TranslatePaths aPaths[] = {
     359        { "/boot/home/resources/raw/beer_rgb_nocomp.rcw",
     360            "/boot/home/resources/raw/beer.bits" },
     361        { "/boot/home/resources/raw/beer_rgb_nocomp_big.rcw",
     362            "/boot/home/resources/raw/beer.bits" },
     363        { "/boot/home/resources/raw/blocks_rgb_nocomp.rcw",
     364            "/boot/home/resources/raw/blocks.bits" },
     365        { "/boot/home/resources/raw/hills_bw_huffman.rcw",
     366            "/boot/home/resources/raw/hills_bw.bits" },
     367        { "/boot/home/resources/raw/hills_cmyk_nocomp.rcw",
     368            "/boot/home/resources/raw/hills_cmyk.bits" },
     369        { "/boot/home/resources/raw/hills_cmyk_nocomp_big.rcw",
     370            "/boot/home/resources/raw/hills_cmyk.bits" },
     371        { "/boot/home/resources/raw/hills_rgb_nocomp.rcw",
     372            "/boot/home/resources/raw/hills_rgb.bits" },
     373        { "/boot/home/resources/raw/hills_rgb_packbits.rcw",
     374            "/boot/home/resources/raw/hills_rgb.bits" },
     375        { "/boot/home/resources/raw/homes_bw_fax.rcw",
     376            "/boot/home/resources/raw/homes_bw.bits" },
     377        { "/boot/home/resources/raw/homes_bw_huffman.rcw",
     378            "/boot/home/resources/raw/homes_bw.bits" },
     379        { "/boot/home/resources/raw/homes_bw_nocomp.rcw",
     380            "/boot/home/resources/raw/homes_bw.bits" },
     381        { "/boot/home/resources/raw/homes_bw_nocomp_big.rcw",
     382            "/boot/home/resources/raw/homes_bw.bits" },
     383        { "/boot/home/resources/raw/homes_bw_packbits.rcw",
     384            "/boot/home/resources/raw/homes_bw.bits" },
     385        { "/boot/home/resources/raw/homes_cmap4_nocomp.rcw",
     386            "/boot/home/resources/raw/homes_cmap4.bits" },
     387        { "/boot/home/resources/raw/homes_cmap4_nocomp_big.rcw",
     388            "/boot/home/resources/raw/homes_cmap4.bits" },
     389        { "/boot/home/resources/raw/homes_cmap4_packbits.rcw",
     390            "/boot/home/resources/raw/homes_cmap4.bits" },
     391        { "/boot/home/resources/raw/homes_gray8_nocomp.rcw",
     392            "/boot/home/resources/raw/homes_gray8.bits" },
     393        { "/boot/home/resources/raw/homes_gray8_nocomp_big.rcw",
     394            "/boot/home/resources/raw/homes_gray8.bits" },
     395        { "/boot/home/resources/raw/homes_gray8_packbits.rcw",
     396            "/boot/home/resources/raw/homes_gray8.bits" },
     397        { "/boot/home/resources/raw/logo_cmap4_nocomp.rcw",
     398            "/boot/home/resources/raw/logo_cmap4.bits" },
     399        { "/boot/home/resources/raw/logo_cmap4_nocomp_big.rcw",
     400            "/boot/home/resources/raw/logo_cmap4.bits" },
     401        { "/boot/home/resources/raw/logo_cmap4_packbits.rcw",
     402            "/boot/home/resources/raw/logo_cmap4.bits" },
     403        { "/boot/home/resources/raw/logo_cmap8_nocomp.rcw",
     404            "/boot/home/resources/raw/logo_rgb.bits" },
     405        { "/boot/home/resources/raw/logo_cmap8_nocomp_big.rcw",
     406            "/boot/home/resources/raw/logo_rgb.bits" },
     407        { "/boot/home/resources/raw/logo_cmap8_packbits.rcw",
     408            "/boot/home/resources/raw/logo_rgb.bits" },
     409        { "/boot/home/resources/raw/logo_cmyk_nocomp.rcw",
     410            "/boot/home/resources/raw/logo_cmyk.bits" },
     411        { "/boot/home/resources/raw/vsmall_cmap4_nocomp.rcw",
     412            "/boot/home/resources/raw/vsmall.bits" },
     413        { "/boot/home/resources/raw/vsmall_rgb_nocomp.rcw",
     414            "/boot/home/resources/raw/vsmall.bits" },
     415        { "/boot/home/resources/raw/backup_help.rcw",
     416            "/boot/home/resources/raw/backup_help.bits" }
     417    };
     418   
     419    TranslateTests(this, proster, aPaths,
     420        sizeof(aPaths) / sizeof(TranslatePaths));
     421   
     422    delete proster;
     423    proster = NULL;
     424}
     425
     426#if !TEST_R5
     427
     428// The input formats that this translator is supposed to support
     429translation_format gRAWInputFormats[] = {
     430    {
     431        B_TRANSLATOR_BITMAP,
     432        B_TRANSLATOR_BITMAP,
     433        0.7f, // quality
     434        0.6f, // capability
     435        "image/x-be-bitmap",
     436        "Be Bitmap Format (RAWTranslator)"
     437    },
     438    {
     439        RAW_IMAGE_FORMAT,
     440        B_TRANSLATOR_BITMAP,
     441        0.7f,
     442        0.6f,
     443        "image/rcw",
     444        "RAW image"
     445    },
     446    {
     447        RAW_IMAGE_FORMAT,
     448        B_TRANSLATOR_BITMAP,
     449        0.7f,
     450        0.6f,
     451        "image/rc2",
     452        "RAW image"
     453    }   
     454};
     455
     456// The output formats that this translator is supposed to support
     457translation_format gRAWOutputFormats[] = {
     458    {
     459        B_TRANSLATOR_BITMAP,
     460        B_TRANSLATOR_BITMAP,
     461        0.7f, // quality
     462        0.6f, // capability
     463        "image/x-be-bitmap",
     464        "Be Bitmap Format (RAWTranslator)"
     465    },
     466    {
     467        RAW_IMAGE_FORMAT,
     468        B_TRANSLATOR_BITMAP,
     469        0.7f,
     470        0.6f,
     471        "image/rcw",
     472        "RAW image"
     473    },
     474    {
     475        RAW_IMAGE_FORMAT,
     476        B_TRANSLATOR_BITMAP,
     477        0.7f,
     478        0.6f,
     479        "image/rc2",
     480        "RAW image"
     481    }
     482};
     483
     484void
     485RAWTranslatorTest::LoadAddOnTest()
     486{
     487    TranslatorLoadAddOnTest("/boot/home/config/add-ons/Translators/RAWTranslator",
     488        this,
     489        gRAWInputFormats, sizeof(gRAWInputFormats) / sizeof(translation_format),
     490        gRAWOutputFormats, sizeof(gRAWOutputFormats) / sizeof(translation_format),
     491        B_TRANSLATION_MAKE_VERSION(1,0,0));
     492}
     493
     494#endif // #if !TEST_R5
  • src/tests/add-ons/translators/rawtranslator/RAWTranslatorTest.h

     
     1// RAWTranslatorTest.h
     2
     3#ifndef RAW_TRANSLATOR_TEST_H
     4#define RAW_TRANSLATOR_TEST_H
     5
     6#include <TestCase.h>
     7#include <TestShell.h>
     8
     9#define BBT_MIME_STRING  "image/x-be-bitmap"
     10#define RAW_MIME_STRING "image/rcw"
     11
     12namespace CppUnit {
     13class Test;
     14}
     15
     16class RAWTranslatorTest : public BTestCase {
     17public:
     18    static CppUnit::Test* Suite();
     19
     20    // This function called before *each* test added in Suite()
     21    void setUp();
     22
     23    // This function called after *each* test added in Suite()
     24    void tearDown();
     25
     26    //------------------------------------------------------------
     27    // Test functions
     28    //------------------------------------------------------------
     29#if !TEST_R5
     30    void LoadAddOnTest();
     31#endif
     32    void IdentifyTest();
     33    void TranslateTest();
     34};
     35
     36#endif  // RAW_TRANSLATOR_TEST_H
  • src/tests/add-ons/translators/Jamfile

     
    33SetSubDirSupportedPlatformsBeOSCompatible ;
    44AddSubDirSupportedPlatforms libbe_test ;
    55
     6SubDirSysHdrs [ FDirName $(HAIKU_TOP) src add-ons translators raw ] ;
     7SubDirSysHdrs [ FDirName $(HAIKU_TOP) src add-ons translators shared ] ;
     8
    69local libtranslation = translation ;
    710
    811# Let Jam know where to find some of our source files
     
    1114SEARCH_SOURCE += [ FDirName $(SUBDIR) stxttranslator ] ;
    1215SEARCH_SOURCE += [ FDirName $(SUBDIR) tgatranslator ] ;
    1316SEARCH_SOURCE += [ FDirName $(SUBDIR) tifftranslator ] ;
     17SEARCH_SOURCE += [ FDirName $(SUBDIR) rawtranslator ] ;
    1418
    1519if $(TARGET_PLATFORM) = libbe_test {
    1620    UsePublicHeaders translation ;
     
    2428        STXTTranslatorTest.cpp
    2529        TGATranslatorTest.cpp
    2630        TIFFTranslatorTest.cpp
     31        RAWTranslatorTest.cpp
    2732    : $(libtranslation) be $(TARGET_LIBSTDC++)
    2833;
    2934