[Kst] Re: histogram unit test

Barth Netterfield netterfield at astro.utoronto.ca
Mon Jan 17 18:27:30 CET 2011


OK.  The test, as modified by Peter, is now correct.  Objects need
internalUpdate() to be run before changes are fully propagated.  In kst2,
they are done from the update manager only.  In the tests they need to be
done by hand.

There is an issue in kst, however: if we are paused, no updates happen.  So
changes to objects, even through dialogs,  while we are paused, do not fully
propagate.  This is probably a bug.

On Mon, Jan 17, 2011 at 11:54 AM, Barth Netterfield <
netterfield at astro.utoronto.ca> wrote:

> It looks like there was a genuine bug in generatedVector which you
> uncovered.  I will look into it further.
>
>
> On Sun, Jan 16, 2011 at 10:20 AM, Peter Kümmel <syntheticpp at gmx.net>wrote:
>
>> In the meantime I've accidentally committed the patch.
>> Before reverting I wanna ask again if the original test
>> didn't disclosed a bug.
>>
>> Peter
>>
>>
>> On 12.01.2011 20:50, Peter Kuemmel wrote:
>> > To fix the unit test for Histogram I need to call internalUpdate on
>> GenerateVector once more:
>> > before the update changeRange is called, the new length is active (10)
>> but the values not (max==0), the values only have after the internalUpdate
>> the new values (max==10), see the adition QCOMPAREs.
>> > Is this the correct behaviour or a bug?
>> >
>> > Peter
>> >
>> > Index: tests/testhistogram.cpp
>> > ===================================================================
>> > --- tests/testhistogram.cpp   (Revision 1214031)
>> > +++ tests/testhistogram.cpp   (Arbeitskopie)
>> > @@ -30,8 +30,18 @@
>> >   void TestHistogram::testHistogram() {
>> >     Kst::GeneratedVectorPtr gvp =
>> Kst::kst_cast<Kst::GeneratedVector>(_store.createObject<Kst::GeneratedVector>());
>> >     Q_ASSERT(gvp);
>> > +  QCOMPARE(gvp->length(), 1);
>> > +
>> >     gvp->changeRange(0, 10, 100);
>> > +  QCOMPARE(gvp->max(), 0.0);
>> > +  QCOMPARE(gvp->length(), 100);
>> > +
>> > +  gvp->internalUpdate();
>> > +  QCOMPARE(gvp->max(), 10.0);
>> > +  QCOMPARE(gvp->length(), 100);
>> > +
>> >     Kst::VectorPtr vp(gvp);
>> > +  QCOMPARE(vp->max(), 10.0);
>> >
>> >     Kst::HistogramPtr h1 =
>> Kst::kst_cast<Kst::Histogram>(_store.createObject<Kst::Histogram>());
>> >     h1->change(vp, 0, 10, 10, Kst::Histogram::Number);
>> _______________________________________________
>> Kst mailing list
>> Kst at kde.org
>> https://mail.kde.org/mailman/listinfo/kst
>>
>
>
>
> --
> C. Barth Netterfield
> University of Toronto
> 416-845-0946
>
>
>


-- 
C. Barth Netterfield
University of Toronto
416-845-0946
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kst/attachments/20110117/231998c8/attachment-0001.htm 


More information about the Kst mailing list