From e605d3e9bffbe3c4d57ee78465a8dd3d49e049e2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 5 Sep 2008 22:47:28 +1000 Subject: [PATCH] mshtml: Add IHTMLBodyElement bgColor tests. --- dlls/mshtml/tests/dom.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index b658a74eb96..ce7391d2e1c 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2036,6 +2036,36 @@ static void test_default_body(IHTMLBodyElement *body) ok(!l, "scrollWidth = %ld\n", l); } +static void test_body_funs(IHTMLBodyElement *body) +{ + static WCHAR sRed[] = {'r','e','d',0}; + static WCHAR sRedbg[] = {'#','f','f','0','0','0','0',0}; + VARIANT vbg; + VARIANT vDefaultbg; + HRESULT hres; + + hres = IHTMLBodyElement_get_bgColor(body, &vDefaultbg); + ok(hres == S_OK, "get_background failed: %08x\n", hres); + ok(V_VT(&vDefaultbg) == VT_BSTR, "bstr != NULL\n"); + + V_VT(&vbg) = VT_BSTR; + V_BSTR(&vbg) = SysAllocString(sRed); + hres = IHTMLBodyElement_put_bgColor(body, vbg); + ok(hres == S_OK, "get_background failed: %08x\n", hres); + VariantClear(&vbg); + + hres = IHTMLBodyElement_get_bgColor(body, &vbg); + ok(hres == S_OK, "get_background failed: %08x\n", hres); + ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n"); + ok(!lstrcmpW(V_BSTR(&vbg), sRedbg), "Unexpected type %s\n", dbgstr_w(V_BSTR(&vbg))); + VariantClear(&vbg); + + /* Restore Originial */ + hres = IHTMLBodyElement_put_bgColor(body, vDefaultbg); + ok(hres == S_OK, "get_background failed: %08x\n", hres); + VariantClear(&vDefaultbg); +} + static void test_window(IHTMLDocument2 *doc) { IHTMLWindow2 *window, *window2, *self; @@ -2091,6 +2121,7 @@ static void test_defaults(IHTMLDocument2 *doc) hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLBodyElement, (void**)&body); ok(hres == S_OK, "Could not get IHTMBodyElement: %08x\n", hres); test_default_body(body); + test_body_funs(body); IHTMLBodyElement_Release(body); hres = IHTMLElement_get_style(elem, &style);