Author: akhaldi
Date: Thu Aug 18 10:35:58 2016
New Revision: 72303

URL: http://svn.reactos.org/svn/reactos?rev=72303&view=rev
Log:
[PROPSYS_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866

Modified:
    trunk/rostests/winetests/propsys/propsys.c

Modified: trunk/rostests/winetests/propsys/propsys.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/propsys/propsys.c?rev=72303&r1=72302&r2=72303&view=diff
==============================================================================
--- trunk/rostests/winetests/propsys/propsys.c  [iso-8859-1] (original)
+++ trunk/rostests/winetests/propsys/propsys.c  [iso-8859-1] Thu Aug 18 
10:35:58 2016
@@ -46,6 +46,10 @@
 DEFINE_GUID(expect_guid, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x12, 0x34, 
0x56, 0x78, 0x90, 0x12);
 
 #define GUID_MEMBERS(g) {(g).Data1, (g).Data2, (g).Data3, {(g).Data4[0], 
(g).Data4[1], (g).Data4[2], (g).Data4[3], (g).Data4[4], (g).Data4[5], 
(g).Data4[6], (g).Data4[7]}}
+
+static const char topic[] = "wine topic";
+static const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0};
+static const WCHAR emptyW[] = {0};
 
 static int strcmp_wa(LPCWSTR strw, const char *stra)
 {
@@ -159,7 +163,6 @@
 
 static void test_PSPropertyKeyFromString(void)
 {
-    static const WCHAR emptyW[] = {0};
     static const WCHAR fmtid_clsidW[] = {'S','t','d','F','o','n','t',' 
','1',0};
     static const WCHAR fmtid_truncatedW[] = 
{'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
                                              '1','2','3','4','-',0};
@@ -350,7 +353,7 @@
     } testcases[] =
     {
         {NULL, NULL, E_POINTER},
-        {NULL, &out, E_POINTER, {GUID_MEMBERS(dummy_guid), 0xdeadbeef}},
+        {NULL, &out, E_POINTER, out_init},
         {emptyW, NULL, E_POINTER},
         {emptyW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
         {fmtid_clsidW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
@@ -625,6 +628,28 @@
     PropVariantClear(&propvar);
 }
 
+static void test_PropVariantToStringAlloc(void)
+{
+    PROPVARIANT prop;
+    WCHAR *str;
+    HRESULT hres;
+
+    prop.vt = VT_NULL;
+    hres = PropVariantToStringAlloc(&prop, &str);
+    ok(hres == S_OK, "returned %x\n", hres);
+    ok(!lstrcmpW(str, emptyW), "got %s\n", wine_dbgstr_w(str));
+    CoTaskMemFree(str);
+
+    prop.vt = VT_LPSTR;
+    prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
+    strcpy(prop.u.pszVal, topic);
+    hres = PropVariantToStringAlloc(&prop, &str);
+    ok(hres == S_OK, "returned %x\n", hres);
+    ok(!lstrcmpW(str, topicW), "got %s\n", wine_dbgstr_w(str));
+    CoTaskMemFree(str);
+    PropVariantClear(&prop);
+}
+
 static void test_PropVariantCompare(void)
 {
     PROPVARIANT empty, null, emptyarray, i2_0, i2_2, i4_large, i4_largeneg, 
i4_2, str_2, str_02, str_b;
@@ -875,6 +900,42 @@
     ok(llval == -7, "got wrong value %s\n", debugstr_longlong(llval));
 }
 
+static void test_PropVariantChangeType_LPWSTR(void)
+{
+    PROPVARIANT dest, src;
+    HRESULT hr;
+
+    PropVariantInit(&dest);
+
+    src.vt = VT_NULL;
+    hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR);
+    ok(hr == S_OK, "hr=%x\n", hr);
+    ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
+    ok(!lstrcmpW(dest.u.pwszVal, emptyW), "got %s\n", 
wine_dbgstr_w(dest.u.pwszVal));
+    PropVariantClear(&dest);
+    PropVariantClear(&src);
+
+    src.vt = VT_LPSTR;
+    src.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
+    strcpy(src.u.pszVal, topic);
+    hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR);
+    ok(hr == S_OK, "hr=%x\n", hr);
+    ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
+    ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", 
wine_dbgstr_w(dest.u.pwszVal));
+    PropVariantClear(&dest);
+    PropVariantClear(&src);
+
+    src.vt = VT_LPWSTR;
+    src.u.pwszVal = CoTaskMemAlloc( (lstrlenW(topicW)+1) * sizeof(WCHAR));
+    lstrcpyW(src.u.pwszVal, topicW);
+    hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR);
+    ok(hr == S_OK, "hr=%x\n", hr);
+    ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
+    ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", 
wine_dbgstr_w(dest.u.pwszVal));
+    PropVariantClear(&dest);
+    PropVariantClear(&src);
+}
+
 START_TEST(propsys)
 {
     test_PSStringFromPropertyKey();
@@ -883,6 +944,8 @@
     test_InitPropVariantFromGUIDAsString();
     test_InitPropVariantFromBuffer();
     test_PropVariantToGUID();
+    test_PropVariantToStringAlloc();
     test_PropVariantCompare();
     test_intconversions();
-}
+    test_PropVariantChangeType_LPWSTR();
+}


Reply via email to