https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e270fbfd8d9bc917a7a1bb63348604c49fd028a4

commit e270fbfd8d9bc917a7a1bb63348604c49fd028a4
Author:     Amine Khaldi <[email protected]>
AuthorDate: Wed Mar 21 13:10:09 2018 +0100
Commit:     Amine Khaldi <[email protected]>
CommitDate: Wed Mar 21 13:10:09 2018 +0100

    [PROPSYS_WINETEST] Sync with Wine Staging 3.3. CORE-14434
---
 modules/rostests/winetests/propsys/propstore.c |  18 ++--
 modules/rostests/winetests/propsys/propsys.c   | 124 ++++++++++++++++++++++---
 2 files changed, 116 insertions(+), 26 deletions(-)

diff --git a/modules/rostests/winetests/propsys/propstore.c 
b/modules/rostests/winetests/propsys/propstore.c
index 78c1979bff..01500dd3f9 100644
--- a/modules/rostests/winetests/propsys/propstore.c
+++ b/modules/rostests/winetests/propsys/propstore.c
@@ -18,24 +18,20 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
 #define COBJMACROS
 
 #include <stdarg.h>
-//#include <stdio.h>
+#include <stdio.h>
 
 #define NONAMELESSUNION
 
-#include <windef.h>
-#include <winbase.h>
-#include <objbase.h>
-#include <propsys.h>
-#include <wine/test.h>
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "propsys.h"
+#include "wine/test.h"
 
-#include <initguid.h>
+#include "initguid.h"
 
 DEFINE_GUID(PKEY_WineTest, 0x7b317433, 0xdfa3, 0x4c44, 0xad, 0x3e, 0x2f, 0x80, 
0x4b, 0x90, 0xdb, 0xf4);
 
diff --git a/modules/rostests/winetests/propsys/propsys.c 
b/modules/rostests/winetests/propsys/propsys.c
index f226c164eb..a6c7023527 100644
--- a/modules/rostests/winetests/propsys/propsys.c
+++ b/modules/rostests/winetests/propsys/propsys.c
@@ -19,27 +19,20 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
 #define COBJMACROS
 
-//#include <stdarg.h>
+#include <stdarg.h>
 #include <stdio.h>
 
 #define NONAMELESSUNION
 
-#include <windef.h>
-#include <winbase.h>
-#include <winreg.h>
-#include <winnls.h>
-//#include "objbase.h"
-#include <ole2.h>
-#include <initguid.h>
-#include <propsys.h>
-#include <propvarutil.h>
-#include <wine/test.h>
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "initguid.h"
+#include "propsys.h"
+#include "propvarutil.h"
+#include "wine/test.h"
 
 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
 DEFINE_GUID(dummy_guid, 0xdeadbeef, 0xdead, 0xbeef, 0xde, 0xad, 0xbe, 0xef, 
0xca, 0xfe, 0xba, 0xbe);
@@ -1101,6 +1094,106 @@ static void test_PropVariantToBoolean(void)
     ok(val == TRUE, "Unexpected value %d\n", val);
 }
 
+static void test_PropVariantToStringWithDefault(void)
+{
+    PROPVARIANT propvar;
+    static WCHAR default_value[] = {'t', 'e', 's', 't', 0};
+    static WCHAR wstr_test2[] =  {'t', 'e', 's', 't', '2', 0};
+    static WCHAR wstr_empty[] = {0};
+    static WCHAR wstr_space[] = {' ', 0};
+    static CHAR str_test2[] =  "test2";
+    static CHAR str_empty[] = "";
+    static CHAR str_space[] = " ";
+    LPCWSTR result;
+
+    propvar.vt = VT_EMPTY;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_NULL;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_BOOL;
+    propvar.u.boolVal = VARIANT_TRUE;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_I4;
+    propvar.u.lVal = 15;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    /* VT_LPWSTR */
+
+    propvar.vt = VT_LPWSTR;
+    propvar.u.pwszVal = NULL;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_LPWSTR;
+    propvar.u.pwszVal = wstr_empty;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == wstr_empty, "Unexpected value %s\n", wine_dbgstr_w(result));
+
+    propvar.vt = VT_LPWSTR;
+    propvar.u.pwszVal = wstr_space;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == wstr_space, "Unexpected value %s\n", wine_dbgstr_w(result));
+
+    propvar.vt = VT_LPWSTR;
+    propvar.u.pwszVal = wstr_test2;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == wstr_test2, "Unexpected value %s\n", wine_dbgstr_w(result));
+
+    /* VT_LPSTR */
+
+    propvar.vt = VT_LPSTR;
+    propvar.u.pszVal = NULL;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_LPSTR;
+    propvar.u.pszVal = str_empty;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_LPSTR;
+    propvar.u.pszVal = str_space;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_LPSTR;
+    propvar.u.pszVal = str_test2;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(result == default_value, "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    /* VT_BSTR */
+
+    propvar.vt = VT_BSTR;
+    propvar.u.bstrVal = NULL;
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(!lstrcmpW(result, wstr_empty), "Unexpected value %s\n", 
wine_dbgstr_w(result));
+
+    propvar.vt = VT_BSTR;
+    propvar.u.bstrVal = SysAllocString(wstr_empty);
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(!lstrcmpW(result, wstr_empty), "Unexpected value %s\n", 
wine_dbgstr_w(result));
+    SysFreeString(propvar.u.bstrVal);
+
+    propvar.vt = VT_BSTR;
+    propvar.u.bstrVal = SysAllocString(wstr_space);
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(!lstrcmpW(result, wstr_space), "Unexpected value %s\n", 
wine_dbgstr_w(result));
+    SysFreeString(propvar.u.bstrVal);
+
+    propvar.vt = VT_BSTR;
+    propvar.u.bstrVal = SysAllocString(wstr_test2);
+    result = PropVariantToStringWithDefault(&propvar, default_value);
+    ok(!lstrcmpW(result, wstr_test2), "Unexpected value %s\n", 
wine_dbgstr_w(result));
+    SysFreeString(propvar.u.bstrVal);
+}
+
 static void test_PropVariantChangeType_LPWSTR(void)
 {
     PROPVARIANT dest, src;
@@ -1150,4 +1243,5 @@ START_TEST(propsys)
     test_intconversions();
     test_PropVariantChangeType_LPWSTR();
     test_PropVariantToBoolean();
+    test_PropVariantToStringWithDefault();
 }

Reply via email to