[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Unittests and colorspaces
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2007-07-10 7:11:43
Message-ID: 200707100911.43425.boud () valdyas ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


I'm busy with unittests and I've added a bit of code that can be very useful:


void KisBlaTest::allCsApplicator(void (KisBlaTest::* funcPtr)( 
KoColorSpace*cs ) )
{
    QList<QString> csIds = KoColorSpaceRegistry::instance()->keys();

    foreach( QString csId, csIds ) {

        kDebug() << "Testing with " << csId << endl;

        QList<KoColorProfile*> profiles = 
KoColorSpaceRegistry::instance()->profilesFor ( csId );
        if ( profiles.size() == 0 ) {
            KoColorSpace * cs = KoColorSpaceRegistry::instance()->colorSpace( 
csId, 0 );
            if ( cs ) ( this->*funcPtr )( cs );
        }
        else {
            foreach( KoColorProfile * profile, profiles ) {
                KoColorSpace * cs = 
KoColorSpaceRegistry::instance()->colorSpace( csId, profile );
                if ( cs ) ( this->*funcPtr )( cs );
            }

        }
    }
}

If you define a method called

testBla(KoColorSpace *); 

(which won't be called by the qt unittest framework)

And then define a test called:

void KisBlaTest::blaIter()
{
    allCsApplicator( &KisBlaTest::testBla );
}

Then your test will run for all available colorspaces. This is pretty useful 
since it turns out that not all colorspaces are that stable. Gray8 and Gray16 
fail on the bltMask test, for instance.

So... Wherever you write KoColorSpaceRegistry::instance()->rgb8() in a 
unittest please consider using the above code (or an improved version, of 
course), so we unittest with all colorspaces and all profiles.

-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi

["signature.asc" (application/pgp-signature)]

_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic