Пример #1
0
static void
test_qof_object_mark_clean( Fixture *fixture, gconstpointer pData )
{
    QofBook *book = NULL;
    gint32 list_length;

    g_test_message( "Test with no objects" );
    book = qof_book_new();
    g_assert( book );
    object_mark_clean_struct.call_count = 0;
    g_assert_cmpint( g_list_length( get_object_modules() ), == , 0 );
    qof_object_mark_clean( book );
    g_assert_cmpint( object_mark_clean_struct.call_count, == , 0 );

    list_length = generate_and_register_objects( 1, MOCK_OBJECT_MARK_CLEAN );

    g_test_message( "Test with registered objects and mark clean set up" );
    object_mark_clean_struct.objects = get_object_modules();
    qof_object_mark_clean( book );
    g_assert_cmpint( object_mark_clean_struct.call_count, == , list_length );

    qof_book_destroy( book );
}
Пример #2
0
void
qof_book_mark_saved (QofBook *book)
{
    gboolean was_dirty;

    if (!book) return;

    was_dirty = qof_instance_get_dirty_flag(book);
    qof_instance_set_dirty_flag(book, FALSE);
    book->dirty_time = 0;
    qof_object_mark_clean (book);
    if (was_dirty)
    {
        if (book->dirty_cb)
            book->dirty_cb(book, FALSE, book->dirty_data);
    }
}