[Kst] histogram unit test

Peter Kuemmel syntheticpp at gmx.net
Wed Jan 12 20:50:50 CET 2011


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);
-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl


More information about the Kst mailing list