Module: wine Branch: master Commit: 564d551a89ba34b9df6d7f0a632d4e790e0f90b7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=564d551a89ba34b9df6d7f0a63...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Sep 27 13:11:08 2012 +0200
vbscript: Added MonthName implementation.
---
dlls/vbscript/global.c | 25 +++++++++++++++++++++++-- dlls/vbscript/tests/api.vbs | 7 +++++++ 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 793d7c8..bf423b4 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -1271,8 +1271,29 @@ static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *arg, unsigned args_cn
static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + int month, abbrev = 0; + BSTR ret; + HRESULT hres; + + TRACE("\n"); + + assert(args_cnt == 1 || args_cnt == 2); + + hres = to_int(arg+args_cnt-1, &month); + if(FAILED(hres)) + return hres; + + if(args_cnt == 2) { + hres = to_int(arg, &abbrev); + if(FAILED(hres)) + return hres; + } + + hres = VarMonthName(month, abbrev, 0, &ret); + if(FAILED(hres)) + return hres; + + return return_bstr(res, ret); }
static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 66b95a9..78e4a8b 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -223,6 +223,13 @@ if isEnglishLang then Call ok(WeekDayName(1, true, 2) = "Mon", "WeekDayName(1, true, 2) = " & WeekDayName(1, true, 2)) Call ok(WeekDayName(1, true, 7) = "Sat", "WeekDayName(1, true, 7) = " & WeekDayName(1, true, 7)) Call ok(WeekDayName(1, true, 7.1) = "Sat", "WeekDayName(1, true, 7.1) = " & WeekDayName(1, true, 7.1)) + + Call ok(MonthName(1) = "January", "MonthName(1) = " & MonthName(1)) + Call ok(MonthName(12) = "December", "MonthName(12) = " & MonthName(12)) + Call ok(MonthName(1, 0) = "January", "MonthName(1, 0) = " & MonthName(1, 0)) + Call ok(MonthName(12, false) = "December", "MonthName(12, false) = " & MonthName(12, false)) + Call ok(MonthName(1, 10) = "Jan", "MonthName(1, 10) = " & MonthName(1, 10)) + Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true)) end if
Call reportSuccess()