Confusion around qof_instance editlevel and test-account-object

Carwyn Nelson bacondrinker at
Sun Nov 5 07:55:56 EST 2017

Hi all,

I’m wondering if anybody would be able to explain something to me that I’m finding a little confusing.

I’m working with Aaron (lmat) on the cpp conversion of Account and as expected during the conversion some of the tests are failing. One of the tests that I’m working on fixing is the test-account-object test. 

I’m currently getting the following test failures:
FAILURE end balance matches /home/carwyn/gnucash/libgnucash/engine/test/test-account-object.cpp:78 
FAILURE end2 balance matches /home/carwyn/gnucash/libgnucash/engine/test/test-account-object.cpp:80
>From reading the test I think its trying to do the following:
Set the initial balance of the account to 5
Remove 5 from the balance
Assert that the balance of the account is 0

The balance is currently -5 so it stands to reason that setting the initial balance to 5 is failing?

The following code appears to be attempting to set the balance to 5:
	five = gnc_numeric_create(5, 1);
qof_instance_increase_editlevel (acc);
g_object_set(acc, "start-balance", &five, NULL);
qof_instance_decrease_editlevel (acc);
g_object_get(acc, "start-balance", &start, "end-balance", &end, NULL);
end2 = xaccAccountGetBalance(acc);

I’m getting quite confused as to how this would normally work. Account does not have a member variable called “start-balance” so how does gobject know how to set the start_balance? Doing some step-through debugging just takes me to gobject.h which is basically a black hole from then onwards.

Would somebody be able to point me in the right direction to how this is working so that I can work towards fixing the test.

Much appreciation in advance for any help that comes my way.


PS: I am in IRC as carwynnelson, carwynnelson_ or carwyn-desktop.

More information about the gnucash-devel mailing list