Skip to content

Commit 0e48142

Browse files
committed
Merge John Ralls's 'win32-tests' into stable
2 parents 5f70178 + dcb7a8c commit 0e48142

40 files changed

+1199
-878
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ endif()
1414
if (POLICY CMP0167)
1515
cmake_policy(SET CMP0167 OLD)
1616
endif()
17+
# CMake 3.31+ Use normalization rules on install DESTINATION
18+
# command. We shouldn't be impacted so allow the new behavior.
19+
if (POLICY CMP0177)
20+
cmake_policy(SET CMP0177 NEW)
21+
endif()
1722

1823
project (gnucash
1924
VERSION 5.12

bindings/guile/test/test-engine-extras.scm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@
524524

525525
;; inv-1 is generated for a customer
526526
(inv-1 (let ((inv-1 (gncInvoiceCreate (gnc-get-current-book))))
527+
(gncInvoiceSetID inv-1 "0001")
527528
(gncInvoiceSetOwner inv-1 owner-1)
528529
(gncInvoiceSetNotes inv-1 "inv-1-notes")
529530
(gncInvoiceSetBillingID inv-1 "inv-1-billing-id")
@@ -542,6 +543,7 @@
542543

543544
;; inv-2 is generated from a customer's job
544545
(inv-2 (let ((inv-2 (gncInvoiceCreate (gnc-get-current-book))))
546+
(gncInvoiceSetID inv-2 "0002")
545547
(gncInvoiceSetOwner inv-2 owner-2)
546548
(gncInvoiceSetNotes inv-2 "inv-2-notes")
547549
(gncInvoiceSetCurrency inv-2 USD)
@@ -561,6 +563,7 @@
561563

562564
;; inv-3 is generated from a vendor
563565
(inv-3 (let ((inv-3 (gncInvoiceCreate (gnc-get-current-book))))
566+
(gncInvoiceSetID inv-3 "0003")
564567
(gncInvoiceSetOwner inv-3 owner-3)
565568
(gncInvoiceSetNotes inv-3 "inv-3-notes")
566569
(gncInvoiceSetCurrency inv-3 USD)
@@ -578,30 +581,35 @@
578581

579582
;; inv-4 is generated for an employee
580583
(inv-4 (let ((inv-4 (gncInvoiceCreate (gnc-get-current-book))))
584+
(gncInvoiceSetID inv-4 "0004")
581585
(gncInvoiceSetOwner inv-4 owner-4)
582586
(gncInvoiceSetNotes inv-4 "inv-4-notes")
583587
(gncInvoiceSetCurrency inv-4 USD)
584588
inv-4))
585589

586590
;; inv-5 cust-credit-note
587591
(inv-5 (let ((inv-5 (gncInvoiceCopy inv-1)))
592+
(gncInvoiceSetID inv-5 "0005")
588593
(gncInvoiceSetIsCreditNote inv-5 #t)
589594
(gncInvoiceSetCurrency inv-5 USD)
590595
inv-5))
591596

592597
;; inv-6 vend-credit-note
593598
(inv-6 (let ((inv-6 (gncInvoiceCopy inv-3)))
599+
(gncInvoiceSetID inv-6 "0006")
594600
(gncInvoiceSetIsCreditNote inv-6 #t)
595601
(gncInvoiceSetCurrency inv-6 USD)
596602
inv-6))
597603

598604
;; inv-7 emp-credit-note
599605
(inv-7 (let ((inv-7 (gncInvoiceCopy inv-4)))
606+
(gncInvoiceSetID inv-7 "0007")
600607
(gncInvoiceSetIsCreditNote inv-7 #t)
601608
(gncInvoiceSetCurrency inv-7 USD)
602609
inv-7))
603610

604611
(inv-8 (let ((inv-8 (gncInvoiceCreate (gnc-get-current-book))))
612+
(gncInvoiceSetID inv-8 "0008")
605613
(gncInvoiceSetOwner inv-8 owner-1)
606614
(gncInvoiceSetCurrency inv-8 USD)
607615
inv-8))

common/cmake_modules/GncAddSchemeTargets.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ function(gnc_add_scheme_targets _TARGET)
309309
if(SCHEME_TGT_TEST)
310310
add_dependencies(check ${_TARGET})
311311
else()
312-
install(FILES ${_TARGET_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${GUILE_REL_SITECCACHEDIR}/${SCHEME_TGT_OUTPUT_DIR})
313-
install(FILES ${SCHEME_TGT_SOURCES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${GUILE_REL_SITEDIR}/${SCHEME_TGT_OUTPUT_DIR})
312+
install(FILES ${_TARGET_FILES} DESTINATION ${GUILE_REL_SITECCACHEDIR}/${SCHEME_TGT_OUTPUT_DIR})
313+
install(FILES ${SCHEME_TGT_SOURCES} DESTINATION ${GUILE_REL_SITEDIR}/${SCHEME_TGT_OUTPUT_DIR})
314314
endif()
315315
endfunction()
316316

common/cmake_modules/GncAddTest.cmake

Lines changed: 68 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,94 @@
11

22

33
function(get_guile_env)
4-
set(_GNC_MODULE_PATH ${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash)
4+
set(_gnc_module_path ${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash)
55
if (WIN32)
6-
set(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/bin)
7-
endif()
8-
set(env "")
9-
list(APPEND env "GNC_UNINSTALLED=yes")
10-
list(APPEND env "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
11-
if (APPLE)
12-
list(APPEND env "DYLD_LIBRARY_PATH=${_GNC_MODULE_PATH}:$ENV{DYLD_LIBRARY_PATH}")
13-
endif()
14-
if (UNIX)
15-
list(APPEND env "LD_LIBRARY_PATH=${_GNC_MODULE_PATH}:$ENV{LD_LIBRARY_PATH}")
6+
set(_gnc_module_path ${CMAKE_BINARY_DIR}/bin)
167
endif()
8+
set(_relative_site_dir "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}")
9+
set(_relative_cache_dir "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
10+
1711
if (MINGW64)
1812
set(fpath "")
1913
set(path $ENV{PATH})
2014
list(INSERT path 0 ${CMAKE_BINARY_DIR}/bin)
21-
foreach(dir ${path})
22-
string(REGEX REPLACE "^([A-Za-z]):" "/\\1" dir ${dir})
23-
string(REGEX REPLACE "\\\\" "/" dir ${dir})
24-
set(fpath "${fpath}${dir}:")
25-
endforeach(dir)
26-
list(APPEND env "PATH=${fpath}")
27-
set(compiled_path "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
28-
string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
29-
list(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
30-
endif()
31-
list(APPEND env "GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
32-
list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
33-
34-
set(guile_load_paths "")
35-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}")
36-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/deprecated") # Path to gnucash' deprecated modules
15+
if (${GUILE_EFFECTIVE_VERSION} VERSION_LESS 2.2)
16+
foreach(dir ${path})
17+
make_unix_path(dir)
18+
list(APPEND fpath ${dir})
19+
endforeach(dir)
20+
make_unix_path_list(fpath)
21+
else()
22+
set(fpath ${path})
23+
make_win32_path_list(fpath)
24+
endif()
25+
endif()
26+
27+
set(guile_load_paths "$ENV{GUILE_LOAD_PATH}")
28+
list(APPEND guile_load_paths
29+
"${_relative_site_dir}"
30+
"${_relative_site_dir}/gnucash/deprecated"
31+
)
3732
if (GUILE_COVERAGE)
38-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash")
39-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/report")
40-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/reports")
41-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/engine")
42-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/app-utils")
43-
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/qif-import")
33+
list(APPEND guile_load_paths
34+
"${_relative_site_dir}/gnucash"
35+
"${_relative_site_dir}/gnucash/report"
36+
"${_relative_site_dir}/gnucash/reports"
37+
"${_relative_site_dir}/gnucash/engine"
38+
"${_relative_site_dir}/gnucash/app-utils"
39+
"${_relative_site_dir}/gnucash/qif-import"
40+
)
4441

4542
endif()
46-
set(guile_load_path "${guile_load_paths}")
43+
set(_guile_load_path "${guile_load_paths}")
4744

48-
set(guile_load_compiled_paths "")
49-
list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
50-
list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}/gnucash/deprecated")
51-
list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}/tests")
52-
set(guile_load_compiled_path "${guile_load_compiled_paths}")
45+
set(guile_load_compiled_paths "$ENV{GUILE_LOAD_COMPILED_PATH}")
46+
list(APPEND guile_load_compiled_paths
47+
"${_relative_cache_dir}"
48+
"${_relative_cache_dir}/gnucash/deprecated"
49+
"${_relative_cache_dir}/tests"
50+
)
51+
set(_guile_load_compiled_path "${guile_load_compiled_paths}")
5352

54-
if (MINGW64)
53+
if (MINGW64 AND ${GUILE_EFFECTIVE_VERSION} VERSION_LESS 2.2)
5554
set(new_path "")
56-
foreach(load_item ${guile_load_path})
57-
string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
58-
list(APPEND new_path ${load_item})
55+
foreach(load_item ${_guile_load_path})
56+
make_unix_path(load_item)
57+
list(APPEND new_path "${load_item}")
5958
endforeach(load_item)
60-
set(guile_load_path ${new_path})
59+
set(_guile_load_path ${new_path})
6160

6261
set(new_path "")
63-
foreach(load_item ${guile_load_compiled_path})
64-
string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
62+
foreach(load_item ${_guile_load_compiled_path})
63+
make_unix_path(load_item)
6564
list(APPEND new_path ${load_item})
6665
endforeach(load_item)
67-
set(guile_load_compiled_path ${new_path})
66+
set(_guile_load_compiled_path ${new_path})
6867
endif()
69-
if (WIN32 AND NOT MINGW64)
70-
string(REPLACE ";" "\\\\;" GUILE_LOAD_PATH "${guile_load_path}")
71-
string(REPLACE ";" "\\\\;" GUILE_LOAD_COMPILED_PATH "${guile_load_compiled_path}")
68+
69+
if (NOT MINGW64 OR ${GUILE_EFFECTIVE_VERSION} VERSION_LESS 2.2)
70+
make_unix_path_list(_guile_load_path)
71+
make_unix_path_list(_guile_load_compiled_path)
7272
else()
73-
string(REPLACE ";" ":" GUILE_LOAD_PATH "${guile_load_path}")
74-
string(REPLACE ";" ":" GUILE_LOAD_COMPILED_PATH "${guile_load_compiled_path}")
73+
make_win32_path_list(_guile_load_path)
74+
make_win32_path_list(_guile_load_compiled_path)
75+
endif()
76+
77+
set(_guile_env
78+
"GNC_MODULE_PATH=${_gnc_module_path}"
79+
"GUILE=${GUILE_EXECUTABLE}"
80+
"GUILE_LOAD_PATH=${_guile_load_path}"
81+
"GUILE_LOAD_COMPILED_PATH=${_guile_load_compiled_path}"
82+
"GUILE_WARN_DEPRECATED=detailed"
83+
)
84+
if (MINGW64)
85+
list(APPEND _guile_env "PATH=${fpath}")
86+
elseif (APPLE)
87+
list(APPEND _guile_env "DYLD_LIBRARY_PATH=${_gnc_module_path}:$ENV{DYLD_LIBRARY_PATH}")
88+
elseif (UNIX)
89+
list(APPEND _guile_env "LD_LIBRARY_PATH=${_gnc_module_path}:$ENV{LD_LIBRARY_PATH}")
7590
endif()
76-
list(APPEND env "GUILE_LOAD_PATH=${GUILE_LOAD_PATH}")
77-
list(APPEND env "GUILE_LOAD_COMPILED_PATH=${GUILE_LOAD_COMPILED_PATH}")
78-
list(APPEND env "GUILE_WARN_DEPRECATED=detailed")
79-
set(GUILE_ENV ${env} PARENT_SCOPE)
91+
set(GUILE_ENV "${_guile_env}" PARENT_SCOPE)
8092
endfunction()
8193

8294

gnucash/gnome-utils/gnc-plugin-file-history.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,6 @@ gnc_history_update_action (GncMainWindow *window,
407407
GncMenuModelSearch *gsm = g_new0 (GncMenuModelSearch, 1);
408408
gchar *action_name;
409409
gint limit;
410-
gboolean add_item = FALSE;
411-
gint pos;
412410

413411
ENTER("window %p, index %d, filename %s", window, index,
414412
filename ? filename : "(null)");
@@ -418,9 +416,12 @@ gnc_history_update_action (GncMainWindow *window,
418416
gsm->search_action_label = NULL;
419417
gsm->search_action_name = action_name;
420418

421-
if (!gnc_menubar_model_find_item (gnc_main_window_get_menu_model(window), gsm)) // could not find action_name
419+
if (gnc_menubar_model_find_item (gnc_main_window_get_menu_model(window), gsm))
420+
{
421+
g_menu_remove (G_MENU(gsm->model), gsm->index);
422+
}
423+
else // could not find action_name
422424
{
423-
add_item = TRUE;
424425
gsm->search_action_name = "FilePlaceholder6"; // placeholder
425426

426427
if (!gnc_menubar_model_find_item (gnc_main_window_get_menu_model(window), gsm))
@@ -430,16 +431,12 @@ gnc_history_update_action (GncMainWindow *window,
430431
g_free (action_name);
431432
return;
432433
}
433-
else
434-
pos = gsm->index + index;
434+
gsm->index += index;
435435
}
436-
else
437-
pos = gsm->index;
438436

439-
limit = gnc_prefs_get_int (GNC_PREFS_GROUP_HISTORY,
440-
GNC_PREF_HISTORY_MAXFILES);
437+
limit = gnc_prefs_get_int (GNC_PREFS_GROUP_HISTORY, GNC_PREF_HISTORY_MAXFILES);
441438

442-
if (filename && (strlen(filename) > 0) && (index < limit))
439+
if (filename && *filename && index < limit)
443440
{
444441
GMenuItem *item;
445442
gchar *label_name = gnc_history_generate_label (index, filename);
@@ -448,13 +445,8 @@ gnc_history_update_action (GncMainWindow *window,
448445
action_name, NULL);
449446

450447
item = g_menu_item_new (label_name, full_action_name);
451-
452448
g_menu_item_set_attribute (item, GNC_MENU_ATTRIBUTE_TOOLTIP, "s", tooltip);
453-
454-
if (!add_item)
455-
g_menu_remove (G_MENU(gsm->model), pos);
456-
457-
g_menu_insert_item (G_MENU(gsm->model), pos, item);
449+
g_menu_insert_item (G_MENU(gsm->model), gsm->index, item);
458450

459451
g_free (full_action_name);
460452
g_free (label_name);

gnucash/register/ledger-core/gncEntryLedger.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,14 @@ gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
713713
GList *taxes = NULL;
714714
int denom = 100;
715715
gnc_numeric value_unrounded, taxes_unrounded;
716+
GncEntry *entry;
716717

717718
gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
718-
gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
719+
entry = gnc_entry_ledger_get_current_entry (ledger);
720+
if (ledger->is_cust_doc)
721+
price = gncEntryGetInvPrice (entry);
722+
else
723+
price = gncEntryGetBillPrice (entry);
719724
gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &discount);
720725

721726
disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);

gnucash/register/ledger-core/gncEntryLedgerModel.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ static const char * get_pric_entry (VirtualLocation virt_loc,
281281
GncEntryLedger *ledger = user_data;
282282
GncEntry *entry;
283283
gnc_numeric price;
284+
gnc_commodity *curr;
285+
GNCPrintAmountInfo print_info;
284286

285287
entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
286288
if (ledger->is_cust_doc)
@@ -291,7 +293,10 @@ static const char * get_pric_entry (VirtualLocation virt_loc,
291293
if (gnc_numeric_zero_p (price))
292294
return NULL;
293295

294-
return xaccPrintAmount (price, gnc_default_print_info (FALSE));
296+
curr = gncInvoiceGetCurrency (ledger->invoice);
297+
print_info = gnc_default_price_print_info (curr);
298+
299+
return xaccPrintAmount (price, print_info);
295300
}
296301

297302
static const char * get_qty_entry (VirtualLocation virt_loc,

gnucash/report/commodity-utilities.scm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@
590590
;; no, create sub-alist from scratch
591591
(let ((pair (list txn-comm (cons (gnc:make-value-collector)
592592
(gnc:make-value-collector)))))
593-
((caadr pair) 'add value-amt)
594-
((cdadr pair) 'add share-amt)
593+
((caadr pair) 'add (- value-amt))
594+
((cdadr pair) 'add (- share-amt))
595595
;; and add the new sub-alist to sumlist.
596596
(loop (cdr comm-splits)
597597
(cons (list acc-comm (list pair)) sumlist)))))))))))

gnucash/report/reports/standard/balsheet-pnl.scm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ also show overall period profit & loss."))
361361
(gnc:make-html-table-cell/size
362362
1 (if disable-account-indent? 1 (- maxindent indent))
363363
label)))
364+
;; ensure the account name cell doesn't wrap
365+
(_ (gnc:html-table-cell-set-style! account-cell "text-cell"
366+
'attribute '("style" "white-space:nowrap;")))
364367
(row (append
365368
(if disable-account-indent?
366369
'()

0 commit comments

Comments
 (0)