From 95361ad0609e140d0acf0fb4602fa54f8f5020d8 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 29 Aug 2022 14:57:18 -0700 Subject: [PATCH] [options] Move gnc-options test to engine/test/CMakeLists.txt. --- bindings/guile/test/CMakeLists.txt | 3 +++ libgnucash/app-utils/test/CMakeLists.txt | 24 ------------------- libgnucash/engine/test/CMakeLists.txt | 20 ++++++++++++++++ libgnucash/engine/test/gtest-gnc-option.cpp | 9 +++---- libgnucash/engine/test/gtest-gnc-optiondb.cpp | 7 +++--- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/bindings/guile/test/CMakeLists.txt b/bindings/guile/test/CMakeLists.txt index 5e086521ed..d91e59ae0f 100644 --- a/bindings/guile/test/CMakeLists.txt +++ b/bindings/guile/test/CMakeLists.txt @@ -157,6 +157,9 @@ set_local_dist(test_guile_DIST_local test-print-queries.cpp test-scm-query.cpp test-scm-query-string.cpp + test-options.scm + test-gnc-optiondb.scm + test-gnc-option-scheme-output.scm ${test_engine_SCHEME_DIST} ${test_scm_SCHEME} ${test_app_utils_scheme_SOURCES} diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt index 22508fea29..4b4cbf384d 100644 --- a/libgnucash/app-utils/test/CMakeLists.txt +++ b/libgnucash/app-utils/test/CMakeLists.txt @@ -31,25 +31,6 @@ gnc_add_test_with_guile(test-sx test-sx.cpp APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS ) -set(gtest_gnc_option_SOURCES - ../../engine/test/gtest-gnc-option.cpp - ../../engine/test/gtest-gnc-optiondb.cpp) - -set(gtest_gnc_option_INCLUDES - ${MODULEPATH} - ${CMAKE_SOURCE_DIR}/libgnucash/engine - ${CMAKE_BINARY_DIR}/common # for config.h - ${GLIB2_INCLUDE_DIRS} - ${GUILE_INCLUDE_DIRS}) - -set(gtest_gnc_option_LIBS - gnc-app-utils - gnc-engine - ${GLIB2_LDFLAGS} - ${GUILE_LDFLAGS} - gtest) - -gnc_add_test(test-gnc-option "${gtest_gnc_option_SOURCES}" gtest_gnc_option_INCLUDES gtest_gnc_option_LIBS) set(GUILE_DEPENDS scm-test-engine @@ -65,13 +46,8 @@ set_dist_list(test_app_utils_DIST test-exp-parser.c test-print-parse-amount.cpp test-sx.cpp - ../../engine/test/gtest-gnc-option.cpp - ../../engine/test/gtest-gnc-optiondb.cpp test-c-interface.scm test-date-utilities.scm - test-options.scm - test-gnc-optiondb.scm - test-gnc-option-scheme-output.scm ${test_app_utils_scheme_SOURCES} ${test_app_utils_SOURCES} ) diff --git a/libgnucash/engine/test/CMakeLists.txt b/libgnucash/engine/test/CMakeLists.txt index 8e44172ff6..1624e04160 100644 --- a/libgnucash/engine/test/CMakeLists.txt +++ b/libgnucash/engine/test/CMakeLists.txt @@ -194,6 +194,24 @@ gtest-qofquerycore.cpp) gnc_add_test(test-qofquerycore "${test_qofquerycore_SOURCES}" gtest_engine_INCLUDES gtest_old_engine_LIBS) +set(gtest_gnc_option_SOURCES + gtest-gnc-option.cpp + gtest-gnc-optiondb.cpp) + +set(gtest_gnc_option_INCLUDES + ${MODULEPATH} + ${CMAKE_SOURCE_DIR}/libgnucash/engine + ${CMAKE_BINARY_DIR}/common # for config.h + ${GLIB2_INCLUDE_DIRS} + ${GUILE_INCLUDE_DIRS}) + +set(gtest_gnc_option_LIBS + gnc-engine + ${GLIB2_LDFLAGS} + ${GUILE_LDFLAGS} + gtest) + +gnc_add_test(test-gnc-option "${gtest_gnc_option_SOURCES}" gtest_gnc_option_INCLUDES gtest_gnc_option_LIBS) set(test_engine_SOURCES_DIST dummy.cpp @@ -202,6 +220,8 @@ set(test_engine_SOURCES_DIST gtest-gnc-numeric.cpp gtest-gnc-timezone.cpp gtest-gnc-datetime.cpp + gtest-gnc-option.cpp + gtest-gnc-optiondb.cpp gtest-import-map.cpp gtest-qofquerycore.cpp test-account-object.cpp diff --git a/libgnucash/engine/test/gtest-gnc-option.cpp b/libgnucash/engine/test/gtest-gnc-option.cpp index 63506247da..2e66c0ab98 100644 --- a/libgnucash/engine/test/gtest-gnc-option.cpp +++ b/libgnucash/engine/test/gtest-gnc-option.cpp @@ -35,7 +35,6 @@ extern "C" #include "gnc-commodity.h" #include "gnc-date.h" #include -#include "gnc-ui-util.h" #include "gnc-session.h" } @@ -143,7 +142,8 @@ TEST(GncOption, test_bool_stream_in) class GncOptionTest : public ::testing::Test { protected: - GncOptionTest() : m_session{gnc_get_current_session()}, m_book{gnc_get_current_book()} {} + GncOptionTest() : m_session{gnc_get_current_session()}, + m_book{qof_session_get_book(gnc_get_current_session())} {} ~GncOptionTest() { gnc_clear_current_session(); } QofSession* m_session; @@ -200,7 +200,7 @@ class GncOptionCommodityTest : public ::testing::Test { protected: GncOptionCommodityTest() : m_session{gnc_get_current_session()}, - m_book{gnc_get_current_book()}, + m_book{qof_session_get_book(gnc_get_current_session())}, m_table{gnc_commodity_table_new()} { /* We can't initialize the commodities with their values because we first must @@ -522,7 +522,8 @@ class GncOptionAccountTest : public ::testing::Test { protected: GncOptionAccountTest() : - m_session{gnc_get_current_session()}, m_book{gnc_get_current_book()}, + m_session{gnc_get_current_session()}, + m_book{qof_session_get_book(gnc_get_current_session())}, m_root{gnc_account_create_root(m_book)} { auto create_account = [this](Account* parent, GNCAccountType type, diff --git a/libgnucash/engine/test/gtest-gnc-optiondb.cpp b/libgnucash/engine/test/gtest-gnc-optiondb.cpp index 9fcbd1498b..ecedeff80e 100644 --- a/libgnucash/engine/test/gtest-gnc-optiondb.cpp +++ b/libgnucash/engine/test/gtest-gnc-optiondb.cpp @@ -30,7 +30,6 @@ extern "C" { -#include "gnc-ui-util.h" #include "gnc-session.h" } @@ -104,7 +103,8 @@ TEST_F(GncOptionDBTest, test_register_report_placement_option) struct GncOptionDBAccountTest : public ::testing::Test { GncOptionDBAccountTest() : - m_sess{gnc_get_current_session()}, m_book{gnc_get_current_book()}, + m_sess{gnc_get_current_session()}, + m_book{qof_session_get_book(gnc_get_current_session())}, m_root{gnc_account_create_root(m_book)}, m_db{std::make_unique()} { @@ -301,7 +301,8 @@ class GncOptionDBIOTest : public ::testing::Test { protected: GncOptionDBIOTest() : - m_book{gnc_get_current_book()}, m_root{gnc_account_create_root(m_book)}, + m_book{qof_session_get_book(gnc_get_current_session())}, + m_root{gnc_account_create_root(m_book)}, m_db{std::make_unique()} { auto create_account = [this](Account* parent, GNCAccountType type,