You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Andreas L Delmelle <a_...@pandora.be> on 2006/06/04 08:16:43 UTC

Failing standard testcase -- testConversions?

Hi all,

I suppose the above mentioned testcase is failing only in my local  
setup, or it would have been noticed already (?) No precise idea why,  
but...

The test fails with message:
     [junit] Testcase: testConversions 
(org.apache.fop.util.UnitConvTestCase):    FAILED
     [junit] mm2px/72dpi expected:<842.0> but was:<841.8897764234434>
     [junit] junit.framework.AssertionFailedError: mm2px/72dpi  
expected:<842.0> but was:<841.8897764234434>
     [junit]     at  
org.apache.fop.util.UnitConvTestCase.testConversions 
(UnitConvTestCase.java:41)

Now, looking at the code, the method mm2px() returns a double, so I'm  
thinking that:
- either the method is wrong and it should return a rounded double value
- the assertion is wrong, and a non-rounded double value should be  
expected

Which one of the above two would be more correct/in line with the  
original intention?

Cheers,

Andreas

Re: Failing standard testcase -- testConversions?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 5, 2006, at 12:36, Jeremias Maerki wrote:

>>
>> BTW: I hope the checks are right now. Seemed a bit silly at first to
>> simply reproduce the calculation that is made by the method...
>> could've put an absolute value there, but the end-result is the same,
>> I guess.
>
> I thought about that. First reaction to reusing the constant from
> UnitConv was: Uhm, hmm, shrug. :-)
>
> But I think it would probably conceptually better to replicate the  
> value
> instead of using the constants. If someone changes the constant, we
> won't find out (other than by looking at the SVN log).

Say no more! (read: d-o-n-e :))

http://svn.apache.org/viewvc?rev=411742&view=rev

Later,

Andreas


Re: Failing standard testcase -- testConversions?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 05.06.2006 12:23:45 Andreas L Delmelle wrote:
> On Jun 5, 2006, at 10:32, Jeremias Maerki wrote:
> 
> > Apologies for that one and thanks for fixing it. I guess I was not
> > looking far enough up in the Ant log.
> 
> No problem. Just a lucky coincidence I was following the build  
> output, or wouldn't have noticed it myself :)
> 
> > I've modified the build so I can
> > set a property which makes it stop immediately when a failure is
> > encountered. So I hope this won't occur again (provided I run the  
> > tests
> > in the first place). :-)
> 
> Sounds like a good idea.
> 
> Thanks,
> 
> Andreas
> 
> BTW: I hope the checks are right now. Seemed a bit silly at first to  
> simply reproduce the calculation that is made by the method...  
> could've put an absolute value there, but the end-result is the same,  
> I guess.

I thought about that. First reaction to reusing the constant from
UnitConv was: Uhm, hmm, shrug. :-)

But I think it would probably conceptually better to replicate the value
instead of using the constants. If someone changes the constant, we
won't find out (other than by looking at the SVN log).


Jeremias Maerki


Re: Failing standard testcase -- testConversions?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 5, 2006, at 10:32, Jeremias Maerki wrote:

> Apologies for that one and thanks for fixing it. I guess I was not
> looking far enough up in the Ant log.

No problem. Just a lucky coincidence I was following the build  
output, or wouldn't have noticed it myself :)

> I've modified the build so I can
> set a property which makes it stop immediately when a failure is
> encountered. So I hope this won't occur again (provided I run the  
> tests
> in the first place). :-)

Sounds like a good idea.

Thanks,

Andreas

BTW: I hope the checks are right now. Seemed a bit silly at first to  
simply reproduce the calculation that is made by the method...  
could've put an absolute value there, but the end-result is the same,  
I guess.


Re: Failing standard testcase -- testConversions?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Apologies for that one and thanks for fixing it. I guess I was not
looking far enough up in the Ant log. I've modified the build so I can
set a property which makes it stop immediately when a failure is
encountered. So I hope this won't occur again (provided I run the tests
in the first place). :-)

On 04.06.2006 12:07:48 Andreas L Delmelle wrote:
> On Jun 4, 2006, at 08:16, Andreas L Delmelle wrote:
> 
> > <snip />
> > Now, looking at the code, the method mm2px() returns a double, so  
> > I'm thinking that:
> > - either the method is wrong and it should return a rounded double  
> > value
> > - the assertion is wrong, and a non-rounded double value should be  
> > expected
> >
> > Which one of the above two would be more correct/in line with the  
> > original intention?
> 
> To answer my own question:
> http://svn.apache.org/viewvc?rev=410523&view=rev
> 
> I'll update the assertions...
> 
> Cheers,
> 
> Andreas



Jeremias Maerki


Re: Failing standard testcase -- testConversions?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 4, 2006, at 08:16, Andreas L Delmelle wrote:

> <snip />
> Now, looking at the code, the method mm2px() returns a double, so  
> I'm thinking that:
> - either the method is wrong and it should return a rounded double  
> value
> - the assertion is wrong, and a non-rounded double value should be  
> expected
>
> Which one of the above two would be more correct/in line with the  
> original intention?

To answer my own question:
http://svn.apache.org/viewvc?rev=410523&view=rev

I'll update the assertions...

Cheers,

Andreas