Fixups for GncOptionDateValue better design.

pull/1191/head
John Ralls 7 years ago
parent b2fb57d39e
commit 4b997cd025

@ -152,7 +152,7 @@ GncOptionDateValue::get_value() const
return static_cast<time64>(GncDateTime(now));
}
static const char* date_type_str[] {"absolute", "relative"};
static const std::array<const char*, 16> date_period_str
static const std::array<const char*, 15> date_period_str
{
"today",
"start-this-month", "end-this-month",

@ -184,6 +184,22 @@ using Account = struct account_s;
%ignore GncOptionDateValue(GncOptionDateValue&&);
%ignore GncOptionDateValue::operator=(const GncOptionDateValue&);
%ignore GncOptionDateValue::operator=(GncOptionDateValue&&);
%rename(absolute) RelativeDatePeriod::ABSOLUTE;
%rename(today) RelativeDatePeriod::TODAY;
%rename(start_this_month) RelativeDatePeriod::START_THIS_MONTH;
%rename(end_this_month) RelativeDatePeriod::END_THIS_MONTH;
%rename(start_prev_month) RelativeDatePeriod::START_PREV_MONTH;
%rename(end_prev_month) RelativeDatePeriod::END_PREV_MONTH;
%rename(start_current_quarter) RelativeDatePeriod::START_CURRENT_QUARTER;
%rename(end_current_quarter) RelativeDatePeriod::END_CURRENT_QUARTER;
%rename(start_prev_quarter) RelativeDatePeriod::START_PREV_QUARTER;
%rename(end_prev_quarter) RelativeDatePeriod::END_PREV_QUARTER;
%rename(start_cal_year) RelativeDatePeriod::START_CAL_YEAR;
%rename(end_cal_yea) RelativeDatePeriod::END_CAL_YEAR;
%rename(start_prev_year) RelativeDatePeriod::START_PREV_YEAR;
%rename(end_prev_year) RelativeDatePeriod::END_PREV_YEAR;
%rename(start_accounting_period) RelativeDatePeriod::START_ACCOUNTING_PERIOD;
%rename(end_accounting_period) RelativeDatePeriod::END_ACCOUNTING_PERIOD;
%typemap(typecheck, precedence=SWIG_TYPECHECK_INT64) time64 {
$1 = scm_is_signed_integer($input, INT64_MAX, INT64_MIN);

@ -183,12 +183,13 @@
(test-begin "test-gnc-test-date-option")
(let* ((option-db (gnc-option-db-new))
(date-opt (gnc-register-date-interval-option option-db "foo" "bar"
"baz" "Phony Option"))
"baz" "Phony Option"
(RelativeDatePeriod-today)))
(a-time (gnc-dmy2time64 11 07 2019)))
(test-equal (current-time) (gnc-option-value option-db "foo" "bar"))
(gnc-set-option option-db "foo" "bar" a-time)
(test-equal a-time (gnc-option-value option-db "foo" "bar"))
(test-end "test-gnc-test-date-option")))
(test-equal a-time (gnc-option-value option-db "foo" "bar")))
(test-end "test-gnc-test-date-option"))
(define (test-gnc-make-number-range-option)
(test-begin "test-gnc-number-range-option")

Loading…
Cancel
Save