<div dir="ltr"><div dir="ltr">Hi,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 23, 2023 at 12:20 AM Michael Meeks <<a href="mailto:michael.meeks@collabora.com">michael.meeks@collabora.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Ooh - interesting; so would using the boxclipper's getRandomOrdinal - <br>
which uses rand() and (I assume) could be consistently seeded ?<br>
<br>
Or could we consistently seed:<br>
<br>
comphelper::rng::uniform_size_distribution(<br>
<br>
To produced a known pattern ? or we could hard-code a set of numbers <br>
(which I guess) wouldn't provoke the problem into the test.<br></blockquote><div><br></div><div>Well a unit test should be a set of known input (typical input values and known corner cases) that asserts a known output, which then defines the behaviour of the calling function or class. If you have random values for an input you don't really have a "known" set of input values as they are generated every time. Would be much better to change this test to a simple set of known input values and also tackle the corner cases, which are missing (but we obviously do hit one).</div><div><br></div><div>Also getRandomOrdinal(1) is essentially a NOOP - always returns 0, so the aPolygonOffset was always offset by 0.5 from the other generated polygon, which is not what the intended use case for the test was. </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Would be lovely to find the sequence that kills it of course,<br></blockquote><div><br></div><div>It happens because getDeltaY() is 0.0, which is the "end - start" Y value of an edge, but this one should never be zero (according to the comment).</div><br></div><div class="gmail_quote">I have run a simpler case in a loop but didn't get the value 0, so I could write an edge case unit test. Deconstructing the code and unit test the parts would probably be needed.<br></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thoughts much appreciated,<br>
<br>
Michael.<br>
<br>
-- <br>
<a href="mailto:michael.meeks@collabora.com" target="_blank">michael.meeks@collabora.com</a> <><, GM Collabora Productivity<br>
Hangout: <a href="mailto:mejmeeks@gmail.com" target="_blank">mejmeeks@gmail.com</a>, Skype: mmeeks<br>
(M) +44 7795 666 147 - timezone usually UK / Europe<br></blockquote><div><br></div><div>Tomaž <br></div></div></div>