[Kmymoney-devel] MyMoneySchedule::adjustedNextPayment
Ian Neal
iann_bugzilla at blueyonder.co.uk
Wed May 26 08:30:31 CEST 2010
Thanks for the test Alvaro, I will use it against the re-written
NextPayment code I have in my tree and see what happens (probably this
evening when my brain has had time to wake up).
Thanks,
Ian
Alvaro Soliverez wrote:
> Hello all,
> as I stated in a bug, I believe there is a problem with the way this
> method works.
> In my view, as it is now, the method is not consistent. In fact, the
> bug was fixed with a workaround, by adding a new method, which is not
> bad in itself, but it failed to address the original problem.
> IMHO, at the moment you have to know how it works internally to not
> get burnt when using this method, which is never a good thing.
>
> I added a test to MyMoneySchedule that tests exactly this behaviour.
>
> void MyMoneyScheduleTest::testAdjustedNextPayment()
> {
> MyMoneySchedule s;
>
> QDate dueDate(2010, 5, 23);
> QDate adjustedDueDate(2010, 5, 21);
> s.setNextDueDate(dueDate);
> s.setOccurrence(MyMoneySchedule::OCCUR_MONTHLY);
> s.setWeekendOption(MyMoneySchedule::MoveBefore);
>
> //if adjustedNextPayment works ok with adjusted date prior to the
> current date, it should return 2010-06-23
> QDate nextDueDate(2010, 6, 23);
> //this is the current behaviour, and it is wrong
> //CPPUNIT_ASSERT(s.adjustedNextPayment(adjustedDueDate) == adjustedDueDate);
>
> //this is the expected behaviour
> CPPUNIT_ASSERT(s.adjustedNextPayment(s.adjustedNextDueDate()) ==
> s.adjustedDate(nextDueDate, s.weekendOption()));
> }
>
> As expected, it fails.
>
> Regards,
> Alvaro
> _______________________________________________
> KMyMoney-devel mailing list
> KMyMoney-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kmymoney-devel
More information about the KMyMoney-devel
mailing list