diff options
Diffstat (limited to 'kmymoney2/mymoney/mymoneyfiletest.cpp')
-rw-r--r-- | kmymoney2/mymoney/mymoneyfiletest.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/kmymoney2/mymoney/mymoneyfiletest.cpp b/kmymoney2/mymoney/mymoneyfiletest.cpp index e081fa0..72dd006 100644 --- a/kmymoney2/mymoney/mymoneyfiletest.cpp +++ b/kmymoney2/mymoney/mymoneyfiletest.cpp @@ -19,8 +19,8 @@ #include <memory> #include <unistd.h> -#include <qfile.h> -#include <qdatastream.h> +#include <tqfile.h> +#include <tqdatastream.h> MyMoneyFileTest:: MyMoneyFileTest () {} @@ -66,9 +66,9 @@ void MyMoneyFileTest::testAddOneInstitution() { // MyMoneyInstitution institution_file("", institution); MyMoneyInstitution institution_id("I000002", institution); MyMoneyInstitution institution_noname(institution); - institution_noname.setName(QString()); + institution_noname.setName(TQString()); - QString id; + TQString id; CPPUNIT_ASSERT(m->institutionCount() == 0); storage->m_dirty = false; @@ -117,7 +117,7 @@ void MyMoneyFileTest::testAddTwoInstitutions() { institution.setManager("manager"); institution.setSortcode("sortcode"); - QString id; + TQString id; storage->m_dirty = false; MyMoneyFileTransaction ft; @@ -228,7 +228,7 @@ void MyMoneyFileTest::testInstitutionRetrieval () { } void MyMoneyFileTest::testInstitutionListRetrieval () { - QValueList<MyMoneyInstitution> list; + TQValueList<MyMoneyInstitution> list; storage->m_dirty = false; list = m->institutionList(); @@ -242,7 +242,7 @@ void MyMoneyFileTest::testInstitutionListRetrieval () { CPPUNIT_ASSERT(m->dirty() == false); CPPUNIT_ASSERT(list.count() == 2); - QValueList<MyMoneyInstitution>::ConstIterator it; + TQValueList<MyMoneyInstitution>::ConstIterator it; it = list.begin(); CPPUNIT_ASSERT((*it).name() == "institution1"); @@ -380,11 +380,11 @@ void MyMoneyFileTest::testAddAccounts() { MyMoneyFileTransaction ft; try { - MyMoneyAccount parent = m->asset(); - m->addAccount(a, parent); + MyMoneyAccount tqparent = m->asset(); + m->addAccount(a, tqparent); ft.commit(); CPPUNIT_ASSERT(m->accountCount() == 6); - CPPUNIT_ASSERT(a.parentAccountId() == "AStd::Asset"); + CPPUNIT_ASSERT(a.tqparentAccountId() == "AStd::Asset"); CPPUNIT_ASSERT(a.id() == "A000001"); CPPUNIT_ASSERT(a.institutionId() == "I000001"); CPPUNIT_ASSERT(m->dirty() == true); @@ -403,8 +403,8 @@ void MyMoneyFileTest::testAddAccounts() { // try to add this account again, should not work ft.restart(); try { - MyMoneyAccount parent = m->asset(); - m->addAccount(a, parent); + MyMoneyAccount tqparent = m->asset(); + m->addAccount(a, tqparent); CPPUNIT_FAIL("Expecting exception!"); } catch(MyMoneyException *e) { ft.commit(); @@ -434,12 +434,12 @@ void MyMoneyFileTest::testAddAccounts() { b.setInstitutionId(institution.id()); ft.restart(); try { - MyMoneyAccount parent = m->asset(); - m->addAccount(b, parent); + MyMoneyAccount tqparent = m->asset(); + m->addAccount(b, tqparent); ft.commit(); CPPUNIT_ASSERT(m->dirty() == true); CPPUNIT_ASSERT(b.id() == "A000002"); - CPPUNIT_ASSERT(b.parentAccountId() == "AStd::Asset"); + CPPUNIT_ASSERT(b.tqparentAccountId() == "AStd::Asset"); CPPUNIT_ASSERT(m->accountCount() == 7); institution = m->institution("I000001"); @@ -534,24 +534,24 @@ void MyMoneyFileTest::testModifyAccount() { } } -void MyMoneyFileTest::testReparentAccount() { +void MyMoneyFileTest::testRetqparentAccount() { testAddAccounts(); storage->m_dirty = false; MyMoneyAccount p = m->account("A000001"); MyMoneyAccount q = m->account("A000002"); - MyMoneyAccount o = m->account(p.parentAccountId()); + MyMoneyAccount o = m->account(p.tqparentAccountId()); // make A000001 a child of A000002 MyMoneyFileTransaction ft; try { - CPPUNIT_ASSERT(p.parentAccountId() != q.id()); + CPPUNIT_ASSERT(p.tqparentAccountId() != q.id()); CPPUNIT_ASSERT(o.accountCount() == 2); CPPUNIT_ASSERT(q.accountCount() == 0); m->reparentAccount(p, q); ft.commit(); CPPUNIT_ASSERT(m->dirty() == true); - CPPUNIT_ASSERT(p.parentAccountId() == q.id()); + CPPUNIT_ASSERT(p.tqparentAccountId() == q.id()); CPPUNIT_ASSERT(q.accountCount() == 1); CPPUNIT_ASSERT(q.id() == "A000002"); CPPUNIT_ASSERT(p.id() == "A000001"); @@ -566,7 +566,7 @@ void MyMoneyFileTest::testReparentAccount() { } void MyMoneyFileTest::testRemoveStdAccount(const MyMoneyAccount& acc) { - QString txt("Exception expected while removing account "); + TQString txt("Exception expected while removing account "); txt += acc.id(); MyMoneyFileTransaction ft; try { @@ -585,7 +585,7 @@ void MyMoneyFileTest::testRemoveAccount() { CPPUNIT_ASSERT(m->accountCount() == 7); storage->m_dirty = false; - QString id; + TQString id; MyMoneyAccount p = m->account("A000001"); MyMoneyFileTransaction ft; @@ -624,7 +624,7 @@ void MyMoneyFileTest::testRemoveAccount() { } void MyMoneyFileTest::testRemoveAccountTree() { - testReparentAccount(); + testRetqparentAccount(); MyMoneyAccount a = m->account("A000002"); MyMoneyFileTransaction ft; @@ -646,10 +646,10 @@ void MyMoneyFileTest::testRemoveAccountTree() { delete e; } - // make sure that children are re-parented to parent account + // make sure that tqchildren are re-tqparented to tqparent account try { a = m->account("A000001"); - CPPUNIT_ASSERT(a.parentAccountId() == m->asset().id()); + CPPUNIT_ASSERT(a.tqparentAccountId() == m->asset().id()); } catch(MyMoneyException *e) { delete e; CPPUNIT_FAIL("Unexpected exception!"); @@ -658,7 +658,7 @@ void MyMoneyFileTest::testRemoveAccountTree() { } void MyMoneyFileTest::testAccountListRetrieval () { - QValueList<MyMoneyAccount> list; + TQValueList<MyMoneyAccount> list; storage->m_dirty = false; m->accountList(list); @@ -690,9 +690,9 @@ void MyMoneyFileTest::testAddTransaction () { MyMoneyFileTransaction ft; try { - MyMoneyAccount parent = m->expense(); - m->addAccount(exp1, parent); - m->addAccount(exp2, parent); + MyMoneyAccount tqparent = m->expense(); + m->addAccount(exp1, tqparent); + m->addAccount(exp2, tqparent); ft.commit(); } catch(MyMoneyException *e) { delete e; @@ -702,7 +702,7 @@ void MyMoneyFileTest::testAddTransaction () { // fake the last modified flag to check that the // date is updated when we add the transaction MyMoneyAccount a = m->account("A000001"); - a.setLastModified(QDate(1,2,3)); + a.setLastModified(TQDate(1,2,3)); ft.restart(); try { m->modifyAccount(a); @@ -715,10 +715,10 @@ void MyMoneyFileTest::testAddTransaction () { CPPUNIT_ASSERT(m->accountCount() == 9); a = m->account("A000001"); - CPPUNIT_ASSERT(a.lastModified() == QDate(1,2,3)); + CPPUNIT_ASSERT(a.lastModified() == TQDate(1,2,3)); // construct a transaction and add it to the pool - t.setPostDate(QDate(2002,2,1)); + t.setPostDate(TQDate(2002,2,1)); t.setMemo("Memotext"); MyMoneySplit split1; @@ -760,17 +760,17 @@ void MyMoneyFileTest::testAddTransaction () { ft.restart(); CPPUNIT_ASSERT(t.id() == "T000000000000000001"); - CPPUNIT_ASSERT(t.postDate() == QDate(2002,2,1)); - CPPUNIT_ASSERT(t.entryDate() == QDate::currentDate()); + CPPUNIT_ASSERT(t.postDate() == TQDate(2002,2,1)); + CPPUNIT_ASSERT(t.entryDate() == TQDate::tqcurrentDate()); CPPUNIT_ASSERT(m->dirty() == true); // check the balance of the accounts a = m->account("A000001"); - CPPUNIT_ASSERT(a.lastModified() == QDate::currentDate()); + CPPUNIT_ASSERT(a.lastModified() == TQDate::tqcurrentDate()); CPPUNIT_ASSERT(a.balance() == MyMoneyMoney(-1000)); MyMoneyAccount b = m->account("A000003"); - CPPUNIT_ASSERT(b.lastModified() == QDate::currentDate()); + CPPUNIT_ASSERT(b.lastModified() == TQDate::tqcurrentDate()); CPPUNIT_ASSERT(b.balance() == MyMoneyMoney(1000)); storage->m_dirty = false; @@ -859,7 +859,7 @@ void MyMoneyFileTest::testModifyTransactionNewPostDate() { testAddTransaction(); MyMoneyTransaction t = m->transaction("T000000000000000001"); - t.setPostDate(QDate(2004,2,1)); + t.setPostDate(TQDate(2004,2,1)); storage->m_dirty = false; MyMoneyFileTransaction ft; @@ -867,7 +867,7 @@ void MyMoneyFileTest::testModifyTransactionNewPostDate() { m->modifyTransaction(t); ft.commit(); t = m->transaction("T000000000000000001"); - CPPUNIT_ASSERT(t.postDate() == QDate(2004,2,1)); + CPPUNIT_ASSERT(t.postDate() == TQDate(2004,2,1)); t = m->transaction("A000001", 0); CPPUNIT_ASSERT(t.id() == "T000000000000000001"); CPPUNIT_ASSERT(m->dirty() == true); @@ -907,7 +907,7 @@ void MyMoneyFileTest::testModifyTransactionNewAccount() { m->modifyTransaction(t); ft.commit(); t = m->transaction("T000000000000000001"); - CPPUNIT_ASSERT(t.postDate() == QDate(2002,2,1)); + CPPUNIT_ASSERT(t.postDate() == TQDate(2002,2,1)); t = m->transaction("A000002", 0); CPPUNIT_ASSERT(m->dirty() == true); /* removed with MyMoneyAccount::Transaction @@ -986,7 +986,7 @@ void MyMoneyFileTest::testBalanceTotal() { MyMoneyTransaction t; // construct a transaction and add it to the pool - t.setPostDate(QDate(2002,2,1)); + t.setPostDate(TQDate(2002,2,1)); t.setMemo("Memotext"); MyMoneySplit split1; @@ -1135,7 +1135,7 @@ void MyMoneyFileTest::testAddTransactionStd() { a = m->account("A000001"); // construct a transaction and add it to the pool - t.setPostDate(QDate(2002,2,1)); + t.setPostDate(TQDate(2002,2,1)); t.setMemo("Memotext"); MyMoneySplit split1; @@ -1219,7 +1219,7 @@ void MyMoneyFileTest::testAttachStorage() { void MyMoneyFileTest::testAccount2Category() { - testReparentAccount(); + testRetqparentAccount(); CPPUNIT_ASSERT(m->accountToCategory("A000001") == "Account2:Account1"); CPPUNIT_ASSERT(m->accountToCategory("A000002") == "Account2"); } @@ -1265,7 +1265,7 @@ void MyMoneyFileTest::testHasAccount() { m->addAccount(a, b); ft.commit(); CPPUNIT_ASSERT(m->accountCount() == 8); - CPPUNIT_ASSERT(a.parentAccountId() == "A000001"); + CPPUNIT_ASSERT(a.tqparentAccountId() == "A000001"); CPPUNIT_ASSERT(m->hasAccount("A000001", "Account3") == true); CPPUNIT_ASSERT(m->hasAccount("A000001", "Account2") == false); CPPUNIT_ASSERT(m->hasAccount("A000002", "Account3") == false); @@ -1281,8 +1281,8 @@ void MyMoneyFileTest::testAddEquityAccount() { MyMoneyFileTransaction ft; try { - MyMoneyAccount parent = m->asset(); - m->addAccount(i, parent); + MyMoneyAccount tqparent = m->asset(); + m->addAccount(i, tqparent); ft.commit(); } catch(MyMoneyException *e) { unexpectedException(e); @@ -1290,10 +1290,10 @@ void MyMoneyFileTest::testAddEquityAccount() { // keep a copy for later use m_inv = i; - // make sure, that only equity accounts can be children to it + // make sure, that only equity accounts can be tqchildren to it MyMoneyAccount a; a.setName("Testaccount"); - QValueList<MyMoneyAccount::accountTypeE> list; + TQValueList<MyMoneyAccount::accountTypeE> list; list << MyMoneyAccount::Checkings; list << MyMoneyAccount::Savings; list << MyMoneyAccount::Cash; @@ -1309,7 +1309,7 @@ void MyMoneyFileTest::testAddEquityAccount() { list << MyMoneyAccount::Expense; list << MyMoneyAccount::AssetLoan; - QValueList<MyMoneyAccount::accountTypeE>::Iterator it; + TQValueList<MyMoneyAccount::accountTypeE>::Iterator it; for(it = list.begin(); it != list.end(); ++it) { a.setAccountType(*it); ft.restart(); @@ -1334,13 +1334,13 @@ void MyMoneyFileTest::testAddEquityAccount() { } } -void MyMoneyFileTest::testReparentEquity() { +void MyMoneyFileTest::testRetqparentEquity() { testAddEquityAccount(); testAddEquityAccount(); - MyMoneyAccount parent; + MyMoneyAccount tqparent; // check the bad cases - QValueList<MyMoneyAccount::accountTypeE> list; + TQValueList<MyMoneyAccount::accountTypeE> list; list << MyMoneyAccount::Checkings; list << MyMoneyAccount::Savings; list << MyMoneyAccount::Cash; @@ -1349,25 +1349,25 @@ void MyMoneyFileTest::testReparentEquity() { list << MyMoneyAccount::Asset; list << MyMoneyAccount::AssetLoan; list << MyMoneyAccount::Currency; - parent = m->asset(); - testReparentEquity(list, parent); + tqparent = m->asset(); + testRetqparentEquity(list, tqparent); list.clear(); list << MyMoneyAccount::CreditCard; list << MyMoneyAccount::Loan; list << MyMoneyAccount::Liability; - parent = m->liability(); - testReparentEquity(list, parent); + tqparent = m->liability(); + testRetqparentEquity(list, tqparent); list.clear(); list << MyMoneyAccount::Income; - parent = m->income(); - testReparentEquity(list, parent); + tqparent = m->income(); + testRetqparentEquity(list, tqparent); list.clear(); list << MyMoneyAccount::Expense; - parent = m->expense(); - testReparentEquity(list, parent); + tqparent = m->expense(); + testRetqparentEquity(list, tqparent); // now check the good case MyMoneyAccount stock = m->account("A000002"); @@ -1381,18 +1381,18 @@ void MyMoneyFileTest::testReparentEquity() { } } -void MyMoneyFileTest::testReparentEquity(QValueList<MyMoneyAccount::accountTypeE>& list, MyMoneyAccount& parent) +void MyMoneyFileTest::testRetqparentEquity(TQValueList<MyMoneyAccount::accountTypeE>& list, MyMoneyAccount& tqparent) { MyMoneyAccount a; MyMoneyAccount stock = m->account("A000002"); - QValueList<MyMoneyAccount::accountTypeE>::Iterator it; + TQValueList<MyMoneyAccount::accountTypeE>::Iterator it; MyMoneyFileTransaction ft; for(it = list.begin(); it != list.end(); ++it) { - a.setName(QString("Testaccount %1").arg(*it)); + a.setName(TQString("Testaccount %1").tqarg(*it)); a.setAccountType(*it); try { - m->addAccount(a, parent); + m->addAccount(a, tqparent); char msg[100]; m->reparentAccount(stock, a); sprintf(msg, "Can reparent stock to non-investment type %d account", *it); @@ -1407,7 +1407,7 @@ void MyMoneyFileTest::testReparentEquity(QValueList<MyMoneyAccount::accountTypeE void MyMoneyFileTest::testBaseCurrency(void) { - MyMoneySecurity base("EUR", "Euro", QChar(0x20ac)); + MyMoneySecurity base("EUR", "Euro", TQChar(0x20ac)); MyMoneySecurity ref; // make sure, no base currency is set @@ -1442,7 +1442,7 @@ void MyMoneyFileTest::testBaseCurrency(void) ref = m->baseCurrency(); CPPUNIT_ASSERT(ref.id() == "EUR"); CPPUNIT_ASSERT(ref.name() == "Euro"); - CPPUNIT_ASSERT(ref.tradingSymbol() == QChar(0x20ac)); + CPPUNIT_ASSERT(ref.tradingSymbol() == TQChar(0x20ac)); } catch(MyMoneyException *e) { unexpectedException(e); } @@ -1463,7 +1463,7 @@ void MyMoneyFileTest::testBaseCurrency(void) ref = m->baseCurrency(); CPPUNIT_ASSERT(ref.id() == "EUR"); CPPUNIT_ASSERT(ref.name() == "Euro"); - CPPUNIT_ASSERT(ref.tradingSymbol() == QChar(0x20ac)); + CPPUNIT_ASSERT(ref.tradingSymbol() == TQChar(0x20ac)); } void MyMoneyFileTest::testOpeningBalanceNoBase(void) @@ -1488,9 +1488,9 @@ void MyMoneyFileTest::testOpeningBalance(void) try { openingAcc = m->openingBalanceAccount(m->baseCurrency()); - CPPUNIT_ASSERT(openingAcc.parentAccountId() == m->equity().id()); + CPPUNIT_ASSERT(openingAcc.tqparentAccountId() == m->equity().id()); CPPUNIT_ASSERT(openingAcc.name() == MyMoneyFile::OpeningBalancesPrefix); - CPPUNIT_ASSERT(openingAcc.openingDate() == QDate::currentDate()); + CPPUNIT_ASSERT(openingAcc.openingDate() == TQDate::tqcurrentDate()); } catch(MyMoneyException *e) { unexpectedException(e); } @@ -1504,12 +1504,12 @@ void MyMoneyFileTest::testOpeningBalance(void) unexpectedException(e); } - QString refName = QString("%1 (%2)").arg(MyMoneyFile::OpeningBalancesPrefix).arg("USD"); + TQString refName = TQString("%1 (%2)").tqarg(MyMoneyFile::OpeningBalancesPrefix).tqarg("USD"); try { openingAcc = m->openingBalanceAccount(second); - CPPUNIT_ASSERT(openingAcc.parentAccountId() == m->equity().id()); + CPPUNIT_ASSERT(openingAcc.tqparentAccountId() == m->equity().id()); CPPUNIT_ASSERT(openingAcc.name() == refName); - CPPUNIT_ASSERT(openingAcc.openingDate() == QDate::currentDate()); + CPPUNIT_ASSERT(openingAcc.openingDate() == TQDate::tqcurrentDate()); } catch(MyMoneyException *e) { unexpectedException(e); } |