[Kmymoney-devel] MyMoneySchedule::adjustedNextPayment

Alvaro Soliverez asoliverez at gmail.com
Wed May 26 05:37:45 CEST 2010

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);

  //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.


More information about the KMyMoney-devel mailing list