Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/tests/mymoneyaccount-test.cpp
Context not available. | |||||
40 | 40 | | |||
---|---|---|---|---|---|
41 | QVERIFY(a.id().isEmpty()); | 41 | QVERIFY(a.id().isEmpty()); | ||
42 | QVERIFY(a.name().isEmpty()); | 42 | QVERIFY(a.name().isEmpty()); | ||
43 | QVERIFY(a.accountType() == MyMoneyAccount::UnknownAccountType); | 43 | QVERIFY(a.accountType() == eMyMoney::Account::Unknown); | ||
44 | QVERIFY(a.openingDate() == QDate()); | 44 | QVERIFY(a.openingDate() == QDate()); | ||
45 | QVERIFY(a.lastModified() == QDate()); | 45 | QVERIFY(a.lastModified() == QDate()); | ||
46 | QVERIFY(a.lastReconciliationDate() == QDate()); | 46 | QVERIFY(a.lastReconciliationDate() == QDate()); | ||
Context not available. | |||||
55 | QString parent = "Parent"; | 55 | QString parent = "Parent"; | ||
56 | MyMoneyAccount r; | 56 | MyMoneyAccount r; | ||
57 | MyMoneySplit s; | 57 | MyMoneySplit s; | ||
58 | r.setAccountType(MyMoneyAccount::Asset); | 58 | r.setAccountType(eMyMoney::Account::Asset); | ||
59 | r.setOpeningDate(QDate::currentDate()); | 59 | r.setOpeningDate(QDate::currentDate()); | ||
60 | r.setLastModified(QDate::currentDate()); | 60 | r.setLastModified(QDate::currentDate()); | ||
61 | r.setDescription("Desc"); | 61 | r.setDescription("Desc"); | ||
Context not available. | |||||
71 | 71 | | |||
72 | QVERIFY(a.id() == id); | 72 | QVERIFY(a.id() == id); | ||
73 | QVERIFY(a.institutionId().isEmpty()); | 73 | QVERIFY(a.institutionId().isEmpty()); | ||
74 | QVERIFY(a.accountType() == MyMoneyAccount::Asset); | 74 | QVERIFY(a.accountType() == eMyMoney::Account::Asset); | ||
75 | QVERIFY(a.openingDate() == QDate::currentDate()); | 75 | QVERIFY(a.openingDate() == QDate::currentDate()); | ||
76 | QVERIFY(a.lastModified() == QDate::currentDate()); | 76 | QVERIFY(a.lastModified() == QDate::currentDate()); | ||
77 | QVERIFY(a.number() == "465500"); | 77 | QVERIFY(a.number() == "465500"); | ||
Context not available. | |||||
100 | a.setLastModified(today); | 100 | a.setLastModified(today); | ||
101 | a.setDescription("Desc"); | 101 | a.setDescription("Desc"); | ||
102 | a.setNumber("123456"); | 102 | a.setNumber("123456"); | ||
103 | a.setAccountType(MyMoneyAccount::MoneyMarket); | 103 | a.setAccountType(eMyMoney::Account::MoneyMarket); | ||
104 | 104 | | |||
105 | QVERIFY(a.name() == "Account"); | 105 | QVERIFY(a.name() == "Account"); | ||
106 | QVERIFY(a.institutionId() == "Institution1"); | 106 | QVERIFY(a.institutionId() == "Institution1"); | ||
107 | QVERIFY(a.lastModified() == today); | 107 | QVERIFY(a.lastModified() == today); | ||
108 | QVERIFY(a.description() == "Desc"); | 108 | QVERIFY(a.description() == "Desc"); | ||
109 | QVERIFY(a.number() == "123456"); | 109 | QVERIFY(a.number() == "123456"); | ||
110 | QVERIFY(a.accountType() == MyMoneyAccount::MoneyMarket); | 110 | QVERIFY(a.accountType() == eMyMoney::Account::MoneyMarket); | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | void MyMoneyAccountTest::testCopyConstructor() | 113 | void MyMoneyAccountTest::testCopyConstructor() | ||
Context not available. | |||||
116 | QString institutionid = "B000001"; | 116 | QString institutionid = "B000001"; | ||
117 | QString parent = "ParentAccount"; | 117 | QString parent = "ParentAccount"; | ||
118 | MyMoneyAccount r; | 118 | MyMoneyAccount r; | ||
119 | r.setAccountType(MyMoneyAccount::Expense); | 119 | r.setAccountType(eMyMoney::Account::Expense); | ||
120 | r.setOpeningDate(QDate::currentDate()); | 120 | r.setOpeningDate(QDate::currentDate()); | ||
121 | r.setLastModified(QDate::currentDate()); | 121 | r.setLastModified(QDate::currentDate()); | ||
122 | r.setName("Account"); | 122 | r.setName("Account"); | ||
Context not available. | |||||
133 | 133 | | |||
134 | QVERIFY(b.name() == "Account"); | 134 | QVERIFY(b.name() == "Account"); | ||
135 | QVERIFY(b.institutionId() == institutionid); | 135 | QVERIFY(b.institutionId() == institutionid); | ||
136 | QVERIFY(b.accountType() == MyMoneyAccount::Expense); | 136 | QVERIFY(b.accountType() == eMyMoney::Account::Expense); | ||
137 | QVERIFY(b.lastModified() == QDate::currentDate()); | 137 | QVERIFY(b.lastModified() == QDate::currentDate()); | ||
138 | QVERIFY(b.openingDate() == QDate::currentDate()); | 138 | QVERIFY(b.openingDate() == QDate::currentDate()); | ||
139 | QVERIFY(b.description() == "Desc1"); | 139 | QVERIFY(b.description() == "Desc1"); | ||
Context not available. | |||||
146 | void MyMoneyAccountTest::testAssignmentConstructor() | 146 | void MyMoneyAccountTest::testAssignmentConstructor() | ||
147 | { | 147 | { | ||
148 | MyMoneyAccount a; | 148 | MyMoneyAccount a; | ||
149 | a.setAccountType(MyMoneyAccount::Checkings); | 149 | a.setAccountType(eMyMoney::Account::Checkings); | ||
150 | a.setName("Account"); | 150 | a.setName("Account"); | ||
151 | a.setInstitutionId("Inst1"); | 151 | a.setInstitutionId("Inst1"); | ||
152 | a.setDescription("Bla"); | 152 | a.setDescription("Bla"); | ||
Context not available. | |||||
162 | 162 | | |||
163 | QVERIFY(b.name() == "Account"); | 163 | QVERIFY(b.name() == "Account"); | ||
164 | QVERIFY(b.institutionId() == "Inst1"); | 164 | QVERIFY(b.institutionId() == "Inst1"); | ||
165 | QVERIFY(b.accountType() == MyMoneyAccount::Checkings); | 165 | QVERIFY(b.accountType() == eMyMoney::Account::Checkings); | ||
166 | QVERIFY(b.lastModified() == QDate()); | 166 | QVERIFY(b.lastModified() == QDate()); | ||
167 | QVERIFY(b.openingDate() == a.openingDate()); | 167 | QVERIFY(b.openingDate() == a.openingDate()); | ||
168 | QVERIFY(b.description() == "Bla"); | 168 | QVERIFY(b.description() == "Bla"); | ||
Context not available. | |||||
195 | void MyMoneyAccountTest::testSubAccounts() | 195 | void MyMoneyAccountTest::testSubAccounts() | ||
196 | { | 196 | { | ||
197 | MyMoneyAccount a; | 197 | MyMoneyAccount a; | ||
198 | a.setAccountType(MyMoneyAccount::Checkings); | 198 | a.setAccountType(eMyMoney::Account::Checkings); | ||
199 | 199 | | |||
200 | a.addAccountId("Subaccount1"); | 200 | a.addAccountId("Subaccount1"); | ||
201 | QVERIFY(a.accountList().count() == 1); | 201 | QVERIFY(a.accountList().count() == 1); | ||
Context not available. | |||||
217 | a.setInstitutionId("I-ID"); | 217 | a.setInstitutionId("I-ID"); | ||
218 | a.setOpeningDate(QDate::currentDate()); | 218 | a.setOpeningDate(QDate::currentDate()); | ||
219 | a.setLastReconciliationDate(QDate::currentDate()); | 219 | a.setLastReconciliationDate(QDate::currentDate()); | ||
220 | a.setAccountType(MyMoneyAccount::Asset); | 220 | a.setAccountType(eMyMoney::Account::Asset); | ||
221 | a.setParentAccountId("P-ID"); | 221 | a.setParentAccountId("P-ID"); | ||
222 | a.setId("A-ID"); | 222 | a.setId("A-ID"); | ||
223 | a.setCurrencyId("C-ID"); | 223 | a.setCurrencyId("C-ID"); | ||
Context not available. | |||||
256 | QVERIFY(!(b == a)); | 256 | QVERIFY(!(b == a)); | ||
257 | b = a; | 257 | b = a; | ||
258 | 258 | | |||
259 | a.setAccountType(MyMoneyAccount::Liability); | 259 | a.setAccountType(eMyMoney::Account::Liability); | ||
260 | QVERIFY(!(b == a)); | 260 | QVERIFY(!(b == a)); | ||
261 | b = a; | 261 | b = a; | ||
262 | 262 | | |||
Context not available. | |||||
289 | QString parent = "Parent"; | 289 | QString parent = "Parent"; | ||
290 | 290 | | |||
291 | MyMoneyAccount r; | 291 | MyMoneyAccount r; | ||
292 | r.setAccountType(MyMoneyAccount::Asset); | 292 | r.setAccountType(eMyMoney::Account::Asset); | ||
293 | r.setOpeningDate(QDate::currentDate()); | 293 | r.setOpeningDate(QDate::currentDate()); | ||
294 | r.setLastModified(QDate::currentDate()); | 294 | r.setLastModified(QDate::currentDate()); | ||
295 | r.setDescription("Desc"); | 295 | r.setDescription("Desc"); | ||
Context not available. | |||||
427 | QVERIFY(a.m_institution == "B000001"); | 427 | QVERIFY(a.m_institution == "B000001"); | ||
428 | QVERIFY(a.m_number == "465500"); | 428 | QVERIFY(a.m_number == "465500"); | ||
429 | QVERIFY(a.m_openingDate == QDate::currentDate()); | 429 | QVERIFY(a.m_openingDate == QDate::currentDate()); | ||
430 | QVERIFY(a.m_accountType == MyMoneyAccount::Asset); | 430 | QVERIFY(a.m_accountType == eMyMoney::Account::Asset); | ||
431 | QVERIFY(a.m_description == "Desc"); | 431 | QVERIFY(a.m_description == "Desc"); | ||
432 | QVERIFY(a.accountList().count() == 2); | 432 | QVERIFY(a.accountList().count() == 2); | ||
433 | QVERIFY(a.accountList()[0] == "A000002"); | 433 | QVERIFY(a.accountList()[0] == "A000002"); | ||
Context not available. | |||||
474 | 474 | | |||
475 | void MyMoneyAccountTest::specialAccountTypes_data() | 475 | void MyMoneyAccountTest::specialAccountTypes_data() | ||
476 | { | 476 | { | ||
477 | QTest::addColumn<MyMoneyAccount::accountTypeE>("accountType"); | 477 | QTest::addColumn<eMyMoney::Account>("accountType"); | ||
478 | QTest::addColumn<bool>("incomeExpense"); | 478 | QTest::addColumn<bool>("incomeExpense"); | ||
479 | QTest::addColumn<bool>("assetLibility"); | 479 | QTest::addColumn<bool>("assetLibility"); | ||
480 | QTest::addColumn<bool>("loan"); | 480 | QTest::addColumn<bool>("loan"); | ||
481 | 481 | | |||
482 | // positive and null is debit | 482 | // positive and null is debit | ||
483 | QTest::newRow("unknown") << MyMoneyAccount::UnknownAccountType << false << false << false; | 483 | QTest::newRow("unknown") << eMyMoney::Account::Unknown << false << false << false; | ||
484 | QTest::newRow("checking") << MyMoneyAccount::Checkings << false << true << false; | 484 | QTest::newRow("checking") << eMyMoney::Account::Checkings << false << true << false; | ||
485 | QTest::newRow("savings") << MyMoneyAccount::Savings << false << true << false; | 485 | QTest::newRow("savings") << eMyMoney::Account::Savings << false << true << false; | ||
486 | QTest::newRow("cash") << MyMoneyAccount::Cash << false << true << false; | 486 | QTest::newRow("cash") << eMyMoney::Account::Cash << false << true << false; | ||
487 | QTest::newRow("investment") << MyMoneyAccount::Investment << false << true << false; | 487 | QTest::newRow("investment") << eMyMoney::Account::Investment << false << true << false; | ||
488 | QTest::newRow("asset") << MyMoneyAccount::Asset << false << true << false; | 488 | QTest::newRow("asset") << eMyMoney::Account::Asset << false << true << false; | ||
489 | QTest::newRow("currency") << MyMoneyAccount::Currency << false << true << false; | 489 | QTest::newRow("currency") << eMyMoney::Account::Currency << false << true << false; | ||
490 | QTest::newRow("expense") << MyMoneyAccount::Expense << true << false << false; | 490 | QTest::newRow("expense") << eMyMoney::Account::Expense << true << false << false; | ||
491 | QTest::newRow("moneymarket") << MyMoneyAccount::MoneyMarket << false << true << false; | 491 | QTest::newRow("moneymarket") << eMyMoney::Account::MoneyMarket << false << true << false; | ||
492 | QTest::newRow("certificatedeposit") << MyMoneyAccount::CertificateDep << false << true << false; | 492 | QTest::newRow("certificatedeposit") << eMyMoney::Account::CertificateDep << false << true << false; | ||
493 | QTest::newRow("assetloan") << MyMoneyAccount::AssetLoan << false << true << true; | 493 | QTest::newRow("assetloan") << eMyMoney::Account::AssetLoan << false << true << true; | ||
494 | QTest::newRow("stock") << MyMoneyAccount::Stock << false << true << false; | 494 | QTest::newRow("stock") << eMyMoney::Account::Stock << false << true << false; | ||
495 | QTest::newRow("creditcard") << MyMoneyAccount::CreditCard << false << true << false; | 495 | QTest::newRow("creditcard") << eMyMoney::Account::CreditCard << false << true << false; | ||
496 | QTest::newRow("loan") << MyMoneyAccount::Loan << false << true << true; | 496 | QTest::newRow("loan") << eMyMoney::Account::Loan << false << true << true; | ||
497 | QTest::newRow("liability") << MyMoneyAccount::Liability << false << true << false; | 497 | QTest::newRow("liability") << eMyMoney::Account::Liability << false << true << false; | ||
498 | QTest::newRow("income") << MyMoneyAccount::Income << true << false << false; | 498 | QTest::newRow("income") << eMyMoney::Account::Income << true << false << false; | ||
499 | QTest::newRow("equity") << MyMoneyAccount::Equity << false << false << false; | 499 | QTest::newRow("equity") << eMyMoney::Account::Equity << false << false << false; | ||
500 | } | 500 | } | ||
501 | 501 | | |||
502 | void MyMoneyAccountTest::specialAccountTypes() | 502 | void MyMoneyAccountTest::specialAccountTypes() | ||
503 | { | 503 | { | ||
504 | QFETCH(MyMoneyAccount::accountTypeE, accountType); | 504 | QFETCH(eMyMoney::Account, accountType); | ||
505 | QFETCH(bool, incomeExpense); | 505 | QFETCH(bool, incomeExpense); | ||
506 | QFETCH(bool, assetLibility); | 506 | QFETCH(bool, assetLibility); | ||
507 | QFETCH(bool, loan); | 507 | QFETCH(bool, loan); | ||
Context not available. |