summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
commitfecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch)
tree6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp
parentdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff)
downloadkmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz
kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp')
-rw-r--r--kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp b/kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp
index 09bf791..9decdce 100644
--- a/kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp
+++ b/kmymoney2/mymoney/storage/mymoneyseqaccessmgrtest.cpp
@@ -63,7 +63,7 @@ void MyMoneySeqAccessMgrTest::testEmptyConstructor()
CPPUNIT_ASSERT(m->m_scheduleList.count() == 0);
CPPUNIT_ASSERT(m->m_dirty == false);
- CPPUNIT_ASSERT(m->m_creationDate == QDate::currentDate());
+ CPPUNIT_ASSERT(m->m_creationDate == TQDate::tqcurrentDate());
CPPUNIT_ASSERT(m->liability().name() == "Liability");
CPPUNIT_ASSERT(m->asset().name() == "Asset");
@@ -354,7 +354,7 @@ void MyMoneySeqAccessMgrTest::testModifyAccount() {
m->commitTransaction();
m->startTransaction();
MyMoneyAccount b = m->account("A000001");
- CPPUNIT_ASSERT(b.parentAccountId() == a.parentAccountId());
+ CPPUNIT_ASSERT(b.tqparentAccountId() == a.tqparentAccountId());
CPPUNIT_ASSERT(b.name() == "New account name");
CPPUNIT_ASSERT(m->dirty() == true);
} catch (MyMoneyException *e) {
@@ -383,7 +383,7 @@ void MyMoneySeqAccessMgrTest::testModifyAccount() {
delete e;
}
- // use different parent
+ // use different tqparent
a.setParentAccountId("A000002");
try {
m->modifyAccount(c);
@@ -422,7 +422,7 @@ void MyMoneySeqAccessMgrTest::testModifyInstitution() {
}
}
-void MyMoneySeqAccessMgrTest::testReparentAccount() {
+void MyMoneySeqAccessMgrTest::testRetqparentAccount() {
// this one adds some accounts to the database
MyMoneyAccount ex1;
ex1.setAccountType(MyMoneyAccount::Expense);
@@ -460,27 +460,27 @@ void MyMoneySeqAccessMgrTest::testReparentAccount() {
CPPUNIT_ASSERT(in.id() == "A000005");
CPPUNIT_ASSERT(ch.id() == "A000006");
- MyMoneyAccount parent = m->expense();
+ MyMoneyAccount tqparent = m->expense();
- m->addAccount(parent, ex1);
+ m->addAccount(tqparent, ex1);
m->addAccount(ex1, ex2);
- m->addAccount(parent, ex3);
- m->addAccount(parent, ex4);
+ m->addAccount(tqparent, ex3);
+ m->addAccount(tqparent, ex4);
- parent = m->income();
- m->addAccount(parent, in);
+ tqparent = m->income();
+ m->addAccount(tqparent, in);
- parent = m->asset();
- m->addAccount(parent, ch);
+ tqparent = m->asset();
+ m->addAccount(tqparent, ch);
CPPUNIT_ASSERT(m->expense().accountCount() == 3);
CPPUNIT_ASSERT(m->account(ex1.id()).accountCount() == 1);
- CPPUNIT_ASSERT(ex3.parentAccountId() == STD_ACC_EXPENSE);
+ CPPUNIT_ASSERT(ex3.tqparentAccountId() == STD_ACC_EXPENSE);
m->reparentAccount(ex3, ex1);
CPPUNIT_ASSERT(m->expense().accountCount() == 2);
CPPUNIT_ASSERT(m->account(ex1.id()).accountCount() == 2);
- CPPUNIT_ASSERT(ex3.parentAccountId() == ex1.id());
+ CPPUNIT_ASSERT(ex3.tqparentAccountId() == ex1.id());
} catch (MyMoneyException *e) {
std::cout << std::endl << e->what() << std::endl;
delete e;
@@ -489,7 +489,7 @@ void MyMoneySeqAccessMgrTest::testReparentAccount() {
}
void MyMoneySeqAccessMgrTest::testAddTransactions() {
- testReparentAccount();
+ testRetqparentAccount();
MyMoneyAccount ch;
MyMoneyTransaction t1, t2;
@@ -503,14 +503,14 @@ void MyMoneySeqAccessMgrTest::testAddTransactions() {
CPPUNIT_ASSERT(s.id().isEmpty());
t1.addSplit(s);
- s.setId(QString()); // enable re-usage of split variable
+ s.setId(TQString()); // enable re-usage of split variable
s.setAccountId("A000005"); // Salary
s.setShares(-100000);
s.setValue(-100000);
CPPUNIT_ASSERT(s.id().isEmpty());
t1.addSplit(s);
- t1.setPostDate(QDate(2002,5,10));
+ t1.setPostDate(TQDate(2002,5,10));
} catch (MyMoneyException *e) {
unexpectedException(e);
}
@@ -530,35 +530,35 @@ void MyMoneySeqAccessMgrTest::testAddTransactions() {
try {
// I spent some money, not so great
- s.setId(QString()); // enable re-usage of split variable
+ s.setId(TQString()); // enable re-usage of split variable
s.setAccountId("A000004"); // Grosseries
s.setShares(10000);
s.setValue(10000);
CPPUNIT_ASSERT(s.id().isEmpty());
t2.addSplit(s);
- s.setId(QString()); // enable re-usage of split variable
+ s.setId(TQString()); // enable re-usage of split variable
s.setAccountId("A000002"); // 16% sales tax
s.setShares(1200);
s.setValue(1200);
CPPUNIT_ASSERT(s.id().isEmpty());
t2.addSplit(s);
- s.setId(QString()); // enable re-usage of split variable
+ s.setId(TQString()); // enable re-usage of split variable
s.setAccountId("A000003"); // 7% sales tax
s.setShares(400);
s.setValue(400);
CPPUNIT_ASSERT(s.id().isEmpty());
t2.addSplit(s);
- s.setId(QString()); // enable re-usage of split variable
+ s.setId(TQString()); // enable re-usage of split variable
s.setAccountId("A000006"); // Checkings account
s.setShares(-11600);
s.setValue(-11600);
CPPUNIT_ASSERT(s.id().isEmpty());
t2.addSplit(s);
- t2.setPostDate(QDate(2002,5,9));
+ t2.setPostDate(TQDate(2002,5,9));
} catch (MyMoneyException *e) {
unexpectedException(e);
}
@@ -572,8 +572,8 @@ void MyMoneySeqAccessMgrTest::testAddTransactions() {
CPPUNIT_ASSERT(t2.splitCount() == 4);
CPPUNIT_ASSERT(m->transactionCount() == 2);
- QMap<QString, QString>::ConstIterator it_k;
- QMap<QString, MyMoneyTransaction>::ConstIterator it_t;
+ TQMap<TQString, TQString>::ConstIterator it_k;
+ TQMap<TQString, MyMoneyTransaction>::ConstIterator it_t;
it_k = m->m_transactionKeys.begin();
it_t = m->m_transactionList.begin();
@@ -591,12 +591,12 @@ void MyMoneySeqAccessMgrTest::testAddTransactions() {
ch = m->account("A000006");
// check that the account's transaction list is updated
- QValueList<MyMoneyTransaction> list;
+ TQValueList<MyMoneyTransaction> list;
MyMoneyTransactionFilter filter("A000006");
list = m->transactionList(filter);
CPPUNIT_ASSERT(list.size() == 2);
- QValueList<MyMoneyTransaction>::ConstIterator it;
+ TQValueList<MyMoneyTransaction>::ConstIterator it;
it = list.begin();
CPPUNIT_ASSERT((*it).id() == "T000000000000000002");
++it;
@@ -607,7 +607,7 @@ void MyMoneySeqAccessMgrTest::testAddTransactions() {
/* removed with MyMoneyAccount::Transaction
CPPUNIT_ASSERT(ch.transactionCount() == 2);
- QValueList<MyMoneyAccount::Transaction>::ConstIterator it_l;
+ TQValueList<MyMoneyAccount::Transaction>::ConstIterator it_l;
it_l = ch.transactionList().begin();
CPPUNIT_ASSERT((*it_l).transactionID() == "T000000000000000002");
CPPUNIT_ASSERT((*it_l).balance() == -11600);
@@ -642,9 +642,9 @@ void MyMoneySeqAccessMgrTest::testBalance() {
CPPUNIT_ASSERT(m->balance("A000002") == MyMoneyMoney(1200));
CPPUNIT_ASSERT(m->balance("A000003") == MyMoneyMoney(400));
CPPUNIT_ASSERT(m->totalBalance("A000001") == MyMoneyMoney(1600));
- CPPUNIT_ASSERT(m->balance("A000006", QDate(2002,5,9)) == MyMoneyMoney(-11600));
- CPPUNIT_ASSERT(m->balance("A000005", QDate(2002,5,10)) == MyMoneyMoney(-100000));
- CPPUNIT_ASSERT(m->balance("A000006", QDate(2002,5,10)) == MyMoneyMoney(88400));
+ CPPUNIT_ASSERT(m->balance("A000006", TQDate(2002,5,9)) == MyMoneyMoney(-11600));
+ CPPUNIT_ASSERT(m->balance("A000005", TQDate(2002,5,10)) == MyMoneyMoney(-100000));
+ CPPUNIT_ASSERT(m->balance("A000006", TQDate(2002,5,10)) == MyMoneyMoney(88400));
}
void MyMoneySeqAccessMgrTest::testModifyTransaction() {
@@ -682,15 +682,15 @@ void MyMoneySeqAccessMgrTest::testModifyTransaction() {
}
// now modify the date
- t.setPostDate(QDate(2002,5,11));
+ t.setPostDate(TQDate(2002,5,11));
try {
m->modifyTransaction(t);
CPPUNIT_ASSERT(m->balance("A000004") == MyMoneyMoney(11000));
CPPUNIT_ASSERT(m->balance("A000006") == MyMoneyMoney(100000-12600));
CPPUNIT_ASSERT(m->totalBalance("A000001") == MyMoneyMoney(1600));
- QMap<QString, QString>::ConstIterator it_k;
- QMap<QString, MyMoneyTransaction>::ConstIterator it_t;
+ TQMap<TQString, TQString>::ConstIterator it_k;
+ TQMap<TQString, MyMoneyTransaction>::ConstIterator it_t;
it_k = m->m_transactionKeys.begin();
it_t = m->m_transactionList.begin();
CPPUNIT_ASSERT((*it_k) == "2002-05-10-T000000000000000001");
@@ -707,12 +707,12 @@ void MyMoneySeqAccessMgrTest::testModifyTransaction() {
ch = m->account("A000006");
// check that the account's transaction list is updated
- QValueList<MyMoneyTransaction> list;
+ TQValueList<MyMoneyTransaction> list;
MyMoneyTransactionFilter filter("A000006");
list = m->transactionList(filter);
CPPUNIT_ASSERT(list.size() == 2);
- QValueList<MyMoneyTransaction>::ConstIterator it;
+ TQValueList<MyMoneyTransaction>::ConstIterator it;
it = list.begin();
CPPUNIT_ASSERT((*it).id() == "T000000000000000001");
++it;
@@ -723,7 +723,7 @@ void MyMoneySeqAccessMgrTest::testModifyTransaction() {
/* removed with MyMoneyAccount::Transaction
// CPPUNIT_ASSERT(ch.transactionCount() == 2);
- QValueList<MyMoneyAccount::Transaction>::ConstIterator it_l;
+ TQValueList<MyMoneyAccount::Transaction>::ConstIterator it_l;
it_l = ch.transactionList().begin();
CPPUNIT_ASSERT((*it_l).transactionID() == "T000000000000000001");
CPPUNIT_ASSERT((*it_l).balance() == 100000);
@@ -792,7 +792,7 @@ void MyMoneySeqAccessMgrTest::testRemoveUnusedAccount() {
CPPUNIT_ASSERT(i.accountCount() == 0);
CPPUNIT_ASSERT(m->accountCount() == 7);
- a.setInstitutionId(QString());
+ a.setInstitutionId(TQString());
m->modifyAccount(a);
m->removeAccount(a);
m->commitTransaction();
@@ -822,7 +822,7 @@ void MyMoneySeqAccessMgrTest::testRemoveUsedAccount() {
void MyMoneySeqAccessMgrTest::testRemoveInstitution() {
testModifyInstitution();
- testReparentAccount();
+ testRetqparentAccount();
MyMoneyInstitution i;
MyMoneyAccount a;
@@ -843,7 +843,7 @@ void MyMoneySeqAccessMgrTest::testRemoveInstitution() {
// now remove the institution and see if the account survived ;-)
try {
m->removeInstitution(i);
- a.setInstitutionId(QString());
+ a.setInstitutionId(TQString());
m->modifyAccount(a);
m->commitTransaction();
m->startTransaction();
@@ -881,7 +881,7 @@ void MyMoneySeqAccessMgrTest::testRemoveTransaction() {
void MyMoneySeqAccessMgrTest::testTransactionList() {
testAddTransactions();
- QValueList<MyMoneyTransaction> list;
+ TQValueList<MyMoneyTransaction> list;
MyMoneyTransactionFilter filter("A000006");
list = m->transactionList(filter);
CPPUNIT_ASSERT(list.count() == 2);
@@ -889,7 +889,7 @@ void MyMoneySeqAccessMgrTest::testTransactionList() {
CPPUNIT_ASSERT((*(list.at(1))).id() == "T000000000000000001");
filter.clear();
- filter.addAccount(QString("A000003"));
+ filter.addAccount(TQString("A000003"));
list = m->transactionList(filter);
CPPUNIT_ASSERT(list.count() == 1);
CPPUNIT_ASSERT((*(list.at(0))).id() == "T000000000000000002");
@@ -1091,7 +1091,7 @@ void MyMoneySeqAccessMgrTest::testPayeeName() {
testAddPayee();
MyMoneyPayee p;
- QString name("THB");
+ TQString name("THB");
// OK case
try {
@@ -1193,11 +1193,11 @@ void MyMoneySeqAccessMgrTest::testAddSchedule() {
MyMoneySchedule::TYPE_DEPOSIT,
MyMoneySchedule::OCCUR_DAILY, 1,
MyMoneySchedule::STYPE_MANUALDEPOSIT,
- QDate(),
- QDate(),
+ TQDate(),
+ TQDate(),
true,
false);
- t1.setPostDate(QDate(2003,7,10));
+ t1.setPostDate(TQDate(2003,7,10));
schedule.setTransaction(t1);
m->addSchedule(schedule);
@@ -1215,8 +1215,8 @@ void MyMoneySeqAccessMgrTest::testAddSchedule() {
MyMoneySchedule::TYPE_DEPOSIT,
MyMoneySchedule::OCCUR_DAILY, 1,
MyMoneySchedule::STYPE_MANUALDEPOSIT,
- QDate(),
- QDate(),
+ TQDate(),
+ TQDate(),
true,
false);
m->addSchedule(schedule);
@@ -1302,9 +1302,9 @@ void MyMoneySeqAccessMgrTest::testRemoveSchedule() {
}
void MyMoneySeqAccessMgrTest::testScheduleList() {
- QDate testDate = QDate::currentDate();
- QDate notOverdue = testDate.addDays(2);
- QDate overdue = testDate.addDays(-2);
+ TQDate testDate = TQDate::tqcurrentDate();
+ TQDate notOverdue = testDate.addDays(2);
+ TQDate overdue = testDate.addDays(-2);
MyMoneyTransaction t1;
@@ -1317,8 +1317,8 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
MyMoneySchedule::TYPE_BILL,
MyMoneySchedule::OCCUR_ONCE, 1,
MyMoneySchedule::STYPE_DIRECTDEBIT,
- QDate(),
- QDate(),
+ TQDate(),
+ TQDate(),
false,
false);
t1.setPostDate(notOverdue);
@@ -1335,8 +1335,8 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
MyMoneySchedule::TYPE_DEPOSIT,
MyMoneySchedule::OCCUR_DAILY, 1,
MyMoneySchedule::STYPE_DIRECTDEPOSIT,
- QDate(),
- QDate(),
+ TQDate(),
+ TQDate(),
false,
false);
t2.setPostDate(notOverdue.addDays(1));
@@ -1353,8 +1353,8 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
MyMoneySchedule::TYPE_TRANSFER,
MyMoneySchedule::OCCUR_WEEKLY, 1,
MyMoneySchedule::STYPE_OTHER,
- QDate(),
- QDate(),
+ TQDate(),
+ TQDate(),
false,
false);
t3.setPostDate(notOverdue.addDays(2));
@@ -1370,8 +1370,8 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
MyMoneySchedule schedule4("Schedule 4",
MyMoneySchedule::TYPE_BILL,
MyMoneySchedule::OCCUR_WEEKLY, 1,
- MyMoneySchedule::STYPE_WRITECHEQUE,
- QDate(),
+ MyMoneySchedule::STYPE_WRITECHETQUE,
+ TQDate(),
notOverdue.addDays(31),
false,
false);
@@ -1389,7 +1389,7 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
CPPUNIT_FAIL("Unexpected exception");
}
- QValueList<MyMoneySchedule> list;
+ TQValueList<MyMoneySchedule> list;
// no filter
list = m->scheduleList();
@@ -1436,7 +1436,7 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
list = m->scheduleList("", MyMoneySchedule::TYPE_ANY,
MyMoneySchedule::OCCUR_ANY,
MyMoneySchedule::STYPE_ANY,
- QDate(),
+ TQDate(),
notOverdue.addDays(1));
CPPUNIT_ASSERT(list.count() == 3);
CPPUNIT_ASSERT(list[0].name() == "Schedule 1");
@@ -1457,8 +1457,8 @@ void MyMoneySeqAccessMgrTest::testScheduleList() {
list = m->scheduleList("", MyMoneySchedule::TYPE_ANY,
MyMoneySchedule::OCCUR_ANY,
MyMoneySchedule::STYPE_ANY,
- QDate(),
- QDate(),
+ TQDate(),
+ TQDate(),
true);
CPPUNIT_ASSERT(list.count() == 1);
CPPUNIT_ASSERT(list[0].name() == "Schedule 4");
@@ -1606,7 +1606,7 @@ void MyMoneySeqAccessMgrTest::testCurrencyList()
void MyMoneySeqAccessMgrTest::testAccountList()
{
- QValueList<MyMoneyAccount> accounts;
+ TQValueList<MyMoneyAccount> accounts;
m->accountList(accounts);
CPPUNIT_ASSERT(accounts.count() == 0);
testAddNewAccount();
@@ -1628,7 +1628,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
m->rollbackTransaction();
// account loader
- QMap<QString, MyMoneyAccount> amap;
+ TQMap<TQString, MyMoneyAccount> amap;
MyMoneyAccount acc("A0000176", MyMoneyAccount());
amap[acc.id()] = acc;
m->loadAccounts(amap);
@@ -1637,7 +1637,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextAccountID == 176);
// transaction loader
- QMap<QString, MyMoneyTransaction> tmap;
+ TQMap<TQString, MyMoneyTransaction> tmap;
MyMoneyTransaction t("T000000108", MyMoneyTransaction());
tmap[t.id()] = t;
m->loadTransactions(tmap);
@@ -1646,7 +1646,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextTransactionID == 108);
// institution loader
- QMap<QString, MyMoneyInstitution> imap;
+ TQMap<TQString, MyMoneyInstitution> imap;
MyMoneyInstitution inst("I000028", MyMoneyInstitution());
imap[inst.id()] = inst;
m->loadInstitutions(imap);
@@ -1655,7 +1655,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextInstitutionID == 28);
// payee loader
- QMap<QString, MyMoneyPayee> pmap;
+ TQMap<TQString, MyMoneyPayee> pmap;
MyMoneyPayee p("P1234", MyMoneyPayee());
pmap[p.id()] = p;
m->loadPayees(pmap);
@@ -1664,7 +1664,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextPayeeID == 1234);
// security loader
- QMap<QString, MyMoneySecurity> smap;
+ TQMap<TQString, MyMoneySecurity> smap;
MyMoneySecurity s("S54321", MyMoneySecurity());
smap[s.id()] = s;
m->loadSecurities(smap);
@@ -1673,7 +1673,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextSecurityID == 54321);
// schedule loader
- QMap<QString, MyMoneySchedule> schmap;
+ TQMap<TQString, MyMoneySchedule> schmap;
MyMoneySchedule sch("SCH6789", MyMoneySchedule());
schmap[sch.id()] = sch;
m->loadSchedules(schmap);
@@ -1682,7 +1682,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextScheduleID == 6789);
// report loader
- QMap<QString, MyMoneyReport> rmap;
+ TQMap<TQString, MyMoneyReport> rmap;
MyMoneyReport r("R1298", MyMoneyReport());
rmap[r.id()] = r;
m->loadReports(rmap);
@@ -1691,7 +1691,7 @@ void MyMoneySeqAccessMgrTest::testLoaderFunctions()
CPPUNIT_ASSERT(m->m_nextReportID == 1298);
// budget loader
- QMap<QString, MyMoneyBudget> bmap;
+ TQMap<TQString, MyMoneyBudget> bmap;
MyMoneyBudget b("B89765", MyMoneyBudget());
bmap[b.id()] = b;
m->loadBudgets(bmap);