Commit 0480bbfb authored by Shuai Meng's avatar Shuai Meng Committed by Alexandre Julliard

vbscript: Implemented RGB.

parent fdd8454e
......@@ -778,8 +778,24 @@ static HRESULT Global_UBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA
static HRESULT Global_RGB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
HRESULT hres;
int i, color[3];
TRACE("%s %s %s\n", debugstr_variant(arg), debugstr_variant(arg + 1), debugstr_variant(arg + 2));
assert(args_cnt == 3);
for(i = 0; i < 3; i++) {
hres = to_int(arg + i, color + i);
if(FAILED(hres))
return hres;
if(color[i] > 255)
color[i] = 255;
if(color[i] < 0)
return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
}
return return_int(res, RGB(color[0], color[1], color[2]));
}
static HRESULT Global_Len(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
......@@ -1242,4 +1242,26 @@ Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CB
Call ok(getVT(Date) = "VT_DATE", "getVT(Date) = " & getVT(Date))
Call ok(getVT(Time) = "VT_DATE", "getVT(Time) = " & getVT(Time))
Sub testRGBError(arg1, arg2, arg3, error_num)
on error resume next
Dim x
Call Err.clear()
x = RGB(arg1, arg2, arg3)
Call ok(Err.number = error_num, "Err.number1 = " & Err.number)
Call Err.clear()
Call RGB(arg1, arg2, arg3)
Call ok(Err.number = error_num, "Err.number2 = " & Err.number)
End Sub
Call ok(RGB(0, &h1f&, &hf1&) = &hf11f00&, "RGB(0, &h1f&, &hf1&) = " & RGB(0, &h1f&, &hf1&))
Call ok(getVT(RGB(0, &h1f&, &hf1&)) = "VT_I4", "getVT(RGB(&hf1&, &h1f&, &hf1&)) = " & getVT(RGB(&hf1&, &h1f&, &hf1&)))
Call ok(RGB(&hef&, &hab&, &hcd&) = &hcdabef&, "RGB(&hef&, &hab&, &hcd&) = " & RGB(&hef&, &hab&, &hcd&))
Call ok(getVT(RGB(&hef&, &hab&, &hcd&)) = "VT_I4", "getVT(RGB(&hef&, &hab&, &hcd&)) = " & getVT(RGB(&hef&, &hab&, &hcd&)))
Call ok(RGB(&h1&, &h100&, &h111&) = &hffff01&, "RGB(&h1&, &h100&, &h111&) = " & RGB(&h1&, &h100&, &h111&))
Call ok(getVT(RGB(&h1&, &h100&, &h111&)) = "VT_I4", "getVT(RGB(&h1&, &h100&, &h111&)) = " & getVT(RGB(&h1&, &h100&, &h111&)))
Call testRGBError(-1, &h1e&, &h3b&, 5)
Call testRGBError(&h4d&, -2, &h2f&, 5)
Call reportSuccess()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment