Resolves: tdf#100440 check mode to be 0 or 1 for MONTHS(), YEARS() and WEEKS()

Needed to adapt the WEEKS and YEARS test documents to cope with the
change.

Change-Id: Ia52505418f4fed684bd04290c608e2a65eee2fbc
This commit is contained in:
Eike Rathke 2016-06-30 18:49:36 +02:00
parent ad59dcf7da
commit 14e31d6cf4
3 changed files with 679 additions and 676 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -591,6 +591,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks(
sal_Int32 nStartDate, sal_Int32 nEndDate,
sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
{
if (nMode != 0 && nMode != 1)
throw lang::IllegalArgumentException();
sal_Int32 nNullDate = GetNullDate( xOptions );
sal_Int32 nDays1 = nStartDate + nNullDate;
@ -628,6 +631,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffMonths(
sal_Int32 nStartDate, sal_Int32 nEndDate,
sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
{
if (nMode != 0 && nMode != 1)
throw lang::IllegalArgumentException();
sal_Int32 nNullDate = GetNullDate( xOptions );
sal_Int32 nDays1 = nStartDate + nNullDate;
@ -673,6 +679,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffYears(
sal_Int32 nStartDate, sal_Int32 nEndDate,
sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
{
if (nMode != 0 && nMode != 1)
throw lang::IllegalArgumentException();
if ( nMode != 1 )
return getDiffMonths( xOptions, nStartDate, nEndDate, nMode ) / 12;