Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/tests/mymoneytransaction-test.cpp
Context not available. | |||||
25 | #include "mymoneytestutils.h" | 25 | #include "mymoneytestutils.h" | ||
---|---|---|---|---|---|
26 | #include "mymoneymoney.h" | 26 | #include "mymoneymoney.h" | ||
27 | #include "mymoneysplit.h" | 27 | #include "mymoneysplit.h" | ||
28 | #include "mymoneysplit_p.h" | ||||
28 | #include "mymoneytransaction.h" | 29 | #include "mymoneytransaction.h" | ||
29 | #include "mymoneytransaction_p.h" | 30 | #include "mymoneytransaction_p.h" | ||
30 | #include "mymoneyenums.h" | 31 | #include "mymoneyenums.h" | ||
Context not available. | |||||
129 | 130 | | |||
130 | void MyMoneyTransactionTest::testAddSplits() | 131 | void MyMoneyTransactionTest::testAddSplits() | ||
131 | { | 132 | { | ||
132 | m->setId("TestID"); | 133 | m->d_func()->setId("TestID"); | ||
133 | MyMoneySplit split1, split2; | 134 | MyMoneySplit split1, split2; | ||
134 | split1.setAccountId("A000001"); | 135 | split1.setAccountId("A000001"); | ||
135 | split2.setAccountId("A000002"); | 136 | split2.setAccountId("A000002"); | ||
Context not available. | |||||
175 | 176 | | |||
176 | split = m->splits()[0]; | 177 | split = m->splits()[0]; | ||
177 | split.setAccountId("A000003"); | 178 | split.setAccountId("A000003"); | ||
178 | split.setId("S00000000"); | 179 | split.d_func()->setId("S00000000"); | ||
179 | 180 | | |||
180 | // this one should fail, because the ID is invalid | 181 | // this one should fail, because the ID is invalid | ||
181 | try { | 182 | try { | ||
Context not available. | |||||
185 | } | 186 | } | ||
186 | 187 | | |||
187 | // set id to correct value, and check that it worked | 188 | // set id to correct value, and check that it worked | ||
188 | split.setId("S0001"); | 189 | split.d_func()->setId("S0001"); | ||
189 | try { | 190 | try { | ||
190 | m->modifySplit(split); | 191 | m->modifySplit(split); | ||
191 | QVERIFY(m->splitCount() == 2); | 192 | QVERIFY(m->splitCount() == 2); | ||
Context not available. | |||||
218 | QFAIL("Unexpected exception!"); | 219 | QFAIL("Unexpected exception!"); | ||
219 | } | 220 | } | ||
220 | 221 | | |||
221 | split.setId("S00000000"); | 222 | split.d_func()->setId("S00000000"); | ||
222 | // this one should fail, because the ID is invalid | 223 | // this one should fail, because the ID is invalid | ||
223 | try { | 224 | try { | ||
224 | m->modifySplit(split); | 225 | m->modifySplit(split); | ||
Context not available. | |||||
227 | } | 228 | } | ||
228 | 229 | | |||
229 | // set id to correct value, and check that it worked | 230 | // set id to correct value, and check that it worked | ||
230 | split.setId("S0002"); | 231 | split.d_func()->setId("S0002"); | ||
231 | try { | 232 | try { | ||
232 | m->removeSplit(split); | 233 | m->removeSplit(split); | ||
233 | QVERIFY(m->splitCount() == 2); | 234 | QVERIFY(m->splitCount() == 2); | ||
Context not available. | |||||
242 | } | 243 | } | ||
243 | 244 | | |||
244 | // set id to the other correct value, and check that it worked | 245 | // set id to the other correct value, and check that it worked | ||
245 | split.setId("S0003"); | 246 | split.d_func()->setId("S0003"); | ||
246 | try { | 247 | try { | ||
247 | m->removeSplit(split); | 248 | m->removeSplit(split); | ||
248 | QVERIFY(m->splitCount() == 1); | 249 | QVERIFY(m->splitCount() == 1); | ||
Context not available. | |||||
413 | MyMoneyTransaction t; | 414 | MyMoneyTransaction t; | ||
414 | t.setPostDate(QDate(2001, 12, 28)); | 415 | t.setPostDate(QDate(2001, 12, 28)); | ||
415 | t.setEntryDate(QDate(2003, 9, 29)); | 416 | t.setEntryDate(QDate(2003, 9, 29)); | ||
416 | t.setId("T000000000000000001"); | 417 | t.d_func()->setId("T000000000000000001"); | ||
417 | t.setMemo("Wohnung:Miete"); | 418 | t.setMemo("Wohnung:Miete"); | ||
418 | t.setCommodity("EUR"); | 419 | t.setCommodity("EUR"); | ||
419 | t.setValue("key", "value"); | 420 | t.setValue("key", "value"); | ||
Context not available. | |||||
613 | MyMoneyTransaction t; | 614 | MyMoneyTransaction t; | ||
614 | t.setPostDate(QDate(2001, 12, 28)); | 615 | t.setPostDate(QDate(2001, 12, 28)); | ||
615 | t.setEntryDate(QDate(2003, 9, 29)); | 616 | t.setEntryDate(QDate(2003, 9, 29)); | ||
616 | t.setId("T000000000000000001"); | 617 | t.d_func()->setId("T000000000000000001"); | ||
617 | t.setMemo("Wohnung:Miete"); | 618 | t.setMemo("Wohnung:Miete"); | ||
618 | t.setCommodity("EUR"); | 619 | t.setCommodity("EUR"); | ||
619 | t.setValue("key", "value"); | 620 | t.setValue("key", "value"); | ||
Context not available. |