5 #include "gmock-Transaction.h" 10 QofInstanceClass parent_class;
23 gnc_mocktransaction_class_init(MockTransactionClass *klass)
29 GType gnc_transaction_get_type(
void)
31 return gnc_mocktransaction_get_type();
37 ASSERT_TRUE(GNC_IS_MOCKTRANSACTION(trans));
38 gnc_mocktransaction(trans)->begin_edit();
44 ASSERT_TRUE(GNC_IS_MOCKTRANSACTION(trans));
45 gnc_mocktransaction(trans)->commit_edit();
52 auto mocktrans = gnc_mocktransaction(trans);
53 return mocktrans ? mocktrans->get_split(i) :
nullptr;
59 g_return_val_if_fail(GNC_IS_MOCKTRANSACTION(trans), NULL);
64 xaccTransFindSplitByAccount(
const Transaction *trans,
const Account *acc)
67 auto mocktrans = gnc_mocktransaction(trans);
68 EXPECT_TRUE(GNC_IS_ACCOUNT(acc));
69 return mocktrans ? mocktrans->find_split_by_account(acc) :
nullptr;
76 auto mocktrans = gnc_mocktransaction(trans);
77 return mocktrans ? mocktrans->get_date() : 0;
83 ASSERT_TRUE(GNC_IS_MOCKTRANSACTION(trans));
84 gnc_mocktransaction(trans)->set_date_posted_secs_normalized(time);
91 auto mocktrans = gnc_mocktransaction(trans);
92 return mocktrans ? mocktrans->get_description() :
"";
98 ASSERT_TRUE(GNC_IS_MOCKTRANSACTION(trans));
99 gnc_mocktransaction(trans)->set_description(desc);
106 auto mocktrans = gnc_mocktransaction(trans);
107 return mocktrans ? mocktrans->get_notes() :
"";
113 ASSERT_TRUE(GNC_IS_MOCKTRANSACTION(trans));
114 gnc_mocktransaction(trans)->set_notes(notes);
121 auto mocktrans = gnc_mocktransaction(trans);
122 return mocktrans ? mocktrans->get_imbalance_value() : gnc_numeric_zero();
129 auto mocktrans = gnc_mocktransaction(trans);
130 return mocktrans ? mocktrans->get_num() :
"";
137 auto mocktrans = gnc_mocktransaction(trans);
138 return mocktrans ? mocktrans->get_currency() :
nullptr;
145 auto mocktrans = gnc_mocktransaction(trans);
146 return mocktrans ? mocktrans->is_open() : FALSE;
152 ASSERT_TRUE(GNC_IS_MOCKTRANSACTION(trans));
153 gnc_mocktransaction(trans)->destroy();
159 g_return_if_fail(GNC_IS_MOCKTRANSACTION(trans));
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
This function sets the posted date of the transaction, specified by a time64 (see ctime(3))...
Split * xaccTransGetSplit(const Transaction *trans, int i)
Return a pointer to the indexed split in this transaction's split list.
time64 xaccTransGetDate(const Transaction *trans)
Retrieve the posted date of the transaction.
gboolean xaccTransIsOpen(const Transaction *trans)
The xaccTransIsOpen() method returns TRUE if the transaction is open for editing. ...
void xaccTransSetNotes(Transaction *trans, const char *notes)
Sets the transaction Notes.
void xaccTransSetDescription(Transaction *trans, const char *desc)
Sets the transaction Description.
void xaccTransRecordPrice(Transaction *trans, PriceSource source)
The xaccTransRecordPrice() method iterates through the splits and and record the non-currency equival...
const char * xaccTransGetNum(const Transaction *trans)
Gets the transaction Number (or ID) field; rather than use this function directly, see 'gnc_get_num_action' and 'gnc_get_action_num' in engine/engine-helpers.c & .h which takes a user-set book option for selecting the source for the num-cell (the transaction-number or the split-action field) in registers/reports into account automatically.
void xaccTransDestroy(Transaction *trans)
Destroys a transaction.
const char * xaccTransGetNotes(const Transaction *trans)
Gets the transaction Notes.
GList SplitList
GList of Split.
Account handling public routines.
gnc_numeric xaccTransGetImbalanceValue(const Transaction *trans)
The xaccTransGetImbalanceValue() method returns the total value of the transaction.
const char * xaccTransGetDescription(const Transaction *trans)
Gets the transaction Description.
void xaccTransCommitEdit(Transaction *trans)
The xaccTransCommitEdit() method indicates that the changes to the transaction and its splits are com...
void xaccTransBeginEdit(Transaction *trans)
The xaccTransBeginEdit() method must be called before any changes are made to a transaction or any of...
gnc_commodity * xaccTransGetCurrency(const Transaction *trans)
Returns the valuation commodity of this transaction.
PriceSource
Price source enum.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
SplitList * xaccTransGetSplitList(const Transaction *trans)
The xaccTransGetSplitList() method returns a GList of the splits in a transaction.