Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/tests/mymoneyfile-test.cpp
Context not available. | |||||
170 | QCOMPARE(m_balanceChanged.count(), 0); | 170 | QCOMPARE(m_balanceChanged.count(), 0); | ||
---|---|---|---|---|---|
171 | QCOMPARE(m_valueChanged.count(), 0); | 171 | QCOMPARE(m_valueChanged.count(), 0); | ||
172 | QCOMPARE(m_objectsAdded[0], QLatin1String("I000001")); | 172 | QCOMPARE(m_objectsAdded[0], QLatin1String("I000001")); | ||
173 | } catch (const MyMoneyException &) { | 173 | } catch (const std::exception &) { | ||
174 | QFAIL("Unexpected exception"); | 174 | QFAIL("Unexpected exception"); | ||
175 | } | 175 | } | ||
176 | 176 | | |||
Context not available. | |||||
179 | try { | 179 | try { | ||
180 | m->addInstitution(institution_id); | 180 | m->addInstitution(institution_id); | ||
181 | QFAIL("Missing expected exception"); | 181 | QFAIL("Missing expected exception"); | ||
182 | } catch (const MyMoneyException &) { | 182 | } catch (const std::exception &) { | ||
183 | ft.commit(); | 183 | ft.commit(); | ||
184 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | 184 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | ||
185 | } | 185 | } | ||
Context not available. | |||||
188 | try { | 188 | try { | ||
189 | m->addInstitution(institution_noname); | 189 | m->addInstitution(institution_noname); | ||
190 | QFAIL("Missing expected exception"); | 190 | QFAIL("Missing expected exception"); | ||
191 | } catch (const MyMoneyException &) { | 191 | } catch (const std::exception &) { | ||
192 | ft.commit(); | 192 | ft.commit(); | ||
193 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | 193 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | ||
194 | } | 194 | } | ||
Context not available. | |||||
222 | QCOMPARE(institution.id(), QLatin1String("I000002")); | 222 | QCOMPARE(institution.id(), QLatin1String("I000002")); | ||
223 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(2)); | 223 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(2)); | ||
224 | QCOMPARE(m->dirty(), true); | 224 | QCOMPARE(m->dirty(), true); | ||
225 | } catch (const MyMoneyException &) { | 225 | } catch (const std::exception &) { | ||
226 | QFAIL("Unexpected exception"); | 226 | QFAIL("Unexpected exception"); | ||
227 | } | 227 | } | ||
228 | 228 | | |||
Context not available. | |||||
238 | QCOMPARE(institution.id(), QLatin1String("I000002")); | 238 | QCOMPARE(institution.id(), QLatin1String("I000002")); | ||
239 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(2)); | 239 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(2)); | ||
240 | QCOMPARE(m->dirty(), false); | 240 | QCOMPARE(m->dirty(), false); | ||
241 | } catch (const MyMoneyException &) { | 241 | } catch (const std::exception &) { | ||
242 | QFAIL("Unexpected exception"); | 242 | QFAIL("Unexpected exception"); | ||
243 | } | 243 | } | ||
244 | } | 244 | } | ||
Context not available. | |||||
271 | QCOMPARE(m_balanceChanged.count(), 0); | 271 | QCOMPARE(m_balanceChanged.count(), 0); | ||
272 | QCOMPARE(m_valueChanged.count(), 0); | 272 | QCOMPARE(m_valueChanged.count(), 0); | ||
273 | QCOMPARE(m_objectsRemoved[0], QLatin1String("I000001")); | 273 | QCOMPARE(m_objectsRemoved[0], QLatin1String("I000001")); | ||
274 | } catch (const MyMoneyException &) { | 274 | } catch (const std::exception &) { | ||
275 | QFAIL("Unexpected exception"); | 275 | QFAIL("Unexpected exception"); | ||
276 | } | 276 | } | ||
277 | 277 | | |||
Context not available. | |||||
280 | try { | 280 | try { | ||
281 | m->institution("I000001"); | 281 | m->institution("I000001"); | ||
282 | QFAIL("Missing expected exception"); | 282 | QFAIL("Missing expected exception"); | ||
283 | } catch (const MyMoneyException &) { | 283 | } catch (const std::exception &) { | ||
284 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | 284 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | ||
285 | QCOMPARE(m->dirty(), false); | 285 | QCOMPARE(m->dirty(), false); | ||
286 | } | 286 | } | ||
Context not available. | |||||
290 | try { | 290 | try { | ||
291 | m->removeInstitution(i); | 291 | m->removeInstitution(i); | ||
292 | QFAIL("Missing expected exception"); | 292 | QFAIL("Missing expected exception"); | ||
293 | } catch (const MyMoneyException &) { | 293 | } catch (const std::exception &) { | ||
294 | ft.commit(); | 294 | ft.commit(); | ||
295 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | 295 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | ||
296 | QCOMPARE(m->dirty(), false); | 296 | QCOMPARE(m->dirty(), false); | ||
Context not available. | |||||
313 | institution = m->institution("I000001"); | 313 | institution = m->institution("I000001"); | ||
314 | QCOMPARE(institution.id(), QLatin1String("I000001")); | 314 | QCOMPARE(institution.id(), QLatin1String("I000001")); | ||
315 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | 315 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | ||
316 | } catch (const MyMoneyException &) { | 316 | } catch (const std::exception &) { | ||
317 | QFAIL("Unexpected exception"); | 317 | QFAIL("Unexpected exception"); | ||
318 | } | 318 | } | ||
319 | 319 | | |||
320 | try { | 320 | try { | ||
321 | institution = m->institution("I000002"); | 321 | institution = m->institution("I000002"); | ||
322 | QFAIL("Missing expected exception"); | 322 | QFAIL("Missing expected exception"); | ||
323 | } catch (const MyMoneyException &) { | 323 | } catch (const std::exception &) { | ||
324 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | 324 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(1)); | ||
325 | } | 325 | } | ||
326 | 326 | | |||
Context not available. | |||||
384 | QCOMPARE(m_balanceChanged.count(), 0); | 384 | QCOMPARE(m_balanceChanged.count(), 0); | ||
385 | QCOMPARE(m_valueChanged.count(), 0); | 385 | QCOMPARE(m_valueChanged.count(), 0); | ||
386 | QCOMPARE(m_objectsModified[0], QLatin1String("I000001")); | 386 | QCOMPARE(m_objectsModified[0], QLatin1String("I000001")); | ||
387 | } catch (const MyMoneyException &) { | 387 | } catch (const std::exception &) { | ||
388 | QFAIL("Unexpected exception"); | 388 | QFAIL("Unexpected exception"); | ||
389 | } | 389 | } | ||
390 | 390 | | |||
Context not available. | |||||
407 | try { | 407 | try { | ||
408 | m->modifyInstitution(failInstitution2); | 408 | m->modifyInstitution(failInstitution2); | ||
409 | QFAIL("Exception expected"); | 409 | QFAIL("Exception expected"); | ||
410 | } catch (const MyMoneyException &) { | 410 | } catch (const std::exception &) { | ||
411 | ft.commit(); | 411 | ft.commit(); | ||
412 | QCOMPARE(failInstitution2.id(), QLatin1String("I000003")); | 412 | QCOMPARE(failInstitution2.id(), QLatin1String("I000003")); | ||
413 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(2)); | 413 | QCOMPARE(m->institutionCount(), static_cast<unsigned>(2)); | ||
Context not available. | |||||
517 | QVERIFY(m_objectsModified.contains(QLatin1String("I000001"))); | 517 | QVERIFY(m_objectsModified.contains(QLatin1String("I000001"))); | ||
518 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | 518 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | ||
519 | 519 | | |||
520 | } catch (const MyMoneyException &) { | 520 | } catch (const std::exception &) { | ||
521 | QFAIL("Unexpected exception!"); | 521 | QFAIL("Unexpected exception!"); | ||
522 | } | 522 | } | ||
523 | 523 | | |||
Context not available. | |||||
527 | MyMoneyAccount parent = m->asset(); | 527 | MyMoneyAccount parent = m->asset(); | ||
528 | m->addAccount(a, parent); | 528 | m->addAccount(a, parent); | ||
529 | QFAIL("Expecting exception!"); | 529 | QFAIL("Expecting exception!"); | ||
530 | } catch (const MyMoneyException &) { | 530 | } catch (const std::exception &) { | ||
531 | ft.commit(); | 531 | ft.commit(); | ||
532 | } | 532 | } | ||
533 | 533 | | |||
Context not available. | |||||
586 | QVERIFY(m_objectsModified.contains(QLatin1String("I000002"))); | 586 | QVERIFY(m_objectsModified.contains(QLatin1String("I000002"))); | ||
587 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | 587 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | ||
588 | 588 | | |||
589 | } catch (const MyMoneyException &) { | 589 | } catch (const std::exception &) { | ||
590 | QFAIL("Unexpected exception!"); | 590 | QFAIL("Unexpected exception!"); | ||
591 | } | 591 | } | ||
592 | 592 | | |||
Context not available. | |||||
632 | QCOMPARE(m->income().accountList().count(), 1); | 632 | QCOMPARE(m->income().accountList().count(), 1); | ||
633 | QCOMPARE(m->income().accountList()[0], QLatin1String("A000001")); | 633 | QCOMPARE(m->income().accountList()[0], QLatin1String("A000001")); | ||
634 | 634 | | |||
635 | } catch (const MyMoneyException &) { | 635 | } catch (const std::exception &) { | ||
636 | QFAIL("Unexpected exception!"); | 636 | QFAIL("Unexpected exception!"); | ||
637 | } | 637 | } | ||
638 | 638 | | |||
Context not available. | |||||
666 | QVERIFY(m_objectsAdded.contains(QLatin1String("A000002"))); | 666 | QVERIFY(m_objectsAdded.contains(QLatin1String("A000002"))); | ||
667 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Expense"))); | 667 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Expense"))); | ||
668 | 668 | | |||
669 | } catch (const MyMoneyException &) { | 669 | } catch (const std::exception &) { | ||
670 | QFAIL("Unexpected exception!"); | 670 | QFAIL("Unexpected exception!"); | ||
671 | } | 671 | } | ||
672 | } | 672 | } | ||
Context not available. | |||||
701 | QCOMPARE(m_valueChanged.count(), 0); | 701 | QCOMPARE(m_valueChanged.count(), 0); | ||
702 | QVERIFY(m_objectsModified.contains(QLatin1String("A000001"))); | 702 | QVERIFY(m_objectsModified.contains(QLatin1String("A000001"))); | ||
703 | 703 | | |||
704 | } catch (const MyMoneyException &) { | 704 | } catch (const std::exception &) { | ||
705 | QFAIL("Unexpected exception!"); | 705 | QFAIL("Unexpected exception!"); | ||
706 | } | 706 | } | ||
707 | storage->d_func()->m_dirty = false; | 707 | storage->d_func()->m_dirty = false; | ||
Context not available. | |||||
737 | QVERIFY(m_objectsModified.contains(QLatin1String("I000001"))); | 737 | QVERIFY(m_objectsModified.contains(QLatin1String("I000001"))); | ||
738 | QVERIFY(m_objectsModified.contains(QLatin1String("I000002"))); | 738 | QVERIFY(m_objectsModified.contains(QLatin1String("I000002"))); | ||
739 | 739 | | |||
740 | } catch (const MyMoneyException &) { | 740 | } catch (const std::exception &) { | ||
741 | QFAIL("Unexpected exception!"); | 741 | QFAIL("Unexpected exception!"); | ||
742 | } | 742 | } | ||
743 | storage->d_func()->m_dirty = false; | 743 | storage->d_func()->m_dirty = false; | ||
Context not available. | |||||
754 | QCOMPARE(p.accountType(), eMyMoney::Account::Type::Savings); | 754 | QCOMPARE(p.accountType(), eMyMoney::Account::Type::Savings); | ||
755 | QCOMPARE(p.name(), QLatin1String("New account name")); | 755 | QCOMPARE(p.name(), QLatin1String("New account name")); | ||
756 | 756 | | |||
757 | } catch (const MyMoneyException &) { | 757 | } catch (const std::exception &) { | ||
758 | QFAIL("Unexpected exception!"); | 758 | QFAIL("Unexpected exception!"); | ||
759 | } | 759 | } | ||
760 | storage->d_func()->m_dirty = false; | 760 | storage->d_func()->m_dirty = false; | ||
Context not available. | |||||
765 | try { | 765 | try { | ||
766 | m->modifyAccount(p); | 766 | m->modifyAccount(p); | ||
767 | QFAIL("Expecting exception!"); | 767 | QFAIL("Expecting exception!"); | ||
768 | } catch (const MyMoneyException &) { | 768 | } catch (const std::exception &) { | ||
769 | ft.commit(); | 769 | ft.commit(); | ||
770 | } | 770 | } | ||
771 | storage->d_func()->m_dirty = false; | 771 | storage->d_func()->m_dirty = false; | ||
Context not available. | |||||
776 | try { | 776 | try { | ||
777 | m->modifyAccount(p); | 777 | m->modifyAccount(p); | ||
778 | QFAIL("Expecting exception!"); | 778 | QFAIL("Expecting exception!"); | ||
779 | } catch (const MyMoneyException &) { | 779 | } catch (const std::exception &) { | ||
780 | ft.commit(); | 780 | ft.commit(); | ||
781 | } | 781 | } | ||
782 | } | 782 | } | ||
Context not available. | |||||
817 | 817 | | |||
818 | o = m->account(o.id()); | 818 | o = m->account(o.id()); | ||
819 | QCOMPARE(o.accountCount(), 1); | 819 | QCOMPARE(o.accountCount(), 1); | ||
820 | } catch (const MyMoneyException &) { | 820 | } catch (const std::exception &) { | ||
821 | QFAIL("Unexpected exception!"); | 821 | QFAIL("Unexpected exception!"); | ||
822 | } | 822 | } | ||
823 | } | 823 | } | ||
Context not available. | |||||
830 | try { | 830 | try { | ||
831 | m->removeAccount(acc); | 831 | m->removeAccount(acc); | ||
832 | QFAIL(qPrintable(txt)); | 832 | QFAIL(qPrintable(txt)); | ||
833 | } catch (const MyMoneyException &) { | 833 | } catch (const std::exception &) { | ||
834 | ft.commit(); | 834 | ft.commit(); | ||
835 | } | 835 | } | ||
836 | } | 836 | } | ||
Context not available. | |||||
853 | MyMoneyAccount q("Ainvalid", p); | 853 | MyMoneyAccount q("Ainvalid", p); | ||
854 | m->removeAccount(q); | 854 | m->removeAccount(q); | ||
855 | QFAIL("Exception expected!"); | 855 | QFAIL("Exception expected!"); | ||
856 | } catch (const MyMoneyException &) { | 856 | } catch (const std::exception &) { | ||
857 | ft.commit(); | 857 | ft.commit(); | ||
858 | } | 858 | } | ||
859 | 859 | | |||
Context not available. | |||||
884 | institution = m->institution("I000002"); | 884 | institution = m->institution("I000002"); | ||
885 | QCOMPARE(institution.accountCount(), static_cast<unsigned>(1)); | 885 | QCOMPARE(institution.accountCount(), static_cast<unsigned>(1)); | ||
886 | 886 | | |||
887 | } catch (const MyMoneyException &) { | 887 | } catch (const std::exception &) { | ||
888 | QFAIL("Unexpected exception!"); | 888 | QFAIL("Unexpected exception!"); | ||
889 | } | 889 | } | ||
890 | 890 | | |||
Context not available. | |||||
918 | QVERIFY(m_objectsModified.contains(QLatin1String("I000002"))); | 918 | QVERIFY(m_objectsModified.contains(QLatin1String("I000002"))); | ||
919 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | 919 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | ||
920 | 920 | | |||
921 | } catch (const MyMoneyException &) { | 921 | } catch (const std::exception &) { | ||
922 | QFAIL("Unexpected exception!"); | 922 | QFAIL("Unexpected exception!"); | ||
923 | } | 923 | } | ||
924 | QCOMPARE(m->accountCount(), static_cast<unsigned>(6)); | 924 | QCOMPARE(m->accountCount(), static_cast<unsigned>(6)); | ||
Context not available. | |||||
927 | try { | 927 | try { | ||
928 | m->account("A000002"); | 928 | m->account("A000002"); | ||
929 | QFAIL("Exception expected!"); | 929 | QFAIL("Exception expected!"); | ||
930 | } catch (const MyMoneyException &) { | 930 | } catch (const std::exception &) { | ||
931 | } | 931 | } | ||
932 | 932 | | |||
933 | // make sure that children are re-parented to parent account | 933 | // make sure that children are re-parented to parent account | ||
934 | try { | 934 | try { | ||
935 | a = m->account("A000001"); | 935 | a = m->account("A000001"); | ||
936 | QCOMPARE(a.parentAccountId(), m->asset().id()); | 936 | QCOMPARE(a.parentAccountId(), m->asset().id()); | ||
937 | } catch (const MyMoneyException &) { | 937 | } catch (const std::exception &) { | ||
938 | QFAIL("Unexpected exception!"); | 938 | QFAIL("Unexpected exception!"); | ||
939 | } | 939 | } | ||
940 | } | 940 | } | ||
Context not available. | |||||
978 | m->addAccount(exp1, parent); | 978 | m->addAccount(exp1, parent); | ||
979 | m->addAccount(exp2, parent); | 979 | m->addAccount(exp2, parent); | ||
980 | ft.commit(); | 980 | ft.commit(); | ||
981 | } catch (const MyMoneyException &) { | 981 | } catch (const std::exception &) { | ||
982 | QFAIL("Unexpected exception!"); | 982 | QFAIL("Unexpected exception!"); | ||
983 | } | 983 | } | ||
984 | 984 | | |||
Context not available. | |||||
990 | try { | 990 | try { | ||
991 | m->modifyAccount(a); | 991 | m->modifyAccount(a); | ||
992 | ft.commit(); | 992 | ft.commit(); | ||
993 | } catch (const MyMoneyException &) { | 993 | } catch (const std::exception &) { | ||
994 | QFAIL("Unexpected exception!"); | 994 | QFAIL("Unexpected exception!"); | ||
995 | } | 995 | } | ||
996 | ft.restart(); | 996 | ft.restart(); | ||
Context not available. | |||||
1015 | try { | 1015 | try { | ||
1016 | t.addSplit(split1); | 1016 | t.addSplit(split1); | ||
1017 | t.addSplit(split2); | 1017 | t.addSplit(split2); | ||
1018 | } catch (const MyMoneyException &) { | 1018 | } catch (const std::exception &) { | ||
1019 | QFAIL("Unexpected exception!"); | 1019 | QFAIL("Unexpected exception!"); | ||
1020 | } | 1020 | } | ||
1021 | 1021 | | |||
Context not available. | |||||
1042 | QCOMPARE(m_balanceChanged.count("A000001"), 1); | 1042 | QCOMPARE(m_balanceChanged.count("A000001"), 1); | ||
1043 | QCOMPARE(m_balanceChanged.count("A000003"), 1); | 1043 | QCOMPARE(m_balanceChanged.count("A000003"), 1); | ||
1044 | QCOMPARE(m_valueChanged.count(), 0); | 1044 | QCOMPARE(m_valueChanged.count(), 0); | ||
1045 | } catch (const MyMoneyException &) { | 1045 | } catch (const std::exception &) { | ||
1046 | QFAIL("Unexpected exception!"); | 1046 | QFAIL("Unexpected exception!"); | ||
1047 | } | 1047 | } | ||
1048 | ft.restart(); | 1048 | ft.restart(); | ||
Context not available. | |||||
1074 | QCOMPARE(p.memo(), QLatin1String("Memotext")); | 1074 | QCOMPARE(p.memo(), QLatin1String("Memotext")); | ||
1075 | QCOMPARE(p.splits()[0].accountId(), QLatin1String("A000001")); | 1075 | QCOMPARE(p.splits()[0].accountId(), QLatin1String("A000001")); | ||
1076 | QCOMPARE(p.splits()[1].accountId(), QLatin1String("A000003")); | 1076 | QCOMPARE(p.splits()[1].accountId(), QLatin1String("A000003")); | ||
1077 | } catch (const MyMoneyException &) { | 1077 | } catch (const std::exception &) { | ||
1078 | QFAIL("Unexpected exception!"); | 1078 | QFAIL("Unexpected exception!"); | ||
1079 | } | 1079 | } | ||
1080 | 1080 | | |||
Context not available. | |||||
1089 | QCOMPARE(p.memo(), QLatin1String("Memotext")); | 1089 | QCOMPARE(p.memo(), QLatin1String("Memotext")); | ||
1090 | QCOMPARE(p.splits()[0].accountId(), QLatin1String("A000001")); | 1090 | QCOMPARE(p.splits()[0].accountId(), QLatin1String("A000001")); | ||
1091 | QCOMPARE(p.splits()[1].accountId(), QLatin1String("A000003")); | 1091 | QCOMPARE(p.splits()[1].accountId(), QLatin1String("A000003")); | ||
1092 | } catch (const MyMoneyException &) { | 1092 | } catch (const std::exception &) { | ||
1093 | QFAIL("Unexpected exception!"); | 1093 | QFAIL("Unexpected exception!"); | ||
1094 | } | 1094 | } | ||
1095 | 1095 | | |||
Context not available. | |||||
1102 | QCOMPARE(p.memo(), QLatin1String("Memotext")); | 1102 | QCOMPARE(p.memo(), QLatin1String("Memotext")); | ||
1103 | QCOMPARE(p.splits()[0].accountId(), QLatin1String("A000001")); | 1103 | QCOMPARE(p.splits()[0].accountId(), QLatin1String("A000001")); | ||
1104 | QCOMPARE(p.splits()[1].accountId(), QLatin1String("A000003")); | 1104 | QCOMPARE(p.splits()[1].accountId(), QLatin1String("A000003")); | ||
1105 | } catch (const MyMoneyException &) { | 1105 | } catch (const std::exception &) { | ||
1106 | QFAIL("Unexpected exception!"); | 1106 | QFAIL("Unexpected exception!"); | ||
1107 | } | 1107 | } | ||
1108 | } | 1108 | } | ||
Context not available. | |||||
1150 | QCOMPARE(t.memo(), QLatin1String("New Memotext")); | 1150 | QCOMPARE(t.memo(), QLatin1String("New Memotext")); | ||
1151 | QCOMPARE(m->dirty(), true); | 1151 | QCOMPARE(m->dirty(), true); | ||
1152 | 1152 | | |||
1153 | } catch (const MyMoneyException &) { | 1153 | } catch (const std::exception &) { | ||
1154 | QFAIL("Unexpected exception!"); | 1154 | QFAIL("Unexpected exception!"); | ||
1155 | } | 1155 | } | ||
1156 | } | 1156 | } | ||
Context not available. | |||||
1183 | QCOMPARE(m_balanceChanged.count(QLatin1String("A000001")), 1); | 1183 | QCOMPARE(m_balanceChanged.count(QLatin1String("A000001")), 1); | ||
1184 | QCOMPARE(m_balanceChanged.count(QLatin1String("A000003")), 1); | 1184 | QCOMPARE(m_balanceChanged.count(QLatin1String("A000003")), 1); | ||
1185 | QCOMPARE(m_valueChanged.count(), 0); | 1185 | QCOMPARE(m_valueChanged.count(), 0); | ||
1186 | } catch (const MyMoneyException &) { | 1186 | } catch (const std::exception &) { | ||
1187 | QFAIL("Unexpected exception!"); | 1187 | QFAIL("Unexpected exception!"); | ||
1188 | } | 1188 | } | ||
1189 | } | 1189 | } | ||
Context not available. | |||||
1231 | QCOMPARE(m_valueChanged.count(), 0); | 1231 | QCOMPARE(m_valueChanged.count(), 0); | ||
1232 | 1232 | | |||
1233 | 1233 | | |||
1234 | } catch (const MyMoneyException &) { | 1234 | } catch (const std::exception &) { | ||
1235 | QFAIL("Unexpected exception!"); | 1235 | QFAIL("Unexpected exception!"); | ||
1236 | } | 1236 | } | ||
1237 | } | 1237 | } | ||
Context not available. | |||||
1266 | QCOMPARE(m_balanceChanged.count(QLatin1String("A000003")), 1); | 1266 | QCOMPARE(m_balanceChanged.count(QLatin1String("A000003")), 1); | ||
1267 | QCOMPARE(m_valueChanged.count(), 0); | 1267 | QCOMPARE(m_valueChanged.count(), 0); | ||
1268 | 1268 | | |||
1269 | } catch (const MyMoneyException &) { | 1269 | } catch (const std::exception &) { | ||
1270 | QFAIL("Unexpected exception!"); | 1270 | QFAIL("Unexpected exception!"); | ||
1271 | } | 1271 | } | ||
1272 | } | 1272 | } | ||
Context not available. | |||||
1289 | QCOMPARE(m->account("A000001").transactionCount(), 0); | 1289 | QCOMPARE(m->account("A000001").transactionCount(), 0); | ||
1290 | QCOMPARE(m->account("A000002").transactionCount(), 1); | 1290 | QCOMPARE(m->account("A000002").transactionCount(), 1); | ||
1291 | QCOMPARE(m->account("A000003").transactionCount(), 1); | 1291 | QCOMPARE(m->account("A000003").transactionCount(), 1); | ||
1292 | } catch(const MyMoneyException &e) { | 1292 | } catch (const std::exception &e) { | ||
1293 | QFAIL("Unexpected exception!"); | 1293 | QFAIL("Unexpected exception!"); | ||
1294 | } | 1294 | } | ||
1295 | } | 1295 | } | ||
Context not available. | |||||
1345 | QVERIFY(m->balance("A000001", QDate(2002, 1, 15)).isZero()); | 1345 | QVERIFY(m->balance("A000001", QDate(2002, 1, 15)).isZero()); | ||
1346 | QVERIFY(m->balance("A000002", QDate(2002, 1, 15)).isZero()); | 1346 | QVERIFY(m->balance("A000002", QDate(2002, 1, 15)).isZero()); | ||
1347 | 1347 | | |||
1348 | } catch (const MyMoneyException &) { | 1348 | } catch (const std::exception &) { | ||
1349 | QFAIL("Unexpected exception!"); | 1349 | QFAIL("Unexpected exception!"); | ||
1350 | } | 1350 | } | ||
1351 | 1351 | | |||
Context not available. | |||||
1354 | // Account not found for balance() | 1354 | // Account not found for balance() | ||
1355 | QVERIFY(m->balance("A000005").isZero()); | 1355 | QVERIFY(m->balance("A000005").isZero()); | ||
1356 | QFAIL("Exception expected"); | 1356 | QFAIL("Exception expected"); | ||
1357 | } catch (const MyMoneyException &) { | 1357 | } catch (const std::exception &) { | ||
1358 | } | 1358 | } | ||
1359 | 1359 | | |||
1360 | try { | 1360 | try { | ||
1361 | // Account not found for totalBalance() | 1361 | // Account not found for totalBalance() | ||
1362 | QVERIFY(m->totalBalance("A000005").isZero()); | 1362 | QVERIFY(m->totalBalance("A000005").isZero()); | ||
1363 | QFAIL("Exception expected"); | 1363 | QFAIL("Exception expected"); | ||
1364 | } catch (const MyMoneyException &) { | 1364 | } catch (const std::exception &) { | ||
1365 | } | 1365 | } | ||
1366 | 1366 | | |||
1367 | } | 1367 | } | ||
Context not available. | |||||
1380 | QCOMPARE(m_valueChanged.count(), 0); | 1380 | QCOMPARE(m_valueChanged.count(), 0); | ||
1381 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Liability"))); | 1381 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Liability"))); | ||
1382 | 1382 | | |||
1383 | } catch (const MyMoneyException &) { | 1383 | } catch (const std::exception &) { | ||
1384 | QFAIL("Unexpected exception"); | 1384 | QFAIL("Unexpected exception"); | ||
1385 | } | 1385 | } | ||
1386 | ft.restart(); | 1386 | ft.restart(); | ||
Context not available. | |||||
1395 | QCOMPARE(m_valueChanged.count(), 0); | 1395 | QCOMPARE(m_valueChanged.count(), 0); | ||
1396 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | 1396 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | ||
1397 | 1397 | | |||
1398 | } catch (const MyMoneyException &) { | 1398 | } catch (const std::exception &) { | ||
1399 | QFAIL("Unexpected exception"); | 1399 | QFAIL("Unexpected exception"); | ||
1400 | } | 1400 | } | ||
1401 | ft.restart(); | 1401 | ft.restart(); | ||
Context not available. | |||||
1410 | QCOMPARE(m_valueChanged.count(), 0); | 1410 | QCOMPARE(m_valueChanged.count(), 0); | ||
1411 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Expense"))); | 1411 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Expense"))); | ||
1412 | 1412 | | |||
1413 | } catch (const MyMoneyException &) { | 1413 | } catch (const std::exception &) { | ||
1414 | QFAIL("Unexpected exception"); | 1414 | QFAIL("Unexpected exception"); | ||
1415 | } | 1415 | } | ||
1416 | ft.restart(); | 1416 | ft.restart(); | ||
Context not available. | |||||
1425 | QCOMPARE(m_valueChanged.count(), 0); | 1425 | QCOMPARE(m_valueChanged.count(), 0); | ||
1426 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Income"))); | 1426 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Income"))); | ||
1427 | 1427 | | |||
1428 | } catch (const MyMoneyException &) { | 1428 | } catch (const std::exception &) { | ||
1429 | QFAIL("Unexpected exception"); | 1429 | QFAIL("Unexpected exception"); | ||
1430 | } | 1430 | } | ||
1431 | ft.restart(); | 1431 | ft.restart(); | ||
Context not available. | |||||
1439 | m->setAccountName("A000001", "New account name"); | 1439 | m->setAccountName("A000001", "New account name"); | ||
1440 | ft.commit(); | 1440 | ft.commit(); | ||
1441 | QFAIL("Exception expected"); | 1441 | QFAIL("Exception expected"); | ||
1442 | } catch (const MyMoneyException &) { | 1442 | } catch (const std::exception &) { | ||
1443 | } | 1443 | } | ||
1444 | } | 1444 | } | ||
1445 | 1445 | | |||
Context not available. | |||||
1463 | QCOMPARE(m_valueChanged.count(), 0); | 1463 | QCOMPARE(m_valueChanged.count(), 0); | ||
1464 | 1464 | | |||
1465 | QVERIFY(m_objectsAdded.contains(QLatin1String("P000001"))); | 1465 | QVERIFY(m_objectsAdded.contains(QLatin1String("P000001"))); | ||
1466 | } catch (const MyMoneyException &) { | 1466 | } catch (const std::exception &) { | ||
1467 | QFAIL("Unexpected exception"); | 1467 | QFAIL("Unexpected exception"); | ||
1468 | } | 1468 | } | ||
1469 | } | 1469 | } | ||
Context not available. | |||||
1491 | QCOMPARE(m_valueChanged.count(), 0); | 1491 | QCOMPARE(m_valueChanged.count(), 0); | ||
1492 | 1492 | | |||
1493 | QVERIFY(m_objectsModified.contains(QLatin1String("P000001"))); | 1493 | QVERIFY(m_objectsModified.contains(QLatin1String("P000001"))); | ||
1494 | } catch (const MyMoneyException &) { | 1494 | } catch (const std::exception &) { | ||
1495 | QFAIL("Unexpected exception"); | 1495 | QFAIL("Unexpected exception"); | ||
1496 | } | 1496 | } | ||
1497 | } | 1497 | } | ||
Context not available. | |||||
1519 | 1519 | | |||
1520 | QVERIFY(m_objectsRemoved.contains(QLatin1String("P000001"))); | 1520 | QVERIFY(m_objectsRemoved.contains(QLatin1String("P000001"))); | ||
1521 | 1521 | | |||
1522 | } catch (const MyMoneyException &) { | 1522 | } catch (const std::exception &) { | ||
1523 | QFAIL("Unexpected exception"); | 1523 | QFAIL("Unexpected exception"); | ||
1524 | } | 1524 | } | ||
1525 | } | 1525 | } | ||
Context not available. | |||||
1553 | QFAIL("Unexpected exception"); | 1553 | QFAIL("Unexpected exception"); | ||
1554 | } | 1554 | } | ||
1555 | QCOMPARE(iban->electronicIban(), QLatin1String("DE82200700240066644600")); | 1555 | QCOMPARE(iban->electronicIban(), QLatin1String("DE82200700240066644600")); | ||
1556 | } catch (const MyMoneyException& e) { | 1556 | } catch (const std::exception &e) { | ||
1557 | unexpectedException(e); | 1557 | unexpectedException(e); | ||
1558 | } | 1558 | } | ||
1559 | } | 1559 | } | ||
Context not available. | |||||
1582 | try { | 1582 | try { | ||
1583 | t.addSplit(split1); | 1583 | t.addSplit(split1); | ||
1584 | t.addSplit(split2); | 1584 | t.addSplit(split2); | ||
1585 | } catch (const MyMoneyException &) { | 1585 | } catch (const std::exception &) { | ||
1586 | QFAIL("Unexpected exception!"); | 1586 | QFAIL("Unexpected exception!"); | ||
1587 | } | 1587 | } | ||
1588 | 1588 | | |||
Context not available. | |||||
1602 | m->addTransaction(t); | 1602 | m->addTransaction(t); | ||
1603 | ft.commit(); | 1603 | ft.commit(); | ||
1604 | QFAIL("Missing expected exception!"); | 1604 | QFAIL("Missing expected exception!"); | ||
1605 | } catch (const MyMoneyException &) { | 1605 | } catch (const std::exception &) { | ||
1606 | } | 1606 | } | ||
1607 | 1607 | | |||
1608 | QCOMPARE(m->dirty(), false); | 1608 | QCOMPARE(m->dirty(), false); | ||
Context not available. | |||||
1617 | try { | 1617 | try { | ||
1618 | file->attachStorage(store); | 1618 | file->attachStorage(store); | ||
1619 | QCOMPARE(file->storageAttached(), true); | 1619 | QCOMPARE(file->storageAttached(), true); | ||
1620 | } catch (const MyMoneyException &) { | 1620 | } catch (const std::exception &) { | ||
1621 | QFAIL("Unexpected exception!"); | 1621 | QFAIL("Unexpected exception!"); | ||
1622 | } | 1622 | } | ||
1623 | 1623 | | |||
1624 | try { | 1624 | try { | ||
1625 | file->attachStorage(store); | 1625 | file->attachStorage(store); | ||
1626 | QFAIL("Exception expected!"); | 1626 | QFAIL("Exception expected!"); | ||
1627 | } catch (const MyMoneyException &) { | 1627 | } catch (const std::exception &) { | ||
1628 | } | 1628 | } | ||
1629 | 1629 | | |||
1630 | try { | 1630 | try { | ||
1631 | file->attachStorage(0); | 1631 | file->attachStorage(0); | ||
1632 | QFAIL("Exception expected!"); | 1632 | QFAIL("Exception expected!"); | ||
1633 | } catch (const MyMoneyException &) { | 1633 | } catch (const std::exception &) { | ||
1634 | } | 1634 | } | ||
1635 | 1635 | | |||
1636 | try { | 1636 | try { | ||
1637 | file->detachStorage(store); | 1637 | file->detachStorage(store); | ||
1638 | QCOMPARE(file->storageAttached(), false); | 1638 | QCOMPARE(file->storageAttached(), false); | ||
1639 | } catch (const MyMoneyException &) { | 1639 | } catch (const std::exception &) { | ||
1640 | QFAIL("Unexpected exception!"); | 1640 | QFAIL("Unexpected exception!"); | ||
1641 | } | 1641 | } | ||
1642 | 1642 | | |||
Context not available. | |||||
1665 | QCOMPARE(m->categoryToAccount("Expense1"), QLatin1String("A000003")); | 1665 | QCOMPARE(m->categoryToAccount("Expense1"), QLatin1String("A000003")); | ||
1666 | QCOMPARE(m->categoryToAccount("Expense1:Expense2"), QLatin1String("A000004")); | 1666 | QCOMPARE(m->categoryToAccount("Expense1:Expense2"), QLatin1String("A000004")); | ||
1667 | QVERIFY(m->categoryToAccount("Acc2").isEmpty()); | 1667 | QVERIFY(m->categoryToAccount("Acc2").isEmpty()); | ||
1668 | } catch (const MyMoneyException &e) { | 1668 | } catch (const std::exception &e) { | ||
1669 | unexpectedException(e); | 1669 | unexpectedException(e); | ||
1670 | } | 1670 | } | ||
1671 | } | 1671 | } | ||
Context not available. | |||||
1700 | QCOMPARE(m->hasAccount("A000001", "Account3"), true); | 1700 | QCOMPARE(m->hasAccount("A000001", "Account3"), true); | ||
1701 | QCOMPARE(m->hasAccount("A000001", "Account2"), false); | 1701 | QCOMPARE(m->hasAccount("A000001", "Account2"), false); | ||
1702 | QCOMPARE(m->hasAccount("A000002", "Account3"), false); | 1702 | QCOMPARE(m->hasAccount("A000002", "Account3"), false); | ||
1703 | } catch (const MyMoneyException &e) { | 1703 | } catch (const std::exception &e) { | ||
1704 | unexpectedException(e); | 1704 | unexpectedException(e); | ||
1705 | } | 1705 | } | ||
1706 | } | 1706 | } | ||
Context not available. | |||||
1716 | MyMoneyAccount parent = m->asset(); | 1716 | MyMoneyAccount parent = m->asset(); | ||
1717 | m->addAccount(i, parent); | 1717 | m->addAccount(i, parent); | ||
1718 | ft.commit(); | 1718 | ft.commit(); | ||
1719 | } catch (const MyMoneyException &e) { | 1719 | } catch (const std::exception &e) { | ||
1720 | unexpectedException(e); | 1720 | unexpectedException(e); | ||
1721 | } | 1721 | } | ||
1722 | // keep a copy for later use | 1722 | // keep a copy for later use | ||
Context not available. | |||||
1750 | m->addAccount(a, i); | 1750 | m->addAccount(a, i); | ||
1751 | sprintf(msg, "Can add non-equity type %d to investment", (int)*it); | 1751 | sprintf(msg, "Can add non-equity type %d to investment", (int)*it); | ||
1752 | QFAIL(msg); | 1752 | QFAIL(msg); | ||
1753 | } catch (const MyMoneyException &) { | 1753 | } catch (const std::exception &) { | ||
1754 | ft.commit(); | 1754 | ft.commit(); | ||
1755 | } | 1755 | } | ||
1756 | } | 1756 | } | ||
Context not available. | |||||
1760 | a.setAccountType(eMyMoney::Account::Type::Stock); | 1760 | a.setAccountType(eMyMoney::Account::Type::Stock); | ||
1761 | m->addAccount(a, i); | 1761 | m->addAccount(a, i); | ||
1762 | ft.commit(); | 1762 | ft.commit(); | ||
1763 | } catch (const MyMoneyException &e) { | 1763 | } catch (const std::exception &e) { | ||
1764 | unexpectedException(e); | 1764 | unexpectedException(e); | ||
1765 | } | 1765 | } | ||
1766 | } | 1766 | } | ||
Context not available. | |||||
1808 | try { | 1808 | try { | ||
1809 | m->reparentAccount(stock, inv); | 1809 | m->reparentAccount(stock, inv); | ||
1810 | ft.commit(); | 1810 | ft.commit(); | ||
1811 | } catch (const MyMoneyException &e) { | 1811 | } catch (const std::exception &e) { | ||
1812 | unexpectedException(e); | 1812 | unexpectedException(e); | ||
1813 | } | 1813 | } | ||
1814 | } | 1814 | } | ||
Context not available. | |||||
1829 | m->reparentAccount(stock, a); | 1829 | m->reparentAccount(stock, a); | ||
1830 | sprintf(msg, "Can reparent stock to non-investment type %d account", (int)*it); | 1830 | sprintf(msg, "Can reparent stock to non-investment type %d account", (int)*it); | ||
1831 | QFAIL(msg); | 1831 | QFAIL(msg); | ||
1832 | } catch (const MyMoneyException &) { | 1832 | } catch (const std::exception &) { | ||
1833 | ft.commit(); | 1833 | ft.commit(); | ||
1834 | } | 1834 | } | ||
1835 | ft.restart(); | 1835 | ft.restart(); | ||
Context not available. | |||||
1845 | try { | 1845 | try { | ||
1846 | ref = m->baseCurrency(); | 1846 | ref = m->baseCurrency(); | ||
1847 | QVERIFY(ref.id().isEmpty()); | 1847 | QVERIFY(ref.id().isEmpty()); | ||
1848 | } catch (const MyMoneyException &e) { | 1848 | } catch (const std::exception &e) { | ||
1849 | unexpectedException(e); | 1849 | unexpectedException(e); | ||
1850 | } | 1850 | } | ||
1851 | 1851 | | |||
Context not available. | |||||
1853 | try { | 1853 | try { | ||
1854 | m->setBaseCurrency(base); | 1854 | m->setBaseCurrency(base); | ||
1855 | QFAIL("Missing expected exception"); | 1855 | QFAIL("Missing expected exception"); | ||
1856 | } catch (const MyMoneyException &) { | 1856 | } catch (const std::exception &) { | ||
1857 | } | 1857 | } | ||
1858 | 1858 | | |||
1859 | MyMoneyFileTransaction ft; | 1859 | MyMoneyFileTransaction ft; | ||
Context not available. | |||||
1862 | m->addCurrency(base); | 1862 | m->addCurrency(base); | ||
1863 | m->setBaseCurrency(base); | 1863 | m->setBaseCurrency(base); | ||
1864 | ft.commit(); | 1864 | ft.commit(); | ||
1865 | } catch (const MyMoneyException &e) { | 1865 | } catch (const std::exception &e) { | ||
1866 | unexpectedException(e); | 1866 | unexpectedException(e); | ||
1867 | } | 1867 | } | ||
1868 | ft.restart(); | 1868 | ft.restart(); | ||
Context not available. | |||||
1873 | QCOMPARE(ref.id(), QLatin1String("EUR")); | 1873 | QCOMPARE(ref.id(), QLatin1String("EUR")); | ||
1874 | QCOMPARE(ref.name(), QLatin1String("Euro")); | 1874 | QCOMPARE(ref.name(), QLatin1String("Euro")); | ||
1875 | QVERIFY(ref.tradingSymbol() == QChar(0x20ac)); | 1875 | QVERIFY(ref.tradingSymbol() == QChar(0x20ac)); | ||
1876 | } catch (const MyMoneyException &e) { | 1876 | } catch (const std::exception &e) { | ||
1877 | unexpectedException(e); | 1877 | unexpectedException(e); | ||
1878 | } | 1878 | } | ||
1879 | 1879 | | |||
Context not available. | |||||
1905 | base = m->baseCurrency(); | 1905 | base = m->baseCurrency(); | ||
1906 | openingAcc = m->openingBalanceAccount(base); | 1906 | openingAcc = m->openingBalanceAccount(base); | ||
1907 | QFAIL("Missing expected exception"); | 1907 | QFAIL("Missing expected exception"); | ||
1908 | } catch (const MyMoneyException &) { | 1908 | } catch (const std::exception &) { | ||
1909 | } | 1909 | } | ||
1910 | } | 1910 | } | ||
1911 | 1911 | | |||
Context not available. | |||||
1920 | QCOMPARE(openingAcc.parentAccountId(), m->equity().id()); | 1920 | QCOMPARE(openingAcc.parentAccountId(), m->equity().id()); | ||
1921 | QCOMPARE(openingAcc.name(), MyMoneyFile::openingBalancesPrefix()); | 1921 | QCOMPARE(openingAcc.name(), MyMoneyFile::openingBalancesPrefix()); | ||
1922 | QCOMPARE(openingAcc.openingDate(), QDate::currentDate()); | 1922 | QCOMPARE(openingAcc.openingDate(), QDate::currentDate()); | ||
1923 | } catch (const MyMoneyException &e) { | 1923 | } catch (const std::exception &e) { | ||
1924 | unexpectedException(e); | 1924 | unexpectedException(e); | ||
1925 | } | 1925 | } | ||
1926 | 1926 | | |||
Context not available. | |||||
1929 | try { | 1929 | try { | ||
1930 | m->addCurrency(second); | 1930 | m->addCurrency(second); | ||
1931 | ft.commit(); | 1931 | ft.commit(); | ||
1932 | } catch (const MyMoneyException &e) { | 1932 | } catch (const std::exception &e) { | ||
1933 | unexpectedException(e); | 1933 | unexpectedException(e); | ||
1934 | } | 1934 | } | ||
1935 | 1935 | | |||
Context not available. | |||||
1939 | QCOMPARE(openingAcc.parentAccountId(), m->equity().id()); | 1939 | QCOMPARE(openingAcc.parentAccountId(), m->equity().id()); | ||
1940 | QCOMPARE(openingAcc.name(), refName); | 1940 | QCOMPARE(openingAcc.name(), refName); | ||
1941 | QCOMPARE(openingAcc.openingDate(), QDate::currentDate()); | 1941 | QCOMPARE(openingAcc.openingDate(), QDate::currentDate()); | ||
1942 | } catch (const MyMoneyException &e) { | 1942 | } catch (const std::exception &e) { | ||
1943 | unexpectedException(e); | 1943 | unexpectedException(e); | ||
1944 | } | 1944 | } | ||
1945 | } | 1945 | } | ||
Context not available. | |||||
1962 | 1962 | | |||
1963 | QCOMPARE(m->asset().name(), QLatin1String("Anlagen")); | 1963 | QCOMPARE(m->asset().name(), QLatin1String("Anlagen")); | ||
1964 | QCOMPARE(m->asset().currencyId(), m->baseCurrency().id()); | 1964 | QCOMPARE(m->asset().currencyId(), m->baseCurrency().id()); | ||
1965 | } catch (const MyMoneyException &e) { | 1965 | } catch (const std::exception &e) { | ||
1966 | unexpectedException(e); | 1966 | unexpectedException(e); | ||
1967 | } | 1967 | } | ||
1968 | 1968 | | |||
Context not available. | |||||
1972 | acc.setNumber("Test"); | 1972 | acc.setNumber("Test"); | ||
1973 | m->modifyAccount(acc); | 1973 | m->modifyAccount(acc); | ||
1974 | QFAIL("Missing expected exception"); | 1974 | QFAIL("Missing expected exception"); | ||
1975 | } catch (const MyMoneyException &) { | 1975 | } catch (const std::exception &) { | ||
1976 | ft.rollback(); | 1976 | ft.rollback(); | ||
1977 | } | 1977 | } | ||
1978 | 1978 | | |||
Context not available. | |||||
1992 | ft.commit(); | 1992 | ft.commit(); | ||
1993 | 1993 | | |||
1994 | QCOMPARE(m->account("A000002").currencyId(), QLatin1String("RON")); | 1994 | QCOMPARE(m->account("A000002").currencyId(), QLatin1String("RON")); | ||
1995 | } catch (const MyMoneyException &e) { | 1995 | } catch (const std::exception &e) { | ||
1996 | unexpectedException(e); | 1996 | unexpectedException(e); | ||
1997 | } | 1997 | } | ||
1998 | 1998 | | |||
Context not available. | |||||
2103 | m->addAccount(a, parent); | 2103 | m->addAccount(a, parent); | ||
2104 | ft.commit(); | 2104 | ft.commit(); | ||
2105 | QCOMPARE(m->account("A000001").currencyId(), QLatin1String("EUR")); | 2105 | QCOMPARE(m->account("A000001").currencyId(), QLatin1String("EUR")); | ||
2106 | } catch (const MyMoneyException &e) { | 2106 | } catch (const std::exception &e) { | ||
2107 | unexpectedException(e); | 2107 | unexpectedException(e); | ||
2108 | } | 2108 | } | ||
2109 | } | 2109 | } | ||
Context not available. | |||||
2132 | try { | 2132 | try { | ||
2133 | m->setValue("kmm-id", ""); | 2133 | m->setValue("kmm-id", ""); | ||
2134 | ft.commit(); | 2134 | ft.commit(); | ||
2135 | } catch (const MyMoneyException &e) { | 2135 | } catch (const std::exception &e) { | ||
2136 | unexpectedException(e); | 2136 | unexpectedException(e); | ||
2137 | } | 2137 | } | ||
2138 | 2138 | | |||
Context not available. | |||||
2142 | QVERIFY(!id.isEmpty()); | 2142 | QVERIFY(!id.isEmpty()); | ||
2143 | // check that it is the same if we ask again | 2143 | // check that it is the same if we ask again | ||
2144 | QCOMPARE(id, m->storageId()); | 2144 | QCOMPARE(id, m->storageId()); | ||
2145 | } catch (const MyMoneyException &e) { | 2145 | } catch (const std::exception &e) { | ||
2146 | unexpectedException(e); | 2146 | unexpectedException(e); | ||
2147 | } | 2147 | } | ||
2148 | } | 2148 | } | ||
Context not available. | |||||
2292 | QVERIFY(m_objectsAdded.contains(accountId.toLatin1())); | 2292 | QVERIFY(m_objectsAdded.contains(accountId.toLatin1())); | ||
2293 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | 2293 | QVERIFY(m_objectsModified.contains(QLatin1String("AStd::Asset"))); | ||
2294 | 2294 | | |||
2295 | } catch (const MyMoneyException &) { | 2295 | } catch (const std::exception &) { | ||
2296 | QFAIL("Unexpected exception!"); | 2296 | QFAIL("Unexpected exception!"); | ||
2297 | } | 2297 | } | ||
2298 | } | 2298 | } | ||
Context not available. | |||||
2556 | QVERIFY(m->clearedBalance("A000002", QDate(2002, 1, 15)).isZero()); | 2556 | QVERIFY(m->clearedBalance("A000002", QDate(2002, 1, 15)).isZero()); | ||
2557 | 2557 | | |||
2558 | 2558 | | |||
2559 | } catch (const MyMoneyException &) { | 2559 | } catch (const std::exception &) { | ||
2560 | QFAIL("Unexpected exception!"); | 2560 | QFAIL("Unexpected exception!"); | ||
2561 | } | 2561 | } | ||
2562 | } | 2562 | } | ||
Context not available. | |||||
2576 | MyMoneyAccount parent = m->expense(); | 2576 | MyMoneyAccount parent = m->expense(); | ||
2577 | m->addAccount(exp1, parent); | 2577 | m->addAccount(exp1, parent); | ||
2578 | ft.commit(); | 2578 | ft.commit(); | ||
2579 | } catch (const MyMoneyException &) { | 2579 | } catch (const std::exception &) { | ||
2580 | QFAIL("Unexpected exception!"); | 2580 | QFAIL("Unexpected exception!"); | ||
2581 | } | 2581 | } | ||
2582 | 2582 | | |||
Context not available. | |||||
2590 | try { | 2590 | try { | ||
2591 | m->addSecurity(stockSecurity); | 2591 | m->addSecurity(stockSecurity); | ||
2592 | ft.commit(); | 2592 | ft.commit(); | ||
2593 | } catch (const MyMoneyException &e) { | 2593 | } catch (const std::exception &e) { | ||
2594 | unexpectedException(e); | 2594 | unexpectedException(e); | ||
2595 | } | 2595 | } | ||
2596 | 2596 | | |||
Context not available. | |||||
2603 | stock.setAccountType(eMyMoney::Account::Type::Stock); | 2603 | stock.setAccountType(eMyMoney::Account::Type::Stock); | ||
2604 | m->addAccount(stock, i); | 2604 | m->addAccount(stock, i); | ||
2605 | ft.commit(); | 2605 | ft.commit(); | ||
2606 | } catch (const MyMoneyException &e) { | 2606 | } catch (const std::exception &e) { | ||
2607 | unexpectedException(e); | 2607 | unexpectedException(e); | ||
2608 | } | 2608 | } | ||
2609 | 2609 | | |||
Context not available. | |||||
2637 | try { | 2637 | try { | ||
2638 | m->addTransaction(t); | 2638 | m->addTransaction(t); | ||
2639 | ft.commit(); | 2639 | ft.commit(); | ||
2640 | } catch (const MyMoneyException &) { | 2640 | } catch (const std::exception &) { | ||
2641 | QFAIL("Unexpected exception!"); | 2641 | QFAIL("Unexpected exception!"); | ||
2642 | } | 2642 | } | ||
2643 | 2643 | | |||
Context not available. | |||||
2674 | try { | 2674 | try { | ||
2675 | m->modifyTransaction(t); | 2675 | m->modifyTransaction(t); | ||
2676 | ft.commit(); | 2676 | ft.commit(); | ||
2677 | } catch (const MyMoneyException &) { | 2677 | } catch (const std::exception &) { | ||
2678 | QFAIL("Unexpected exception!"); | 2678 | QFAIL("Unexpected exception!"); | ||
2679 | } | 2679 | } | ||
2680 | 2680 | | |||
Context not available. | |||||
2714 | expense.setValue(QLatin1String("VatAccount"), vat.id()); | 2714 | expense.setValue(QLatin1String("VatAccount"), vat.id()); | ||
2715 | m->modifyAccount(expense); | 2715 | m->modifyAccount(expense); | ||
2716 | ft.commit(); | 2716 | ft.commit(); | ||
2717 | } catch (const MyMoneyException &) { | 2717 | } catch (const std::exception &) { | ||
2718 | QFAIL("Unexpected exception!"); | 2718 | QFAIL("Unexpected exception!"); | ||
2719 | } | 2719 | } | ||
2720 | 2720 | | |||
Context not available. | |||||
2747 | expense.setValue(QLatin1String("VatAmount"), QLatin1String("net")); | 2747 | expense.setValue(QLatin1String("VatAmount"), QLatin1String("net")); | ||
2748 | m->modifyAccount(expense); | 2748 | m->modifyAccount(expense); | ||
2749 | ft.commit(); | 2749 | ft.commit(); | ||
2750 | } catch (const MyMoneyException &) { | 2750 | } catch (const std::exception &) { | ||
2751 | QFAIL("Unexpected exception!"); | 2751 | QFAIL("Unexpected exception!"); | ||
2752 | } | 2752 | } | ||
2753 | 2753 | | |||
Context not available. | |||||
2782 | MyMoneyFile::instance()->transactionList(tList, filter); | 2782 | MyMoneyFile::instance()->transactionList(tList, filter); | ||
2783 | QCOMPARE(tList.count(), 2); | 2783 | QCOMPARE(tList.count(), 2); | ||
2784 | 2784 | | |||
2785 | } catch (const MyMoneyException &) { | 2785 | } catch (const std::exception &) { | ||
2786 | QFAIL("Unexpected exception!"); | 2786 | QFAIL("Unexpected exception!"); | ||
2787 | } | 2787 | } | ||
2788 | } | 2788 | } | ||
Context not available. | |||||
2802 | MyMoneyAccount parent = m->expense(); | 2802 | MyMoneyAccount parent = m->expense(); | ||
2803 | m->addAccount(exp1, parent); | 2803 | m->addAccount(exp1, parent); | ||
2804 | ft.commit(); | 2804 | ft.commit(); | ||
2805 | } catch (const MyMoneyException &) { | 2805 | } catch (const std::exception &) { | ||
2806 | QFAIL("Unexpected exception!"); | 2806 | QFAIL("Unexpected exception!"); | ||
2807 | } | 2807 | } | ||
2808 | 2808 | | |||
Context not available. | |||||
2816 | try { | 2816 | try { | ||
2817 | m->addSecurity(stockSecurity); | 2817 | m->addSecurity(stockSecurity); | ||
2818 | ft.commit(); | 2818 | ft.commit(); | ||
2819 | } catch (const MyMoneyException &e) { | 2819 | } catch (const std::exception &e) { | ||
2820 | unexpectedException(e); | 2820 | unexpectedException(e); | ||
2821 | } | 2821 | } | ||
2822 | 2822 | | |||
2823 | // check that we can get it via the security method | 2823 | // check that we can get it via the security method | ||
2824 | try { | 2824 | try { | ||
2825 | MyMoneySecurity sec = m->security(stockSecurity.id()); | 2825 | MyMoneySecurity sec = m->security(stockSecurity.id()); | ||
2826 | } catch (const MyMoneyException &e) { | 2826 | } catch (const std::exception &e) { | ||
2827 | unexpectedException(e); | 2827 | unexpectedException(e); | ||
2828 | } | 2828 | } | ||
2829 | 2829 | | |||
2830 | // and also via the currency method | 2830 | // and also via the currency method | ||
2831 | try { | 2831 | try { | ||
2832 | MyMoneySecurity sec = m->currency(stockSecurity.id()); | 2832 | MyMoneySecurity sec = m->currency(stockSecurity.id()); | ||
2833 | } catch (const MyMoneyException &e) { | 2833 | } catch (const std::exception &e) { | ||
2834 | unexpectedException(e); | 2834 | unexpectedException(e); | ||
2835 | } | 2835 | } | ||
2836 | } | 2836 | } | ||
Context not available. |