29 #include "engine/gnc-hooks.h"
31 static char* get_filepath(
const char* filename)
35 const char *srcdir = g_getenv(
"SRCDIR");
38 g_test_message(
"No env variable SRCDIR exists, assuming \".\"\n");
42 result = g_strdup_printf(
"%s/%s", srcdir, filename);
44 g_test_message(
"Using file path %s\n", result);
47 g_assert(g_file_test(result, G_FILE_TEST_EXISTS));
53 test_qofsession_aqb_kvp(
void )
58 char *file1 = get_filepath(
"file-book.gnucash");
59 char *file2 = get_filepath(
"file-book-hbcislot.gnucash");
65 char *newfile = g_strdup_printf(
"file://%s", file1);
74 g_assert(io_err == 0);
76 qof_session_load (new_session, NULL);
79 g_assert(io_err == 0);
86 g_assert(mylist == 0);
92 gnc_hook_run(HOOK_BOOK_CLOSED, new_session);
101 char *newfile = g_strdup_printf(
"file://%s", file2);
110 g_assert(io_err == 0);
112 qof_session_load (new_session, NULL);
115 g_assert(io_err == 0);
121 const char* ORIGINAL_NAME =
"Some Name";
122 const char* CHANGED_NAME =
"Some Changed Name";
125 g_assert(kvp_list != 0);
126 g_assert_cmpint(g_list_length(kvp_list), ==, 1);
129 g_assert_cmpint(g_list_length(templ_list), ==, 1);
131 templ = templ_list->data;
139 g_assert(!qof_instance_get_dirty(QOF_INSTANCE(book)));
143 g_assert(qof_instance_get_dirty(QOF_INSTANCE(book)));
148 g_assert(mylist != 0);
149 g_assert_cmpint(g_list_length(mylist), ==, 1);
152 g_assert_cmpint(g_list_length(templ_list), ==, 1);
154 templ = templ_list->data;
163 Account* account = gnc_book_get_root_account(book);
164 GDate retrieved_date, original_date;
174 g_test_message(
"retrieved_ts=%s\n",
gnc_print_date(retrieved_ts));
178 g_date_set_dmy(&original_date, 29, 8, 2014);
180 g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
208 g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
216 gnc_hook_run(HOOK_BOOK_CLOSED, new_session);
typedefG_BEGIN_DECLS struct _GncABTransTempl GncABTransTempl
Timespec gnc_ab_get_account_trans_retrieval(const Account *a)
const char * gnc_print_date(Timespec ts)
Templates for AqBanking transactions.
QofBackendError
The errors that can be reported to the GUI & other front-end users.
Use a 64-bit unsigned int timespec.
void gnc_ab_trans_templ_list_free(GList *l)
void gnc_ab_trans_templ_set_name(GncABTransTempl *t, const gchar *name)
GList * gnc_ab_trans_templ_list_to_kvp_list(GList *k)
GDate timespec_to_gdate(Timespec ts)
QofBook * qof_session_get_book(const QofSession *session)
const gchar * gnc_ab_trans_templ_get_name(const GncABTransTempl *t)
void gnc_ab_set_account_trans_retrieval(Account *a, Timespec time)
QofBackendError qof_session_get_error(QofSession *session)
void gnc_ab_set_book_template_list(QofBook *b, GList *template_list)
void qof_session_begin(QofSession *session, const char *book_id, gboolean ignore_lock, gboolean create, gboolean force)
Timespec timespec_now(void)
GList * gnc_ab_trans_templ_list_new_from_kvp_list(GList *v)
GList * gnc_ab_get_book_template_list(QofBook *b)
size_t qof_print_gdate(char *buf, size_t bufflen, const GDate *gd)