Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/tests/mymoneyfile-test.cpp
Context not available. | |||||
32 | 32 | | |||
---|---|---|---|---|---|
33 | QTEST_GUILESS_MAIN(MyMoneyFileTest) | 33 | QTEST_GUILESS_MAIN(MyMoneyFileTest) | ||
34 | 34 | | |||
35 | void MyMoneyFileTest::objectAdded(MyMoneyFile::notificationObjectT type, const MyMoneyObject * const obj) | 35 | void MyMoneyFileTest::objectAdded(eMyMoney::File::Object type, const MyMoneyObject * const obj) | ||
36 | { | 36 | { | ||
37 | Q_UNUSED(type); | 37 | Q_UNUSED(type); | ||
38 | m_objectsAdded += obj->id(); | 38 | m_objectsAdded += obj->id(); | ||
39 | } | 39 | } | ||
40 | 40 | | |||
41 | void MyMoneyFileTest::objectRemoved(MyMoneyFile::notificationObjectT type, const QString& id) | 41 | void MyMoneyFileTest::objectRemoved(eMyMoney::File::Object type, const QString& id) | ||
42 | { | 42 | { | ||
43 | Q_UNUSED(type); | 43 | Q_UNUSED(type); | ||
44 | m_objectsRemoved += id; | 44 | m_objectsRemoved += id; | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | void MyMoneyFileTest::objectModified(MyMoneyFile::notificationObjectT type, const MyMoneyObject * const obj) | 47 | void MyMoneyFileTest::objectModified(eMyMoney::File::Object type, const MyMoneyObject * const obj) | ||
48 | { | 48 | { | ||
49 | Q_UNUSED(type); | 49 | Q_UNUSED(type); | ||
50 | m_objectsModified += obj->id(); | 50 | m_objectsModified += obj->id(); | ||
Context not available. | |||||
74 | { | 74 | { | ||
75 | m = MyMoneyFile::instance(); | 75 | m = MyMoneyFile::instance(); | ||
76 | 76 | | |||
77 | connect(m, SIGNAL(objectAdded(MyMoneyFile::notificationObjectT,MyMoneyObject*const)), this, SLOT(objectAdded(MyMoneyFile::notificationObjectT,MyMoneyObject*const))); | 77 | connect(m, SIGNAL(objectAdded(eMyMoney::File::Object,MyMoneyObject*const)), this, SLOT(objectAdded(eMyMoney::File::Object,MyMoneyObject*const))); | ||
78 | connect(m, SIGNAL(objectRemoved(MyMoneyFile::notificationObjectT,QString)), this, SLOT(objectRemoved(MyMoneyFile::notificationObjectT,QString))); | 78 | connect(m, SIGNAL(objectRemoved(eMyMoney::File::Object,QString)), this, SLOT(objectRemoved(eMyMoney::File::Object,QString))); | ||
79 | connect(m, SIGNAL(objectModified(MyMoneyFile::notificationObjectT,MyMoneyObject*const)), this, SLOT(objectModified(MyMoneyFile::notificationObjectT,MyMoneyObject*const))); | 79 | connect(m, SIGNAL(objectModified(eMyMoney::File::Object,MyMoneyObject*const)), this, SLOT(objectModified(eMyMoney::File::Object,MyMoneyObject*const))); | ||
80 | connect(m, SIGNAL(balanceChanged(MyMoneyAccount)), this, SLOT(balanceChanged(MyMoneyAccount))); | 80 | connect(m, SIGNAL(balanceChanged(MyMoneyAccount)), this, SLOT(balanceChanged(MyMoneyAccount))); | ||
81 | connect(m, SIGNAL(valueChanged(MyMoneyAccount)), this, SLOT(valueChanged(MyMoneyAccount))); | 81 | connect(m, SIGNAL(valueChanged(MyMoneyAccount)), this, SLOT(valueChanged(MyMoneyAccount))); | ||
82 | } | 82 | } | ||
Context not available. | |||||
453 | { | 453 | { | ||
454 | testAddTwoInstitutions(); | 454 | testAddTwoInstitutions(); | ||
455 | MyMoneyAccount a, b, c; | 455 | MyMoneyAccount a, b, c; | ||
456 | a.setAccountType(MyMoneyAccount::Checkings); | 456 | a.setAccountType(eMyMoney::Account::Checkings); | ||
457 | b.setAccountType(MyMoneyAccount::Checkings); | 457 | b.setAccountType(eMyMoney::Account::Checkings); | ||
458 | 458 | | |||
459 | MyMoneyInstitution institution; | 459 | MyMoneyInstitution institution; | ||
460 | 460 | | |||
Context not available. | |||||
521 | 521 | | |||
522 | // check if we can get the same info to a different object | 522 | // check if we can get the same info to a different object | ||
523 | c = m->account("A000001"); | 523 | c = m->account("A000001"); | ||
524 | QCOMPARE(c.accountType(), MyMoneyAccount::Checkings); | 524 | QCOMPARE(c.accountType(), eMyMoney::Account::Checkings); | ||
525 | QCOMPARE(c.id(), QLatin1String("A000001")); | 525 | QCOMPARE(c.id(), QLatin1String("A000001")); | ||
526 | QCOMPARE(c.name(), QLatin1String("Account1")); | 526 | QCOMPARE(c.name(), QLatin1String("Account1")); | ||
527 | QCOMPARE(c.institutionId(), QLatin1String("I000001")); | 527 | QCOMPARE(c.institutionId(), QLatin1String("I000001")); | ||
Context not available. | |||||
573 | MyMoneyAccount p; | 573 | MyMoneyAccount p; | ||
574 | 574 | | |||
575 | p = m->account("A000002"); | 575 | p = m->account("A000002"); | ||
576 | QCOMPARE(p.accountType(), MyMoneyAccount::Checkings); | 576 | QCOMPARE(p.accountType(), eMyMoney::Account::Checkings); | ||
577 | QCOMPARE(p.id(), QLatin1String("A000002")); | 577 | QCOMPARE(p.id(), QLatin1String("A000002")); | ||
578 | QCOMPARE(p.name(), QLatin1String("Account2")); | 578 | QCOMPARE(p.name(), QLatin1String("Account2")); | ||
579 | QCOMPARE(p.institutionId(), QLatin1String("I000002")); | 579 | QCOMPARE(p.institutionId(), QLatin1String("I000002")); | ||
Context not available. | |||||
583 | void MyMoneyFileTest::testAddCategories() | 583 | void MyMoneyFileTest::testAddCategories() | ||
584 | { | 584 | { | ||
585 | MyMoneyAccount a, b, c; | 585 | MyMoneyAccount a, b, c; | ||
586 | a.setAccountType(MyMoneyAccount::Income); | 586 | a.setAccountType(eMyMoney::Account::Income); | ||
587 | a.setOpeningDate(QDate::currentDate()); | 587 | a.setOpeningDate(QDate::currentDate()); | ||
588 | b.setAccountType(MyMoneyAccount::Expense); | 588 | b.setAccountType(eMyMoney::Account::Expense); | ||
589 | 589 | | |||
590 | storage->m_dirty = false; | 590 | storage->m_dirty = false; | ||
591 | 591 | | |||
Context not available. | |||||
659 | MyMoneyAccount p = m->account("A000001"); | 659 | MyMoneyAccount p = m->account("A000001"); | ||
660 | MyMoneyInstitution institution; | 660 | MyMoneyInstitution institution; | ||
661 | 661 | | |||
662 | QCOMPARE(p.accountType(), MyMoneyAccount::Checkings); | 662 | QCOMPARE(p.accountType(), eMyMoney::Account::Checkings); | ||
663 | QCOMPARE(p.name(), QLatin1String("Account1")); | 663 | QCOMPARE(p.name(), QLatin1String("Account1")); | ||
664 | 664 | | |||
665 | p.setName("New account name"); | 665 | p.setName("New account name"); | ||
Context not available. | |||||
671 | 671 | | |||
672 | QCOMPARE(m->dirty(), true); | 672 | QCOMPARE(m->dirty(), true); | ||
673 | QCOMPARE(m->accountCount(), static_cast<unsigned>(7)); | 673 | QCOMPARE(m->accountCount(), static_cast<unsigned>(7)); | ||
674 | QCOMPARE(p.accountType(), MyMoneyAccount::Checkings); | 674 | QCOMPARE(p.accountType(), eMyMoney::Account::Checkings); | ||
675 | QCOMPARE(p.name(), QLatin1String("New account name")); | 675 | QCOMPARE(p.name(), QLatin1String("New account name")); | ||
676 | 676 | | |||
677 | QCOMPARE(m_objectsRemoved.count(), 0); | 677 | QCOMPARE(m_objectsRemoved.count(), 0); | ||
Context not available. | |||||
696 | 696 | | |||
697 | QCOMPARE(m->dirty(), true); | 697 | QCOMPARE(m->dirty(), true); | ||
698 | QCOMPARE(m->accountCount(), static_cast<unsigned>(7)); | 698 | QCOMPARE(m->accountCount(), static_cast<unsigned>(7)); | ||
699 | QCOMPARE(p.accountType(), MyMoneyAccount::Checkings); | 699 | QCOMPARE(p.accountType(), eMyMoney::Account::Checkings); | ||
700 | QCOMPARE(p.name(), QLatin1String("New account name")); | 700 | QCOMPARE(p.name(), QLatin1String("New account name")); | ||
701 | QCOMPARE(p.institutionId(), QLatin1String("I000002")); | 701 | QCOMPARE(p.institutionId(), QLatin1String("I000002")); | ||
702 | 702 | | |||
Context not available. | |||||
723 | storage->m_dirty = false; | 723 | storage->m_dirty = false; | ||
724 | 724 | | |||
725 | // try to change to an account type that is allowed | 725 | // try to change to an account type that is allowed | ||
726 | p.setAccountType(MyMoneyAccount::Savings); | 726 | p.setAccountType(eMyMoney::Account::Savings); | ||
727 | ft.restart(); | 727 | ft.restart(); | ||
728 | try { | 728 | try { | ||
729 | m->modifyAccount(p); | 729 | m->modifyAccount(p); | ||
Context not available. | |||||
731 | 731 | | |||
732 | QCOMPARE(m->dirty(), true); | 732 | QCOMPARE(m->dirty(), true); | ||
733 | QCOMPARE(m->accountCount(), static_cast<unsigned>(7)); | 733 | QCOMPARE(m->accountCount(), static_cast<unsigned>(7)); | ||
734 | QCOMPARE(p.accountType(), MyMoneyAccount::Savings); | 734 | QCOMPARE(p.accountType(), eMyMoney::Account::Savings); | ||
735 | QCOMPARE(p.name(), QLatin1String("New account name")); | 735 | QCOMPARE(p.name(), QLatin1String("New account name")); | ||
736 | 736 | | |||
737 | } catch (const MyMoneyException &) { | 737 | } catch (const MyMoneyException &) { | ||
Context not available. | |||||
740 | storage->m_dirty = false; | 740 | storage->m_dirty = false; | ||
741 | 741 | | |||
742 | // try to change to an account type that is not allowed | 742 | // try to change to an account type that is not allowed | ||
743 | p.setAccountType(MyMoneyAccount::CreditCard); | 743 | p.setAccountType(eMyMoney::Account::CreditCard); | ||
744 | ft.restart(); | 744 | ft.restart(); | ||
745 | try { | 745 | try { | ||
746 | m->modifyAccount(p); | 746 | m->modifyAccount(p); | ||
Context not available. | |||||
936 | QCOMPARE(m->dirty(), false); | 936 | QCOMPARE(m->dirty(), false); | ||
937 | QCOMPARE(list.count(), 2); | 937 | QCOMPARE(list.count(), 2); | ||
938 | 938 | | |||
939 | QCOMPARE(list[0].accountType(), MyMoneyAccount::Checkings); | 939 | QCOMPARE(list[0].accountType(), eMyMoney::Account::Checkings); | ||
940 | QCOMPARE(list[1].accountType(), MyMoneyAccount::Checkings); | 940 | QCOMPARE(list[1].accountType(), eMyMoney::Account::Checkings); | ||
941 | } | 941 | } | ||
942 | 942 | | |||
943 | void MyMoneyFileTest::testAddTransaction() | 943 | void MyMoneyFileTest::testAddTransaction() | ||
Context not available. | |||||
946 | MyMoneyTransaction t, p; | 946 | MyMoneyTransaction t, p; | ||
947 | 947 | | |||
948 | MyMoneyAccount exp1; | 948 | MyMoneyAccount exp1; | ||
949 | exp1.setAccountType(MyMoneyAccount::Expense); | 949 | exp1.setAccountType(eMyMoney::Account::Expense); | ||
950 | exp1.setName("Expense1"); | 950 | exp1.setName("Expense1"); | ||
951 | MyMoneyAccount exp2; | 951 | MyMoneyAccount exp2; | ||
952 | exp2.setAccountType(MyMoneyAccount::Expense); | 952 | exp2.setAccountType(eMyMoney::Account::Expense); | ||
953 | exp2.setName("Expense2"); | 953 | exp2.setName("Expense2"); | ||
954 | 954 | | |||
955 | MyMoneyFileTransaction ft; | 955 | MyMoneyFileTransaction ft; | ||
Context not available. | |||||
1668 | testAddAccounts(); | 1668 | testAddAccounts(); | ||
1669 | 1669 | | |||
1670 | MyMoneyAccount a, b; | 1670 | MyMoneyAccount a, b; | ||
1671 | a.setAccountType(MyMoneyAccount::Checkings); | 1671 | a.setAccountType(eMyMoney::Account::Checkings); | ||
1672 | a.setName("Account3"); | 1672 | a.setName("Account3"); | ||
1673 | b = m->account("A000001"); | 1673 | b = m->account("A000001"); | ||
1674 | MyMoneyFileTransaction ft; | 1674 | MyMoneyFileTransaction ft; | ||
Context not available. | |||||
1689 | { | 1689 | { | ||
1690 | MyMoneyAccount i; | 1690 | MyMoneyAccount i; | ||
1691 | i.setName("Investment"); | 1691 | i.setName("Investment"); | ||
1692 | i.setAccountType(MyMoneyAccount::Investment); | 1692 | i.setAccountType(eMyMoney::Account::Investment); | ||
1693 | 1693 | | |||
1694 | MyMoneyFileTransaction ft; | 1694 | MyMoneyFileTransaction ft; | ||
1695 | try { | 1695 | try { | ||
Context not available. | |||||
1705 | // make sure, that only equity accounts can be children to it | 1705 | // make sure, that only equity accounts can be children to it | ||
1706 | MyMoneyAccount a; | 1706 | MyMoneyAccount a; | ||
1707 | a.setName("Testaccount"); | 1707 | a.setName("Testaccount"); | ||
1708 | QList<MyMoneyAccount::accountTypeE> list; | 1708 | QList<eMyMoney::Account> list; | ||
1709 | list << MyMoneyAccount::Checkings; | 1709 | list << eMyMoney::Account::Checkings; | ||
1710 | list << MyMoneyAccount::Savings; | 1710 | list << eMyMoney::Account::Savings; | ||
1711 | list << MyMoneyAccount::Cash; | 1711 | list << eMyMoney::Account::Cash; | ||
1712 | list << MyMoneyAccount::CreditCard; | 1712 | list << eMyMoney::Account::CreditCard; | ||
1713 | list << MyMoneyAccount::Loan; | 1713 | list << eMyMoney::Account::Loan; | ||
1714 | list << MyMoneyAccount::CertificateDep; | 1714 | list << eMyMoney::Account::CertificateDep; | ||
1715 | list << MyMoneyAccount::Investment; | 1715 | list << eMyMoney::Account::Investment; | ||
1716 | list << MyMoneyAccount::MoneyMarket; | 1716 | list << eMyMoney::Account::MoneyMarket; | ||
1717 | list << MyMoneyAccount::Asset; | 1717 | list << eMyMoney::Account::Asset; | ||
1718 | list << MyMoneyAccount::Liability; | 1718 | list << eMyMoney::Account::Liability; | ||
1719 | list << MyMoneyAccount::Currency; | 1719 | list << eMyMoney::Account::Currency; | ||
1720 | list << MyMoneyAccount::Income; | 1720 | list << eMyMoney::Account::Income; | ||
1721 | list << MyMoneyAccount::Expense; | 1721 | list << eMyMoney::Account::Expense; | ||
1722 | list << MyMoneyAccount::AssetLoan; | 1722 | list << eMyMoney::Account::AssetLoan; | ||
1723 | 1723 | | |||
1724 | QList<MyMoneyAccount::accountTypeE>::Iterator it; | 1724 | QList<eMyMoney::Account>::Iterator it; | ||
1725 | for (it = list.begin(); it != list.end(); ++it) { | 1725 | for (it = list.begin(); it != list.end(); ++it) { | ||
1726 | a.setAccountType(*it); | 1726 | a.setAccountType(*it); | ||
1727 | ft.restart(); | 1727 | ft.restart(); | ||
1728 | try { | 1728 | try { | ||
1729 | char msg[100]; | 1729 | char msg[100]; | ||
1730 | m->addAccount(a, i); | 1730 | m->addAccount(a, i); | ||
1731 | sprintf(msg, "Can add non-equity type %d to investment", *it); | 1731 | sprintf(msg, "Can add non-equity type %d to investment", (int)*it); | ||
1732 | QFAIL(msg); | 1732 | QFAIL(msg); | ||
1733 | } catch (const MyMoneyException &) { | 1733 | } catch (const MyMoneyException &) { | ||
1734 | ft.commit(); | 1734 | ft.commit(); | ||
Context not available. | |||||
1737 | ft.restart(); | 1737 | ft.restart(); | ||
1738 | try { | 1738 | try { | ||
1739 | a.setName("Teststock"); | 1739 | a.setName("Teststock"); | ||
1740 | a.setAccountType(MyMoneyAccount::Stock); | 1740 | a.setAccountType(eMyMoney::Account::Stock); | ||
1741 | m->addAccount(a, i); | 1741 | m->addAccount(a, i); | ||
1742 | ft.commit(); | 1742 | ft.commit(); | ||
1743 | } catch (const MyMoneyException &e) { | 1743 | } catch (const MyMoneyException &e) { | ||
Context not available. | |||||
1752 | MyMoneyAccount parent; | 1752 | MyMoneyAccount parent; | ||
1753 | 1753 | | |||
1754 | // check the bad cases | 1754 | // check the bad cases | ||
1755 | QList<MyMoneyAccount::accountTypeE> list; | 1755 | QList<eMyMoney::Account> list; | ||
1756 | list << MyMoneyAccount::Checkings; | 1756 | list << eMyMoney::Account::Checkings; | ||
1757 | list << MyMoneyAccount::Savings; | 1757 | list << eMyMoney::Account::Savings; | ||
1758 | list << MyMoneyAccount::Cash; | 1758 | list << eMyMoney::Account::Cash; | ||
1759 | list << MyMoneyAccount::CertificateDep; | 1759 | list << eMyMoney::Account::CertificateDep; | ||
1760 | list << MyMoneyAccount::MoneyMarket; | 1760 | list << eMyMoney::Account::MoneyMarket; | ||
1761 | list << MyMoneyAccount::Asset; | 1761 | list << eMyMoney::Account::Asset; | ||
1762 | list << MyMoneyAccount::AssetLoan; | 1762 | list << eMyMoney::Account::AssetLoan; | ||
1763 | list << MyMoneyAccount::Currency; | 1763 | list << eMyMoney::Account::Currency; | ||
1764 | parent = m->asset(); | 1764 | parent = m->asset(); | ||
1765 | testReparentEquity(list, parent); | 1765 | testReparentEquity(list, parent); | ||
1766 | 1766 | | |||
1767 | list.clear(); | 1767 | list.clear(); | ||
1768 | list << MyMoneyAccount::CreditCard; | 1768 | list << eMyMoney::Account::CreditCard; | ||
1769 | list << MyMoneyAccount::Loan; | 1769 | list << eMyMoney::Account::Loan; | ||
1770 | list << MyMoneyAccount::Liability; | 1770 | list << eMyMoney::Account::Liability; | ||
1771 | parent = m->liability(); | 1771 | parent = m->liability(); | ||
1772 | testReparentEquity(list, parent); | 1772 | testReparentEquity(list, parent); | ||
1773 | 1773 | | |||
1774 | list.clear(); | 1774 | list.clear(); | ||
1775 | list << MyMoneyAccount::Income; | 1775 | list << eMyMoney::Account::Income; | ||
1776 | parent = m->income(); | 1776 | parent = m->income(); | ||
1777 | testReparentEquity(list, parent); | 1777 | testReparentEquity(list, parent); | ||
1778 | 1778 | | |||
1779 | list.clear(); | 1779 | list.clear(); | ||
1780 | list << MyMoneyAccount::Expense; | 1780 | list << eMyMoney::Account::Expense; | ||
1781 | parent = m->expense(); | 1781 | parent = m->expense(); | ||
1782 | testReparentEquity(list, parent); | 1782 | testReparentEquity(list, parent); | ||
1783 | 1783 | | |||
Context not available. | |||||
1793 | } | 1793 | } | ||
1794 | } | 1794 | } | ||
1795 | 1795 | | |||
1796 | void MyMoneyFileTest::testReparentEquity(QList<MyMoneyAccount::accountTypeE>& list, MyMoneyAccount& parent) | 1796 | void MyMoneyFileTest::testReparentEquity(QList<eMyMoney::Account>& list, MyMoneyAccount& parent) | ||
1797 | { | 1797 | { | ||
1798 | MyMoneyAccount a; | 1798 | MyMoneyAccount a; | ||
1799 | MyMoneyAccount stock = m->account("A000002"); | 1799 | MyMoneyAccount stock = m->account("A000002"); | ||
1800 | 1800 | | |||
1801 | QList<MyMoneyAccount::accountTypeE>::Iterator it; | 1801 | QList<eMyMoney::Account>::Iterator it; | ||
1802 | MyMoneyFileTransaction ft; | 1802 | MyMoneyFileTransaction ft; | ||
1803 | for (it = list.begin(); it != list.end(); ++it) { | 1803 | for (it = list.begin(); it != list.end(); ++it) { | ||
1804 | a.setName(QString("Testaccount %1").arg(*it)); | 1804 | a.setName(QString("Testaccount %1").arg((int)*it)); | ||
1805 | a.setAccountType(*it); | 1805 | a.setAccountType(*it); | ||
1806 | try { | 1806 | try { | ||
1807 | m->addAccount(a, parent); | 1807 | m->addAccount(a, parent); | ||
1808 | char msg[100]; | 1808 | char msg[100]; | ||
1809 | m->reparentAccount(stock, a); | 1809 | m->reparentAccount(stock, a); | ||
1810 | sprintf(msg, "Can reparent stock to non-investment type %d account", *it); | 1810 | sprintf(msg, "Can reparent stock to non-investment type %d account", (int)*it); | ||
1811 | QFAIL(msg); | 1811 | QFAIL(msg); | ||
1812 | } catch (const MyMoneyException &) { | 1812 | } catch (const MyMoneyException &) { | ||
1813 | ft.commit(); | 1813 | ft.commit(); | ||
Context not available. | |||||
2060 | testAddTwoInstitutions(); | 2060 | testAddTwoInstitutions(); | ||
2061 | MyMoneySecurity base("EUR", "Euro", QChar(0x20ac)); | 2061 | MyMoneySecurity base("EUR", "Euro", QChar(0x20ac)); | ||
2062 | MyMoneyAccount a; | 2062 | MyMoneyAccount a; | ||
2063 | a.setAccountType(MyMoneyAccount::Checkings); | 2063 | a.setAccountType(eMyMoney::Account::Checkings); | ||
2064 | 2064 | | |||
2065 | MyMoneyInstitution institution; | 2065 | MyMoneyInstitution institution; | ||
2066 | 2066 | | |||
Context not available. | |||||
2241 | { | 2241 | { | ||
2242 | QString accountId = "A000001"; | 2242 | QString accountId = "A000001"; | ||
2243 | MyMoneyAccount a; | 2243 | MyMoneyAccount a; | ||
2244 | a.setAccountType(MyMoneyAccount::Checkings); | 2244 | a.setAccountType(eMyMoney::Account::Checkings); | ||
2245 | 2245 | | |||
2246 | storage->m_dirty = false; | 2246 | storage->m_dirty = false; | ||
2247 | 2247 | | |||
Context not available. | |||||
2282 | AddOneAccount(); | 2282 | AddOneAccount(); | ||
2283 | QString accountId = "A000001"; | 2283 | QString accountId = "A000001"; | ||
2284 | 2284 | | |||
2285 | QCOMPARE(m->countTransactionsWithSpecificReconciliationState(accountId, MyMoneyTransactionFilter::notReconciled), 0); | 2285 | QCOMPARE(m->countTransactionsWithSpecificReconciliationState(accountId, eMyMoney::TransactionFilter::State::NotReconciled), 0); | ||
2286 | } | 2286 | } | ||
2287 | 2287 | | |||
2288 | void MyMoneyFileTest::testCountTransactionsWithSpecificReconciliationState_transactionWithWantedReconcileState() | 2288 | void MyMoneyFileTest::testCountTransactionsWithSpecificReconciliationState_transactionWithWantedReconcileState() | ||
Context not available. | |||||
2305 | m->addTransaction(transaction); | 2305 | m->addTransaction(transaction); | ||
2306 | ft.commit(); | 2306 | ft.commit(); | ||
2307 | 2307 | | |||
2308 | QCOMPARE(m->countTransactionsWithSpecificReconciliationState(accountId, MyMoneyTransactionFilter::notReconciled), 1); | 2308 | QCOMPARE(m->countTransactionsWithSpecificReconciliationState(accountId, eMyMoney::TransactionFilter::State::NotReconciled), 1); | ||
2309 | } | 2309 | } | ||
2310 | 2310 | | |||
2311 | void MyMoneyFileTest::testCountTransactionsWithSpecificReconciliationState_transactionWithUnwantedReconcileState() | 2311 | void MyMoneyFileTest::testCountTransactionsWithSpecificReconciliationState_transactionWithUnwantedReconcileState() | ||
Context not available. | |||||
2329 | m->addTransaction(transaction); | 2329 | m->addTransaction(transaction); | ||
2330 | ft.commit(); | 2330 | ft.commit(); | ||
2331 | 2331 | | |||
2332 | QCOMPARE(m->countTransactionsWithSpecificReconciliationState(accountId, MyMoneyTransactionFilter::notReconciled), 0); | 2332 | QCOMPARE(m->countTransactionsWithSpecificReconciliationState(accountId, eMyMoney::TransactionFilter::State::NotReconciled), 0); | ||
2333 | } | 2333 | } | ||
2334 | 2334 | | |||
2335 | void MyMoneyFileTest::testAddOnlineJob() | 2335 | void MyMoneyFileTest::testAddOnlineJob() | ||
Context not available. | |||||
2545 | AddOneAccount(); | 2545 | AddOneAccount(); | ||
2546 | 2546 | | |||
2547 | MyMoneyAccount exp1; | 2547 | MyMoneyAccount exp1; | ||
2548 | exp1.setAccountType(MyMoneyAccount::Expense); | 2548 | exp1.setAccountType(eMyMoney::Account::Expense); | ||
2549 | exp1.setName("Expense1"); | 2549 | exp1.setName("Expense1"); | ||
2550 | exp1.setCurrencyId("EUR"); | 2550 | exp1.setCurrencyId("EUR"); | ||
2551 | 2551 | | |||
Context not available. | |||||
2578 | try { | 2578 | try { | ||
2579 | stock.setName("Teststock"); | 2579 | stock.setName("Teststock"); | ||
2580 | stock.setCurrencyId(stockSecurity.id()); | 2580 | stock.setCurrencyId(stockSecurity.id()); | ||
2581 | stock.setAccountType(MyMoneyAccount::Stock); | 2581 | stock.setAccountType(eMyMoney::Account::Stock); | ||
2582 | m->addAccount(stock, i); | 2582 | m->addAccount(stock, i); | ||
2583 | ft.commit(); | 2583 | ft.commit(); | ||
2584 | } catch (const MyMoneyException &e) { | 2584 | } catch (const MyMoneyException &e) { | ||
Context not available. | |||||
2676 | 2676 | | |||
2677 | vat.setName("VAT"); | 2677 | vat.setName("VAT"); | ||
2678 | vat.setCurrencyId("EUR"); | 2678 | vat.setCurrencyId("EUR"); | ||
2679 | vat.setAccountType(MyMoneyAccount::Expense); | 2679 | vat.setAccountType(eMyMoney::Account::Expense); | ||
2680 | // make it a VAT account | 2680 | // make it a VAT account | ||
2681 | vat.setValue(QLatin1String("VatRate"), QLatin1String("20/100")); | 2681 | vat.setValue(QLatin1String("VatRate"), QLatin1String("20/100")); | ||
2682 | 2682 | | |||
Context not available. |