mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-30 04:33:55 -06:00
Bug 796878 - test-qofsession fails on x86_32.
This commit is contained in:
parent
a8c884016e
commit
7a4b06c442
@ -225,8 +225,9 @@ QofSessionImpl::load (QofPercentageFunc percentage_func) noexcept
|
||||
(err != ERR_SQL_DB_TOO_OLD) &&
|
||||
(err != ERR_SQL_DB_TOO_NEW))
|
||||
{
|
||||
qof_book_destroy(m_book);
|
||||
auto old_book = m_book;
|
||||
m_book = qof_book_new();
|
||||
qof_book_destroy(old_book);
|
||||
LEAVE ("error from backend %d", get_error ());
|
||||
return;
|
||||
}
|
||||
|
@ -170,20 +170,22 @@ TEST (QofSessionTest, clear_error)
|
||||
|
||||
TEST (QofSessionTest, load)
|
||||
{
|
||||
// We register a provider that gives a backend that
|
||||
// throws an error on load.
|
||||
// This error during load should cause the qof session to
|
||||
// "roll back" the book load.
|
||||
/* We register a provider that gives a backend that throws an error on load.
|
||||
* This error during load should cause the qof session to destroy the book
|
||||
* and create a new one.
|
||||
*/
|
||||
qof_backend_register_provider (get_provider ());
|
||||
QofSession s;
|
||||
s.begin ("book1", false, false, false);
|
||||
auto book = s.get_book ();
|
||||
s.load (nullptr);
|
||||
EXPECT_EQ (book, s.get_book ());
|
||||
EXPECT_NE (book, s.get_book ());
|
||||
|
||||
// Now we'll do the load without returning an error from the backend,
|
||||
// and ensure that it's the original book and that it's not empty.
|
||||
/* Now we'll do the load without returning an error from the backend,
|
||||
* and ensure that it's the new book from the previous test.
|
||||
*/
|
||||
load_error = false;
|
||||
book = s.get_book();
|
||||
s.load (nullptr);
|
||||
EXPECT_EQ (book, s.get_book ());
|
||||
EXPECT_EQ (s.get_error(), ERR_BACKEND_NO_ERR);
|
||||
|
Loading…
Reference in New Issue
Block a user