Hi,

I know there have been plenty of mails on this topic already, but still ... 
I'm quite a bit confused, and the suggested solutions all didn't work for 
me :-/

In unit tests I want to cover the case that e. g. incompatible colour spaces 
are used for a transform. But, of course within my application I don't want 
the whole thing to "go down". But something is really weird as my code 
doesn't really behave like it should in comparison to others'

This is in short what I'm doing within a method of my class:

cmsErrorAction(LCMS_ERROR_SHOW);
myTransform = cmsCreateTransform(_inputProfile->getProfile(),
                                 TYPE_RGB_8,
                                 _outputProfile->getProfile(),
                                 TYPE_Lab_8,
                                 _renderingIntent,
                                 _transformationFlags);
CPPUNIT_ASSERT(aTransform == NULL);

The input and output profiles are both TYPE_RGB_8 type, but I'm setting the 
output profile to TYPE_Lab_8 to provoke an error. Therefore aTransform should 
be NULL. But it isn't ... it's 134559216F :-(

Therefore my unit test fails.

Also this testing leads me to a second point. I'd like to make my wrapper/code 
both object oriented as well as thread safe. And that's a bit of a problem 
with the current way the error handler works. To really use it in a tread 
safe way (the error handler) and usable with OO classes I'd have to be able 
to either pass in an instance with an error handler method to call, or be 
able to pass an object method to the cmsSetErrorHandler() function. Which 
seems like a no-go.

The sample implementations around that I've seen seem to declare a global 
variable for errorCode and errorMessage which then in case of a NULL get read 
and propagated upward through e. g. an exception. But using globals just 
seems highly un-threadsafe to me ... And the whole approach of a method seems 
like it's very incompatible with OO approaches to propagate errors in a 
sensible way into an object.

Any ideas on either of the two issues addressed here?

Guy


-- 
Guy K. Kloss
Institute of Information and Mathematical Sciences
Te Kura Putaiao o Mohiohio me Pangarau
Room 2.63, Quad Block A Building
Massey University, Auckland, Albany
Private Bag 102 904, North Shore Mail Centre
voice: +64 9 414-0800 ext. 9585   fax: +64 9 441-8181
eMail: [EMAIL PROTECTED]  http://www.massey.ac.nz/~gkloss/

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to