[MSHTML_WINETEST]
[reactos.git] / rostests / winetests / mshtml / style.c
index a8c56d4..3cab200 100644 (file)
@@ -37,6 +37,13 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
     return lstrcmpA(stra, buf);
 }
 
+static BOOL wstr_contains(const WCHAR *strw, const char *stra)
+{
+    CHAR buf[512];
+    WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
+    return strstr(buf, stra) != NULL;
+}
+
 static BSTR a2bstr(const char *str)
 {
     BSTR ret;
@@ -464,11 +471,52 @@ static void test_style4(IHTMLStyle4 *style4)
     VariantClear(&vdefault);
 }
 
+static void test_style6(IHTMLStyle6 *style)
+{
+    BSTR str;
+    HRESULT hres;
+
+    str = (void*)0xdeadbeef;
+    hres = IHTMLStyle6_get_outline(style, &str);
+    ok(hres == S_OK, "get_outline failed: %08x\n", hres);
+    ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
+    str = a2bstr("1px");
+    hres = IHTMLStyle6_put_outline(style, str);
+    ok(hres == S_OK, "put_outline failed: %08x\n", hres);
+    SysFreeString(str);
+
+    str = (void*)0xdeadbeef;
+    hres = IHTMLStyle6_get_outline(style, &str);
+    ok(hres == S_OK, "get_outline failed: %08x\n", hres);
+    ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
+    str = (void*)0xdeadbeef;
+    hres = IHTMLStyle6_get_boxSizing(style, &str);
+    ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
+    ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
+    str = a2bstr("border-box");
+    hres = IHTMLStyle6_put_boxSizing(style, str);
+    ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
+    SysFreeString(str);
+
+    str = NULL;
+    hres = IHTMLStyle6_get_boxSizing(style, &str);
+    ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+}
+
 static void test_body_style(IHTMLStyle *style)
 {
     IHTMLStyle2 *style2;
     IHTMLStyle3 *style3;
     IHTMLStyle4 *style4;
+    IHTMLStyle6 *style6;
     VARIANT_BOOL b;
     VARIANT v;
     BSTR str;
@@ -2044,6 +2092,22 @@ static void test_body_style(IHTMLStyle *style)
     ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
     SysFreeString(str);
 
+    /* listStyleType */
+    hres = IHTMLStyle_get_listStyleType(style, &str);
+    ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
+    ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
+
+    str = a2bstr("square");
+    hres = IHTMLStyle_put_listStyleType(style, str);
+    ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
+    SysFreeString(str);
+
+    str = NULL;
+    hres = IHTMLStyle_get_listStyleType(style, &str);
+    ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
     ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
     if(SUCCEEDED(hres)) {
@@ -2064,6 +2128,14 @@ static void test_body_style(IHTMLStyle *style)
         test_style4(style4);
         IHTMLStyle4_Release(style4);
     }
+
+    hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
+    if(SUCCEEDED(hres)) {
+        test_style6(style6);
+        IHTMLStyle6_Release(style6);
+    }else {
+        win_skip("IHTMLStyle6 not available\n");
+    }
 }
 
 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
@@ -2647,9 +2719,9 @@ static void run_test(const char *str, style_test_t test)
 
     do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
 
-    while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
+    while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
         TranslateMessage(&msg);
-        DispatchMessage(&msg);
+        DispatchMessageW(&msg);
     }
 
     test(doc);