From 744de4207980e0fb1523a327e9ca3b35903e078b Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Thu, 21 Nov 2002 20:16:23 +0000 Subject: [PATCH] * business-core/test/*.c -- fix the tests for begin/commit edit git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7514 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 3 +++ src/business/business-core/test/test-customer.c | 13 +++++++++++++ src/business/business-core/test/test-employee.c | 13 +++++++++++++ src/business/business-core/test/test-job.c | 14 ++++++++++++++ src/business/business-core/test/test-vendor.c | 13 +++++++++++++ 5 files changed, 56 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6be455cb79..ff2f5090da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2002-11-21 Derek Atkins + * business-core/test/*.c -- fix the tests for begin/commit edit + 2002-11-21 Benoit Grégoire * src/import-export/Transaction-matcher.c: Tweak the matching heuristics. diff --git a/src/business/business-core/test/test-customer.c b/src/business/business-core/test/test-customer.c index bae1d63494..4d0eba9f8d 100644 --- a/src/business/business-core/test/test-customer.c +++ b/src/business/business-core/test/test-customer.c @@ -50,6 +50,7 @@ test_customer (void) do_test (gncCustomerGetBook (customer) == book, "getbook"); + gncCustomerBeginEdit (customer); gncCustomerDestroy (customer); success ("create/destroy"); } @@ -125,8 +126,11 @@ test_string_fcn (GNCBook *book, const char *message, char const *str = get_random_string (); do_test (!gncCustomerIsDirty (customer), "test if start dirty"); + gncCustomerBeginEdit (customer); set (customer, str); do_test (gncCustomerIsDirty (customer), "test dirty later"); + gncCustomerCommitEdit (customer); + do_test (!gncCustomerIsDirty (customer), "test dirty after commit"); do_test (safe_strcmp (get (customer), str) == 0, message); gncCustomerSetActive (customer, FALSE); count++; @@ -141,8 +145,11 @@ test_numeric_fcn (GNCBook *book, const char *message, gnc_numeric num = gnc_numeric_create (17, 1); do_test (!gncCustomerIsDirty (customer), "test if start dirty"); + gncCustomerBeginEdit (customer); set (customer, num); do_test (gncCustomerIsDirty (customer), "test dirty later"); + gncCustomerCommitEdit (customer); + do_test (!gncCustomerIsDirty (customer), "test dirty after commit"); do_test (gnc_numeric_equal (get (customer), num), message); gncCustomerSetActive (customer, FALSE); count++; @@ -157,10 +164,13 @@ test_bool_fcn (GNCBook *book, const char *message, gboolean num = get_random_boolean (); do_test (!gncCustomerIsDirty (customer), "test if start dirty"); + gncCustomerBeginEdit (customer); set (customer, FALSE); set (customer, TRUE); set (customer, num); do_test (gncCustomerIsDirty (customer), "test dirty later"); + gncCustomerCommitEdit (customer); + do_test (!gncCustomerIsDirty (customer), "test dirty after commit"); do_test (get (customer) == num, message); gncCustomerSetActive (customer, FALSE); count++; @@ -176,8 +186,11 @@ test_gint_fcn (GNCBook *book, const char *message, gint num = 17; do_test (!gncCustomerIsDirty (customer), "test if start dirty"); + gncCustomerBeginEdit (customer); set (customer, num); do_test (gncCustomerIsDirty (customer), "test dirty later"); + gncCustomerCommitEdit (customer); + do_test (!gncCustomerIsDirty (customer), "test dirty after commit"); do_test (get (customer) == num, message); gncCustomerSetActive (customer, FALSE); count++; diff --git a/src/business/business-core/test/test-employee.c b/src/business/business-core/test/test-employee.c index f42779c42a..087675298d 100644 --- a/src/business/business-core/test/test-employee.c +++ b/src/business/business-core/test/test-employee.c @@ -50,6 +50,7 @@ test_employee (void) do_test (gncEmployeeGetBook (employee) == book, "getbook"); + gncEmployeeBeginEdit (employee); gncEmployeeDestroy (employee); success ("create/destroy"); } @@ -110,8 +111,11 @@ test_string_fcn (GNCBook *book, const char *message, char const *str = get_random_string (); do_test (!gncEmployeeIsDirty (employee), "test if start dirty"); + gncEmployeeBeginEdit (employee); set (employee, str); do_test (gncEmployeeIsDirty (employee), "test dirty later"); + gncEmployeeCommitEdit (employee); + do_test (!gncEmployeeIsDirty (employee), "test dirty after commit"); do_test (safe_strcmp (get (employee), str) == 0, message); gncEmployeeSetActive (employee, FALSE); count++; @@ -126,8 +130,11 @@ test_numeric_fcn (GNCBook *book, const char *message, gnc_numeric num = gnc_numeric_create (17, 1); do_test (!gncEmployeeIsDirty (employee), "test if start dirty"); + gncEmployeeBeginEdit (employee); set (employee, num); do_test (gncEmployeeIsDirty (employee), "test dirty later"); + gncEmployeeCommitEdit (employee); + do_test (!gncEmployeeIsDirty (employee), "test dirty after commit"); do_test (gnc_numeric_equal (get (employee), num), message); gncEmployeeSetActive (employee, FALSE); count++; @@ -142,10 +149,13 @@ test_bool_fcn (GNCBook *book, const char *message, gboolean num = get_random_boolean (); do_test (!gncEmployeeIsDirty (employee), "test if start dirty"); + gncEmployeeBeginEdit (employee); set (employee, FALSE); set (employee, TRUE); set (employee, num); do_test (gncEmployeeIsDirty (employee), "test dirty later"); + gncEmployeeCommitEdit (employee); + do_test (!gncEmployeeIsDirty (employee), "test dirty after commit"); do_test (get (employee) == num, message); gncEmployeeSetActive (employee, FALSE); count++; @@ -161,8 +171,11 @@ test_gint_fcn (GNCBook *book, const char *message, gint num = 17; do_test (!gncEmployeeIsDirty (employee), "test if start dirty"); + gncEmployeeBeginEdit (employee); set (employee, num); do_test (gncEmployeeIsDirty (employee), "test dirty later"); + gncEmployeeCommitEdit (employee); + do_test (!gncEmployeeIsDirty (employee), "test dirty after commit"); do_test (get (employee) == num, message); gncEmployeeSetActive (employee, FALSE); count++; diff --git a/src/business/business-core/test/test-job.c b/src/business/business-core/test/test-job.c index 6bea300672..888333eb75 100644 --- a/src/business/business-core/test/test-job.c +++ b/src/business/business-core/test/test-job.c @@ -52,6 +52,7 @@ test_job (void) do_test (gncJobGetBook (job) == book, "getbook"); + gncJobBeginEdit (job); gncJobDestroy (job); success ("create/destroy"); } @@ -113,6 +114,7 @@ test_job (void) do_test (list == NULL, "no active jobs"); list = gncCustomerGetJoblist (cust, TRUE); do_test (list != NULL, "all jobs"); + gncJobBeginEdit (job); gncJobDestroy (job); list = gncCustomerGetJoblist (cust, TRUE); do_test (list == NULL, "no more jobs"); @@ -128,8 +130,11 @@ test_string_fcn (GNCBook *book, const char *message, char const *str = get_random_string (); do_test (!gncJobIsDirty (job), "test if start dirty"); + gncJobBeginEdit (job); set (job, str); do_test (gncJobIsDirty (job), "test dirty later"); + gncJobCommitEdit (job); + do_test (!gncJobIsDirty (job), "test dirty after commit"); do_test (safe_strcmp (get (job), str) == 0, message); gncJobSetActive (job, FALSE); count++; } @@ -144,8 +149,11 @@ test_numeric_fcn (GNCBook *book, const char *message, gnc_numeric num = gnc_numeric_create (17, 1); do_test (!gncJobIsDirty (job), "test if start dirty"); + gncJobBeginEdit (job); set (job, num); do_test (gncJobIsDirty (job), "test dirty later"); + gncJobCommitEdit (job); + do_test (!gncJobIsDirty (job), "test dirty after commit"); do_test (gnc_numeric_equal (get (job), num), message); gncJobSetActive (job, FALSE); count++; } @@ -160,10 +168,13 @@ test_bool_fcn (GNCBook *book, const char *message, gboolean num = get_random_boolean (); do_test (!gncJobIsDirty (job), "test if start dirty"); + gncJobBeginEdit (job); set (job, FALSE); set (job, TRUE); set (job, num); do_test (gncJobIsDirty (job), "test dirty later"); + gncJobCommitEdit (job); + do_test (!gncJobIsDirty (job), "test dirty after commit"); do_test (get (job) == num, message); gncJobSetActive (job, FALSE); count++; } @@ -178,8 +189,11 @@ test_gint_fcn (GNCBook *book, const char *message, gint num = 17; do_test (!gncJobIsDirty (job), "test if start dirty"); + gncJobBeginEdit (job); set (job, num); do_test (gncJobIsDirty (job), "test dirty later"); + gncJobCommitEdit (job); + do_test (!gncJobIsDirty (job), "test dirty after commit"); do_test (get (job) == num, message); gncJobSetActive (job, FALSE); count++; } diff --git a/src/business/business-core/test/test-vendor.c b/src/business/business-core/test/test-vendor.c index 95d9f640ac..8335ec7015 100644 --- a/src/business/business-core/test/test-vendor.c +++ b/src/business/business-core/test/test-vendor.c @@ -52,6 +52,7 @@ test_vendor (void) do_test (gncVendorGetBook (vendor) == book, "getbook"); + gncVendorBeginEdit (vendor); gncVendorDestroy (vendor); success ("create/destroy"); } @@ -111,8 +112,11 @@ test_string_fcn (GNCBook *book, const char *message, char const *str = get_random_string (); do_test (!gncVendorIsDirty (vendor), "test if start dirty"); + gncVendorBeginEdit (vendor); set (vendor, str); do_test (gncVendorIsDirty (vendor), "test dirty later"); + gncVendorCommitEdit (vendor); + do_test (!gncVendorIsDirty (vendor), "test dirty after commit"); do_test (safe_strcmp (get (vendor), str) == 0, message); gncVendorSetActive (vendor, FALSE); count++; } @@ -127,8 +131,11 @@ test_numeric_fcn (GNCBook *book, const char *message, gnc_numeric num = gnc_numeric_create (17, 1); do_test (!gncVendorIsDirty (vendor), "test if start dirty"); + gncVendoryBeginEdit (vendor); set (vendor, num); do_test (gncVendorIsDirty (vendor), "test dirty later"); + gncVendorCommitEdit (vendor); + do_test (!gncVendorIsDirty (vendor), "test dirty after commit"); do_test (gnc_numeric_equal (get (vendor), num), message); gncVendorSetActive (vendor, FALSE); count++; } @@ -143,10 +150,13 @@ test_bool_fcn (GNCBook *book, const char *message, gboolean num = get_random_boolean (); do_test (!gncVendorIsDirty (vendor), "test if start dirty"); + gncVendorBeginEdit (vendor); set (vendor, FALSE); set (vendor, TRUE); set (vendor, num); do_test (gncVendorIsDirty (vendor), "test dirty later"); + gncVendorCommitEdit (vendor); + do_test (!gncVendorIsDirty (vendor), "test dirty after commit"); do_test (get (vendor) == num, message); gncVendorSetActive (vendor, FALSE); count++; } @@ -161,8 +171,11 @@ test_gint_fcn (GNCBook *book, const char *message, gint num = 17; do_test (!gncVendorIsDirty (vendor), "test if start dirty"); + gncVendorBeginEdit (vendor); set (vendor, num); do_test (gncVendorIsDirty (vendor), "test dirty later"); + gncVendorCommitEdit (vendor); + do_test (!gncVendorIsDirty (vendor), "test dirty after commit"); do_test (get (vendor) == num, message); gncVendorSetActive (vendor, FALSE); count++; }