Akihiro Sagawa : ieframe/tests: Add more IPropertyStorage read/write tests.

Alexandre Julliard julliard at winehq.org
Sat Aug 13 14:19:16 CDT 2022


Module: wine
Branch: master
Commit: 3535fe2591415baf60c647ab85318d0316d7c9f4
URL:    https://gitlab.winehq.org/wine/wine/-/commit/3535fe2591415baf60c647ab85318d0316d7c9f4

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Fri Aug 12 19:45:46 2022 +0900

ieframe/tests: Add more IPropertyStorage read/write tests.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>

---

 dlls/ieframe/tests/intshcut.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/dlls/ieframe/tests/intshcut.c b/dlls/ieframe/tests/intshcut.c
index 4e86000d610..9778d77cd11 100644
--- a/dlls/ieframe/tests/intshcut.c
+++ b/dlls/ieframe/tests/intshcut.c
@@ -173,12 +173,18 @@ static void test_ReadAndWriteProperties(void)
     WCHAR fileNameW[MAX_PATH];
     static WCHAR iconPath[] = L"file:///C:/arbitrary/icon/path";
     char testurl[] = "http://some/bogus/url.html";
+    PROPVARIANT pv[2], pvread[2];
 
     ps[0].ulKind = PRSPEC_PROPID;
     U(ps[0]).propid = PID_IS_ICONFILE;
     ps[1].ulKind = PRSPEC_PROPID;
     U(ps[1]).propid = PID_IS_ICONINDEX;
 
+    pv[0].vt = VT_LPWSTR;
+    U(pv[0]).pwszVal = iconPath;
+    pv[1].vt = VT_I4;
+    U(pv[1]).lVal = iconIndex;
+
     /* Make sure we have a valid temporary directory */
     GetTempPathW(MAX_PATH, fileNameW);
     lstrcatW(fileNameW, L"testshortcut.url");
@@ -190,7 +196,6 @@ static void test_ReadAndWriteProperties(void)
         IPersistFile *pf;
         IPropertyStorage *pPropStgWrite;
         IPropertySetStorage *pPropSetStg;
-        PROPVARIANT pv[2];
 
         /* We need to set a URL -- IPersistFile refuses to save without one. */
         hr = urlA->lpVtbl->SetURL(urlA, testurl, 0);
@@ -205,10 +210,6 @@ static void test_ReadAndWriteProperties(void)
 
         IPersistFile_Release(pf);
 
-        pv[0].vt = VT_LPWSTR;
-        U(pv[0]).pwszVal = iconPath;
-        pv[1].vt = VT_I4;
-        U(pv[1]).lVal = iconIndex;
         hr = urlA->lpVtbl->QueryInterface(urlA, &IID_IPropertySetStorage, (void **) &pPropSetStg);
         ok(hr == S_OK, "Unable to get an IPropertySetStorage, hr=0x%lx\n", hr);
 
@@ -218,6 +219,16 @@ static void test_ReadAndWriteProperties(void)
         hr = IPropertyStorage_WriteMultiple(pPropStgWrite, 2, ps, pv, 0);
         ok(hr == S_OK, "Unable to set properties, hr=0x%lx\n", hr);
 
+        memset(pvread, 0, sizeof(pvread));
+        hr = IPropertyStorage_ReadMultiple(pPropStgWrite, 2, ps, pvread);
+        ok(hr == S_OK, "Unable to read properties, hr=0x%lx\n", hr);
+        ok(pvread[1].vt == VT_I4, "got %d\n", pvread[1].vt);
+        ok(U(pvread[1]).lVal == iconIndex, "Read wrong icon index: %d\n", U(pvread[1]).iVal);
+        ok(pvread[0].vt == VT_LPWSTR, "got %d\n", pvread[0].vt);
+        ok(lstrcmpW(U(pvread[0]).pwszVal, iconPath) == 0, "Wrong icon path read: %s\n", wine_dbgstr_w(U(pvread[0]).pwszVal));
+        PropVariantClear(&pvread[0]);
+        PropVariantClear(&pvread[1]);
+
         hr = IPropertyStorage_Commit(pPropStgWrite, STGC_DEFAULT);
         ok(hr == S_OK, "Failed to commit properties, hr=0x%lx\n", hr);
 
@@ -268,6 +279,10 @@ static void test_ReadAndWriteProperties(void)
     }
         PropVariantClear(&pvread[0]);
         PropVariantClear(&pvread[1]);
+
+        hr = IPropertyStorage_WriteMultiple(pPropStgRead, 2, ps, pv, 0);
+        ok(hr == STG_E_ACCESSDENIED, "setting properties should return STG_E_ACCESSDENIED instead of 0x%lx\n", hr);
+
         IPropertyStorage_Release(pPropStgRead);
         IPropertySetStorage_Release(pPropSetStg);
         urlAFromFile->lpVtbl->Release(urlAFromFile);




More information about the wine-cvs mailing list